Переглянути джерело

Added a new API call for creating tables in Chado

Stephen Ficklin 12 роки тому
батько
коміт
bcc8d13f15
1 змінених файлів з 24 додано та 0 видалено
  1. 24 0
      tripal_core/tripal_core.api.inc

+ 24 - 0
tripal_core/tripal_core.api.inc

@@ -1795,3 +1795,27 @@ function tripal_get_max_chado_rank ($tablename, $where_options) {
 		return -1;
 	}
 }
+/**
+ * Add a new table to the Chado database
+ *
+ * @param $ret
+ *   Array to which query results will be added.
+ * @param $table
+ *   The name of the table to create.
+ * @param $schema 
+ *   A Drupal-style Schema API definition of the table
+ *
+ * @return 
+ *   A database query result resource for the new table, or FALSE if table was not constructed.
+ *
+ * @ingroup tripal_core_api
+ */
+function tripal_create_chado_table (&$ret,$table,$schema) {
+   $ret = array();
+   
+   $previous_db = tripal_db_set_active('chado');  // use chado database
+   db_create_table($ret,$table,$schema[$table]);
+   tripal_db_set_active($previous_db);  // now use drupal database
+   
+   return $ret;
+}