Browse Source

fixed:getTable error

Zhu Jinhui 6 năm trước cách đây
mục cha
commit
505d25e77f
1 tập tin đã thay đổi với 7 bổ sung2 xóa
  1. 7 2
      src/Driver/Base.php

+ 7 - 2
src/Driver/Base.php

@@ -329,8 +329,13 @@ class Base
     public function getTable($table)
     {
         list($database, $tableName) = array_pad(explode('.', $table), 2, '');
-        if ($tableName) return "`{$database}`.`{$tableName}`";
-        return '`' . $table . '`';
+
+        if ($tableName) {
+            $tableName = stristr($tableName, '`') ? $tableName : '`'. $tableName .'`';
+            return "`{$database}`.`{$tableName}`";
+        }
+        $table = stristr($table, '`') ? $table : '`'. $table .'`';
+        return $table;
     }
 
     public function setLanguage()