]> git.nbdom.net Git - nb.git/commitdiff
fix bug for extras
authorDevops <sys@15gifts.com>
Tue, 30 May 2017 11:01:26 +0000 (12:01 +0100)
committerDevops <sys@15gifts.com>
Tue, 30 May 2017 11:01:26 +0000 (12:01 +0100)
lib/php/db/table.php

index fed26d64d3ce839471311a75280fdebc5e62dd2d..bfa963e32d77033953e17ecff856ede086804125 100644 (file)
@@ -701,14 +701,9 @@ Class Table extends nb {
         $v = $this->db()->quote($v);
         $equal = ' '.($not ? 'NOT ' : '').$regexp.' ';
 
-      // Text
-# NB 16.03.17       } elseif (preg_match('/text|char|blob|date/',$field->type)
-# NB 16.03.17         or ($v!='null' and !preg_match('/^\d+(\.\d*)?$/',$v)) # text criteria value
-# NB 16.03.17       ) {
       } elseif ($field->string()) {
 
         if (strtolower($v)=='null') $v = '';
-        #$k = "COLAESCE($k,'')";
 
         // * -> %
         $v = str_replace('*','%',$v);
@@ -738,7 +733,6 @@ Class Table extends nb {
       }
 
       if (preg_match("/(LIKE|$regexp) ..$/","$equal$v") and $field->null) {
-# NB 20.12.16         $k = "COALESCE($k,".$this->db()->quote('').")";
         $k = 'COALESCE('.$field->sql_name().','.$this->db()->quote('').")";
 
       } elseif ($field->extras) {
@@ -756,28 +750,12 @@ Class Table extends nb {
       }
 
       # having, denorm, EMPTY
-      /*
-      $extra_where = (string)$this->db()->conf_type('extra_where');
-      if ($extra_where == 'having' and $field->extras) {
-        $having[] = $this->extras[$k]->sql_name()."$equal$v";
-
-      } elseif ($extra_where == 'denorm' and $field->extras) {
-        $where[] = $this->extras[$k]->sql_name()."$equal$v";
-
-      } elseif ($field->extras) {
-        $where[] = $this->extras[$k]->sql_name()."$equal$v";
-
-      } else {
-        $where[] = $field->sql_name()."$equal$v";
-      }
-      */
-
       if ($field->extras) {
         $extra_where = (string)$this->db()->conf_type('extra_where');
         if ($extra_where == 'having') {
-          $having[] = $k->sql_name()."$equal$v";
+          $having[] = "$k$equal$v";
         } else {
-          $where[] = $k->sql_name()."$equal$v";
+          $where[] = "$k$equal$v";
         }
       } else {
         $where[] = "$k$equal$v";
@@ -1129,11 +1107,8 @@ Class Table extends nb {
       #
       $count_fields = 0;
 
-# NB 19.11.16       foreach ($this->fields() as $f => $field) {
-# NB 19.11.16         $row[$f] = $field->out(isset($row[$f]) ? $row[$f] : '');
       foreach ($fields as $f => $field) {
         $row[$f] = $field->out(isset($row[$f]) ? $row[$f] : '');
-# NB 19.11.16         $row[$f] = $this->field($f)->out(isset($row[$f]) ? $row[$f] : '');
         $count_fields++;
       }
 
@@ -1181,7 +1156,6 @@ Class Table extends nb {
 
       $tot = $query->fetch(PDO::FETCH_COLUMN);
       $this->tot = $opt['tot'] = $tot;
-      #if (!$tot) return;
 
     } # < is_html