|
@@ -1501,10 +1501,10 @@ function chado_query($sql, $args = array()) {
|
|
// if Chado is local to the database then prefix the Chado table
|
|
// if Chado is local to the database then prefix the Chado table
|
|
// names with 'chado'.
|
|
// names with 'chado'.
|
|
if ($is_local) {
|
|
if ($is_local) {
|
|
-
|
|
+
|
|
// Remove carriage returns from the SQL.
|
|
// Remove carriage returns from the SQL.
|
|
$sql = preg_replace('/\n/', '', $sql); // remove carriage returns
|
|
$sql = preg_replace('/\n/', '', $sql); // remove carriage returns
|
|
-
|
|
+
|
|
// Prefix the tables with their correct schema.
|
|
// Prefix the tables with their correct schema.
|
|
// Chado tables should be enclosed in curly brackets (ie: {feature} )
|
|
// Chado tables should be enclosed in curly brackets (ie: {feature} )
|
|
// and Drupal tables should be enclosed in square brackets (ie: [tripal_jobs] ).
|
|
// and Drupal tables should be enclosed in square brackets (ie: [tripal_jobs] ).
|
|
@@ -1513,9 +1513,10 @@ function chado_query($sql, $args = array()) {
|
|
$sql = preg_replace('/\{(.*?)\}/', 'chado.$1', $sql);
|
|
$sql = preg_replace('/\{(.*?)\}/', 'chado.$1', $sql);
|
|
$sql = preg_replace('/\[(\w+)\]/', 'public.$1', $sql);
|
|
$sql = preg_replace('/\[(\w+)\]/', 'public.$1', $sql);
|
|
|
|
|
|
- // the featureloc table has some indexes that use function that call other functions
|
|
+ // The featureloc table has some indexes that use function that call other
|
|
- // and those calls do not reference a schema, therefore, any tables with featureloc
|
|
+ // functions and those calls do not reference a schema, therefore, any
|
|
- // must automaticaly have the chado schema set as active to find
|
|
+ // tables with featureloc must automaticaly have the chado schema set as
|
|
|
|
+ // active to find.
|
|
if (preg_match('/chado.featureloc/i', $sql) or preg_match('/chado.feature/i', $sql)) {
|
|
if (preg_match('/chado.featureloc/i', $sql) or preg_match('/chado.feature/i', $sql)) {
|
|
$previous_db = chado_set_active('chado') ;
|
|
$previous_db = chado_set_active('chado') ;
|
|
$results = db_query($sql, $args);
|
|
$results = db_query($sql, $args);
|