ソースを参照

Changed default search_path from 'public' to 'public,chado'

spficklin 12 年 前
コミット
1b2ff73c2d
2 ファイル変更13 行追加1 行削除
  1. 11 1
      tripal_core/api/tripal_core.api.inc
  2. 2 0
      tripal_core/includes/mviews.php

+ 11 - 1
tripal_core/api/tripal_core.api.inc

@@ -2499,6 +2499,16 @@ function tripal_db_set_active($dbname  = 'default') {
   }
 }
 
+/**
+ * Gets the current search_path for PostgreSQL
+ *
+ * @ingroup tripal_chado_api
+ */
+function tripal_db_get_search_path() {
+  $path = db_fetch_object(db_query("show search_path"));
+  return $path->search_path;
+}
+
 /**
  * Set the chado search_path for PostgreSQL
  *
@@ -2537,7 +2547,7 @@ function tripal_db_set_chado_search_path($dbname) {
  */
 function tripal_db_set_default_search_path() {
   // we make the assumption that the default schema is 'public'.
-  db_query('set search_path to %s', 'public');
+  db_query('set search_path to %s', 'public,chado');
 }
 /**
  * Indicates if the SQL statement is prepapred

+ 2 - 0
tripal_core/includes/mviews.php

@@ -324,7 +324,9 @@ function tripal_update_mview($mview_id) {
     tripal_db_set_active($previous_db);  // now use drupal database
     if ($results) {
       $sql = "SELECT count(*) as cnt FROM {%s}";
+      $previous_db = tripal_db_set_active('chado');  // use chado database
       $count = db_fetch_object(db_query($sql, $mview->mv_table));
+      tripal_db_set_active($previous_db);  // now use drupal database
       $record = new stdClass();
       $record->mview_id = $mview_id;
       $record->last_update = time();