[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_3_1RC1-273-gdbd83fa

Marc Delisle lem9 at users.sourceforge.net
Mon Mar 29 23:26:47 CEST 2010


The branch, master has been updated
       via  dbd83fa123f951fce7795ca38bb117b64a5c2aaf (commit)
      from  775d2ce26417a2c52b42f719a0dbccc3e63e468b (commit)


- Log -----------------------------------------------------------------
commit dbd83fa123f951fce7795ca38bb117b64a5c2aaf
Author: Martynas Mickevičius <BlinK_ at users.sourceforge.net>
Date:   Mon Mar 29 17:26:27 2010 -0400

    Patch #2975533 New search operators

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                    |    2 ++
 libraries/config.default.php |   10 +++++++++-
 tbl_select.php               |   18 +++++++++++++++++-
 3 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 51febbb..6fe706b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -53,6 +53,8 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
   to Pavel Konnikov and Herman van Rink
 + patch #2974341 [structure] Clicking on table name in db Structure should 
   Browse the table if possible, thanks to bhdouglass - dougboybhd
++ patch #2975533 [search] New search operators, thanks to
+  Martynas Mickevičius
 
 3.3.2.0 (not yet released)
 - patch #2969449 [core] Name for MERGE engine varies depending on the
diff --git a/libraries/config.default.php b/libraries/config.default.php
index 35f603d..1aa1348 100644
--- a/libraries/config.default.php
+++ b/libraries/config.default.php
@@ -2990,6 +2990,10 @@ $cfg['NumOperators'] = array(
    '!=',
    'LIKE',
    'NOT LIKE',
+   'IN (...)',
+   'NOT IN (...)',
+   'BETWEEN',
+   'NOT BETWEEN',
 );
 
 /**
@@ -3007,7 +3011,11 @@ $cfg['TextOperators'] = array(
    'REGEXP ^...$',
    'NOT REGEXP',
    "= ''",
-   "!= ''"
+   "!= ''",
+   'IN (...)',
+   'NOT IN (...)',
+   'BETWEEN',
+   'NOT BETWEEN',
 );
 
 /**
diff --git a/tbl_select.php b/tbl_select.php
index 874502e..0fbd24c 100644
--- a/tbl_select.php
+++ b/tbl_select.php
@@ -408,7 +408,23 @@ else {
                     $func_type = 'REGEXP';
                     $fields[$i] = '^' . $fields[$i] . '$';
                 }
-                $w[] = PMA_backquote($names[$i]) . ' ' . $func_type . ' ' . $quot . PMA_sqlAddslashes($fields[$i]) . $quot;
+
+                if ($func_type == 'IN (...)' || $func_type == 'NOT IN (...)' || $func_type == 'BETWEEN' || $func_type == 'NOT BETWEEN') {
+                    $func_type = str_replace(' (...)', '', $func_type);
+
+                    // quote values one by one
+                    $values = explode(',', $fields[$i]);
+                    foreach ($values as &$value)
+                        $value = $quot . PMA_sqlAddslashes(trim($value)) . $quot;
+
+                    if ($func_type == 'BETWEEN' || $func_type == 'NOT BETWEEN')
+                        $w[] = PMA_backquote($names[$i]) . ' ' . $func_type . ' ' . (isset($values[0]) ? $values[0] : '')  . ' AND ' . (isset($values[1]) ? $values[1] : '');
+                    else
+                        $w[] = PMA_backquote($names[$i]) . ' ' . $func_type . ' (' . implode(',', $values) . ')';
+                }
+                else {
+                    $w[] = PMA_backquote($names[$i]) . ' ' . $func_type . ' ' . $quot . PMA_sqlAddslashes($fields[$i]) . $quot;;
+                }
 
             } // end if
         } // end for


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list