Browse Source

Issue #2567053: Moved hard-coding of public schema into a single spot in chado query as well as added todo comments to highlight points where external chado support is broken.

Lacey Sanderson 10 năm trước cách đây
mục cha
commit
9a05f034b4

+ 3 - 2
tripal_analysis/api/tripal_analysis.api.inc

@@ -172,9 +172,10 @@ function tripal_get_analysis_select_options($syncd_only = TRUE) {
   $analysis_list[] = 'Select an analysis';
 
   if ($syncd_only) {
+    // @todo: Re-write to support external chado databases.
     $sql = "
       SELECT *
-      FROM public.chado_analysis CA
+      FROM [chado_analysis] CA
         INNER JOIN {analysis} A ON A.analysis_id = CO.analysis_id
       ORDER BY A.name
     ";
@@ -196,4 +197,4 @@ function tripal_get_analysis_select_options($syncd_only = TRUE) {
     }
   }
   return $analysis_list;
-}
+}

+ 4 - 2
tripal_core/api/tripal_core.chado_nodes.api.inc

@@ -550,9 +550,10 @@ function chado_node_sync_form($form, &$form_state) {
       // Build Query, we do a left join on the chado_xxxx table in the Drupal schema
       // so that if no criteria are specified we only get those items that have not
       // yet been synced.
+      // @todo: re-write the query to support external chado databases.
       $query = "SELECT " . implode(', ', $select) . ' ' .
                'FROM {' . $base_table . '} ' . $base_table . ' ' . implode(' ', $joins) . ' '.
-               "  LEFT JOIN public.$linking_table CT ON CT.$base_table_id = $base_table.$base_table_id " .
+               "  LEFT JOIN [$linking_table] CT ON CT.$base_table_id = $base_table.$base_table_id " .
                "WHERE CT.$base_table_id IS NULL";
 
       // extend the where clause if needed
@@ -859,10 +860,11 @@ function chado_node_sync_records($base_table, $max_sync = FALSE,
   // Build Query, we do a left join on the chado_xxxx table in the Drupal schema
   // so that if no criteria are specified we only get those items that have not
   // yet been synced.
+  // @todo: re-write to support external chado databases.
   $query = "
     SELECT " . implode(', ', $select) . ' ' .
     'FROM {' . $base_table . '} ' . $base_table . ' ' . implode(' ', $joins) . ' '.
-    "  LEFT JOIN public.$linking_table CT ON CT.$base_table_id = $base_table.$base_table_id " .
+    "  LEFT JOIN [$linking_table] CT ON CT.$base_table_id = $base_table.$base_table_id " .
     "WHERE CT.$base_table_id IS NULL ";
 
   // extend the where clause if needed

+ 3 - 2
tripal_feature/tripal_feature.module

@@ -481,6 +481,7 @@ function tripal_feature_match_features_page($id) {
     drupal_goto($match->source);
     return;
   }
+  // @todo: re-write to support external chado databases.
   $sql = "
     SELECT
       F.name, F.uniquename, F.feature_id,
@@ -493,7 +494,7 @@ function tripal_feature_match_features_page($id) {
       INNER JOIN {cvterm} CVT on CVT.cvterm_id = F.type_id
       LEFT JOIN {feature_synonym} FS on FS.feature_id = F.feature_id
       LEFT JOIN {synonym} S on S.synonym_id = FS.synonym_id
-      INNER JOIN public.chado_feature CF on CF.feature_id = F.feature_id
+      INNER JOIN [chado_feature] CF on CF.feature_id = F.feature_id
     WHERE
       F.uniquename = :uname or
       F.name = :fname or
@@ -592,4 +593,4 @@ function tripal_feature_form_alter(&$form, &$form_state, $form_id) {
  */
 function tripal_feature_exclude_field_from_feature_by_default() {
   return array('residues' => 'TRUE');
-}
+}

+ 3 - 2
tripal_organism/api/tripal_organism.api.inc

@@ -143,9 +143,10 @@ function tripal_get_organism_select_options($syncd_only = TRUE) {
   $org_list[] = 'Select an organism';
 
   if ($syncd_only) {
+    // @todo: Re-write to support external chado databases.
     $sql = "
       SELECT *
-      FROM public.chado_organism CO
+      FROM [chado_organism] CO
         INNER JOIN {organism} O ON O.organism_id = CO.organism_id
       ORDER BY O.genus, O.species
     ";
@@ -265,4 +266,4 @@ function tripal_autocomplete_organism($text) {
     $items[$name] = $name;
   }
   drupal_json_output($items);
-}
+}

+ 2 - 1
tripal_pub/includes/tripal_pub.pub_search.inc

@@ -573,9 +573,10 @@ function theme_tripal_pub_search_setup_form_elements($variables) {
 function tripal_search_publications($search_array, $offset, $limit, &$total_records) {
 
   // build the SQL based on the criteria provided by the user
+  // @todo: re-write to support external chado databases.
   $select = "SELECT DISTINCT P.*, CP.nid ";
   $from   = "FROM {pub} P
-               LEFT JOIN public.chado_pub CP on P.pub_id = CP.pub_id
+               LEFT JOIN [chado_pub] CP on P.pub_id = CP.pub_id
                INNER JOIN {cvterm} CVT on CVT.cvterm_id = P.type_id
             ";
   $where  = "WHERE (NOT P.title = 'null') "; // always exclude the dummy pub

+ 2 - 1
tripal_stock/tripal_stock.module

@@ -374,6 +374,7 @@ function tripal_stock_match_stocks_page($id) {
     drupal_goto($id);
   }
 
+  // @todo: re-write to support external chado databases.
   $sql = "
     SELECT
       S.name, S.uniquename, S.stock_id,
@@ -383,7 +384,7 @@ function tripal_stock_match_stocks_page($id) {
     FROM {stock} S
       INNER JOIN {organism} O on S.organism_id = O.organism_id
       INNER JOIN {cvterm} CVT on CVT.cvterm_id = S.type_id
-      INNER JOIN public.chado_stock CS on CS.stock_id = S.stock_id
+      INNER JOIN [chado_stock] CS on CS.stock_id = S.stock_id
     WHERE
       S.uniquename = :uname or S.name = :name
   ";