From 2102df6073bb0f579fc3c4751005a1621c6878be Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Tue, 17 Aug 2004 12:37:37 +0000 Subject: [PATCH] move search operators to config --- ChangeLog | 6 +++++ config.inc.php | 38 ++++++++++++++++++++++++++- libraries/common.lib.php | 2 +- libraries/config_import.lib.php | 46 +++++++++++++++++++++++++++++++++ tbl_select.php | 29 +++++---------------- 5 files changed, 97 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index 865b03846..495b21845 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,12 @@ phpMyAdmin - Changelog $Id$ $Source$ +2004-08-17 Marc Delisle + * tbl_select.php, config.inc.php, libraries/config_import.lib.php, + libraries/common.lib.php: move search operators to config file, + and set "LIKE" as default operator instead of "LIKE %...%", for + performance reasons + 2004-08-16 Alexander M. Turek * libraries/relation.lib.php: Fixed some collation problems with the relational tables (bug #995359). diff --git a/config.inc.php b/config.inc.php index 1ccff996a..a0e1a27a9 100644 --- a/config.inc.php +++ b/config.inc.php @@ -655,7 +655,7 @@ $cfg['ColumnTypes'] = array( 'SET' ); -// Atributes +// Attributes $cfg['AttributeTypes'] = array( '', 'BINARY', @@ -778,6 +778,42 @@ if ($cfg['ShowFunctionFields']) { } // end if +// Search operators +$cfg['NumOperators'] = array( + '=', + '>', + '>=', + '<', + '<=', + '!=', + 'LIKE', + 'NOT LIKE' +); + +$cfg['TextOperators'] = array( + 'LIKE', + 'LIKE %...%', + 'NOT LIKE', + '=', + '!=', + 'REGEXP', + 'NOT REGEXP' +); + +$cfg['EnumOperators'] = array( + '=', + '!=' +); + +$cfg['NullOperators'] = array( + 'IS NULL', + 'IS NOT NULL' +); + +$cfg['UnaryOperators'] = array( + 'IS NULL' => 1, + 'IS NOT NULL' => 1 +); /** * Unset magic_quotes_runtime - do not change! diff --git a/libraries/common.lib.php b/libraries/common.lib.php index d1c4eaf87..07caf3a36 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -142,7 +142,7 @@ if (isset($cfg['FileRevision'])) { } else { $cfg['FileRevision'] = array(1, 1); } -if ($cfg['FileRevision'][0] < 2 || ($cfg['FileRevision'][0] == 2 && $cfg['FileRevision'][1] < 36)) { +if ($cfg['FileRevision'][0] < 2 || ($cfg['FileRevision'][0] == 2 && $cfg['FileRevision'][1] < 38)) { require_once('./libraries/config_import.lib.php'); } diff --git a/libraries/config_import.lib.php b/libraries/config_import.lib.php index 27d5e062d..2f0966d1e 100644 --- a/libraries/config_import.lib.php +++ b/libraries/config_import.lib.php @@ -1046,6 +1046,52 @@ if ($cfg['ShowFunctionFields']) { } } +if (!isset($cfg['NumOperators'])) { + $cfg['NumOperators'] = array( + '=', + '>', + '>=', + '<', + '<=', + '!=', + 'LIKE', + 'NOT LIKE' + ); +} + +if (!isset($cfg['TextOperators'])) { + $cfg['TextOperators'] = array( + 'LIKE', + 'LIKE %...%', + 'NOT LIKE', + '=', + '!=', + 'REGEXP', + 'NOT REGEXP' + ); +} + +if (!isset($cfg['EnumOperators'])) { + $cfg['EnumOperators'] = array( + '=', + '!=' + ); +} + +if (!isset($cfg['NullOperators'])) { + $cfg['NullOperators'] = array( + 'IS NULL', + 'IS NOT NULL' + ); +} + +if (!isset($cfg['UnaryOperators'])) { + $cfg['UnaryOperators'] = array( + 'IS NULL' => 1, + 'IS NOT NULL' => 1 + ); +} + if (!isset($cfg['GD2Available'])) { $cfg['GD2Available'] = 'auto'; } diff --git a/tbl_select.php b/tbl_select.php index 7e99c8ccb..ebe4c864e 100644 --- a/tbl_select.php +++ b/tbl_select.php @@ -30,20 +30,6 @@ if ($cfg['PropertiesIconic'] == true) { $titles['Browse'] = $strBrowseForeignValues; } -/** - * Defines arrays of functions (should possibly be in config.inc.php - * so it can also be used in tbl_qbe.php) - * - * LIKE works also on integers and dates so I added it in numfunctions - */ -$numfunctions = array('=', '>', '>=', '<', '<=', '!=', 'LIKE', 'NOT LIKE'); -$textfunctions = array('LIKE %...%','LIKE', 'NOT LIKE', '=', '!=', 'REGEXP', 'NOT REGEXP'); -$enumfunctions = array('=', '!='); -$nullfunctions = array('IS NULL', 'IS NOT NULL'); -$unaryfunctions = array( - 'IS NULL' => 1, - 'IS NOT NULL' => 1); - /** * Not selection yet required -> displays the selection form */ @@ -103,8 +89,8 @@ if (!isset($param) || $param[0] == '') { function PMA_tbl_select_operator(f, index, multiple) { switch (f.elements["func[" + index + "]"].options[f.elements["func[" + index + "]"].selectedIndex].value) { @@ -242,23 +228,23 @@ function PMA_tbl_select_operator(f, index, multiple) {