]> git.nbdom.net Git - nb.git/commitdiff
lib/php/db/table.php
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Thu, 4 Jan 2018 18:56:49 +0000 (18:56 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Thu, 4 Jan 2018 18:56:49 +0000 (18:56 +0000)
lib/php/db/table.php

index 1805f5d0c1039ff71b8ae8d54566da25bd494323..501745226ec787eaeb3e392d3b90147645d2389d 100644 (file)
@@ -793,7 +793,10 @@ Class Table extends nb {
                        if (!preg_match('/^(char|varchar|text|blog)/i',$field->type)) $name = $field->sql_name_cast_text();
 
 # NB 04.01.18       if (preg_match("/(LIKE|$regexp) ..$/","$equal$v") and $field->null) {
-      if (preg_match("/(LIKE|$regexp) ..$/","$equal$v")) {
+#bye("$equal$v");
+      #if (preg_match("/(LIKE|$regexp) ..$/","$equal$v")) {
+      if (preg_match("/^(LIKE|$regexp)$/",trim($equal))) {
+                       #if (trim($equal) == 'LIKE' or trim($equal) == $regexp) {
         if ($field->null) $k = 'COALESCE('.$name.','.$this->db()->quote('').")";
 
       } elseif ($field->extras) {
@@ -817,16 +820,19 @@ Class Table extends nb {
         $extra_where = (string)$this->db()->conf_type('extra_where');
     #if ($_SERVER['REMOTE_USER'] == 'nico') debug($sql);
         $k = $field->extras;
+
         if ($extra_where == 'having') {
           $having[] = "$k$equal$v";
         } else {
           $where[] = "$k$equal$v";
         }
+
       } else {
         $where[] = "$k$equal$v";
+
       }
 
-    } #foreach fields
+    } #< foreach
 
     $sql = '';
     if ($where) $sql .= ' WHERE '.join(" $logic ",$where);