浏览代码

Fixed some bugs

zjh 9 小时之前
父节点
当前提交
cc0b592414
共有 1 个文件被更改,包括 3 次插入4 次删除
  1. 3 4
      src/Driver/Traits/SQL.php

+ 3 - 4
src/Driver/Traits/SQL.php

@@ -159,10 +159,6 @@ trait SQL
             $this->fields = $this->fields == null ? $fields : $this->fields . ', ' . $fields;
             return $this;
         }
-
-        if(preg_match('/(COUNT|SUM)\((.*)\)/', $this->fields)) {
-            return $this;
-        }
         $arr = [];
         foreach($fields as $field) {
             // 处理 ['table1.field', 'table2.field']
@@ -942,6 +938,9 @@ trait SQL
      * @return mixed|string
      */
     final public function formatLimitForUpdate($limit) {
+        if($limit == null) {
+            return '';
+        }
         preg_match("/LIMIT\s+(\d+),\s+(\d+)/", $limit, $matches);
         if(count($matches) == 3) {
             return "LIMIT ". intval($matches[2]);