Explorar o código

Fixed: 如果没有wher条件的情况下,OR 条件bug

Jinhui Zhu %!s(int64=5) %!d(string=hai) anos
pai
achega
1bbfea14f0
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      src/Driver/Base.php

+ 3 - 1
src/Driver/Base.php

@@ -751,11 +751,13 @@ class Base
         $orCond = array();
         if(is_array($or)) {
             foreach($or as $key => $val) {
-                $orCond[] = sprintf($key, $this->setQuote($val));
+                $orCond[] = sprintf($this->_query['OR'], $key, $this->setQuote($val));
             }
         }
         if(!empty($this->where)) {
             $this->where .= " OR (". join(" ". $opt . " ", $orCond) .")";
+        }else{
+            $this->where = " WHERE (". join(" ". $opt . " ", $orCond) .")";
         }
         return $this;
     }