浏览代码

Match the replace functionality of select in join

Abdullah Almsaeed 6 年之前
父节点
当前提交
eb5257f6d3
共有 2 个文件被更改,包括 4 次插入2 次删除
  1. 1 1
      tripal_chado/api/tripal_chado.query.api.inc
  2. 3 1
      tripal_chado/includes/ChadoPrefixExtender.inc

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

@@ -2067,7 +2067,7 @@ function hook_chado_get_schema_name_alter($schema_name, $context) {
  * @ingroup tripal_chado_query_api
  */
 function chado_db_select($table, $alias = NULL, array $options = array()) {
-  if(strpos($table, '[') !== 0) {
+  if(strpos($table, '[') !== 0 && strpos($table, ']') !== strlen($table)) {
     $table = "{{$table}}";
   }
   $table = chado_replace_table_prefix($table);

+ 3 - 1
tripal_chado/includes/ChadoPrefixExtender.inc

@@ -25,7 +25,9 @@ class ChadoPrefixExtender extends SelectQueryExtender {
    * @return $this
    */
   public function join($table, $alias = NULL, $condition = NULL, $arguments = []) {
-
+    if(strpos($table, '[') !== 0 && strpos($table, ']') !== strlen($table)) {
+      $table = "{{$table}}";
+    }
     $table = chado_replace_table_prefix($table);
     $this->query->join($table, $alias, $condition, $arguments);
     return $this;