Browse Source

Fixed a bug that when an SQL statement spans multiple lines, chado_query() messed up the SQL by removing the carriage returns and caused error. The carriage return should be replaced by at least one space when joining lines.

Chun-Huai Cheng 6 years ago
parent
commit
a688fe3cd1
1 changed files with 1 additions and 1 deletions
  1. 1 1
      tripal_chado/api/tripal_chado.query.api.inc

+ 1 - 1
tripal_chado/api/tripal_chado.query.api.inc

@@ -1671,7 +1671,7 @@ function chado_query($sql, $args = array()) {
   // names with 'chado'.
   if ($is_local) {
     // Remove carriage returns from the SQL.
-    $sql = preg_replace('/\n/', '', $sql);
+    $sql = preg_replace('/\n/', ' ', $sql);
 
     // Prefix the tables with their correct schema.
     // Chado tables should be enclosed in curly brackets (ie: {feature} )