The branch, master has been updated via 66158f66c291b0ad1e627205d9381beeed061ded (commit) via 511cf978f6a910a3d7376884d42d1c502298aeba (commit) via 866d1da95a853cd35920253e53432c4f55ad61bf (commit) via 87a539aea7240e7563e47927f10000368a921e90 (commit) via c9df5b273323d9e8af0f86d7ce72e0e6d1728b0d (commit) from 9e34ccf57cfc97c3cac6d7f9ceecd6e1cc89e10d (commit)
- Log ----------------------------------------------------------------- commit 66158f66c291b0ad1e627205d9381beeed061ded Author: Piotr Przybylski piotrprz@gmail.com Date: Wed Jul 6 17:46:18 2011 +0200
Move DefaultFunctions back to config.default.php
commit 511cf978f6a910a3d7376884d42d1c502298aeba Author: Piotr Przybylski piotrprz@gmail.com Date: Wed Jul 6 17:35:22 2011 +0200
Infer $cfg['Functions'] from $cfg['RestrictFunctions']
commit 866d1da95a853cd35920253e53432c4f55ad61bf Author: Piotr Przybylski piotrprz@gmail.com Date: Wed Jul 6 17:11:04 2011 +0200
Move ColumnTypes, AttributeTypes, Functions, RestrictColumnTypes, RestrictFunctions and DefaultFunctions to a separate file
commit 87a539aea7240e7563e47927f10000368a921e90 Author: Piotr Przybylski piotrprz@gmail.com Date: Wed Jul 6 17:00:33 2011 +0200
Remove *Operators configuration variables
commit c9df5b273323d9e8af0f86d7ce72e0e6d1728b0d Author: Piotr Przybylski piotrprz@gmail.com Date: Wed Jul 6 16:33:27 2011 +0200
Removed unused variables
-----------------------------------------------------------------------
Summary of changes: Documentation.html | 17 -- db_routines.php | 1 + libraries/common.lib.php | 6 +- libraries/config.default.php | 447 ++------------------------------------ libraries/data_mysql.inc.php | 276 +++++++++++++++++++++++ libraries/tbl_properties.inc.php | 3 + tbl_change.php | 3 + tbl_select.php | 74 +++++-- 8 files changed, 356 insertions(+), 471 deletions(-) create mode 100644 libraries/data_mysql.inc.php
diff --git a/Documentation.html b/Documentation.html index 29054a2..0b3bd92 100644 --- a/Documentation.html +++ b/Documentation.html @@ -2392,23 +2392,6 @@ setfacl -d -m "g:www-data:rwx" tmp <code>first_timestamp</code>, which is used for first timestamp column in table.</dd>
- <dt id="cfg_NumOperators">$cfg['NumOperators'] array</dt> - <dd>Operators available for search operations on numeric and date columns. - </dd> - - <dt id="cfg_TextOperators">$cfg['TextOperators'] array</dt> - <dd>Operators available for search operations on character columns. - Note that we put <code>LIKE</code> by default instead of - <code>LIKE %...%</code>, to avoid unintended performance problems - in case of huge tables.</dd> - - <dt id="cfg_EnumOperators">$cfg['EnumOperators'] array</dt> - <dd>Operators available for search operations on ENUM columns.</dd> - - <dt id="cfg_NullOperators">$cfg['NullOperators'] array</dt> - <dd>Additional operators available for search operations when the - column can be null.</dd> - </dl>
<!-- TRANSFORMATIONS --> diff --git a/db_routines.php b/db_routines.php index b9417fd..422ec76 100644 --- a/db_routines.php +++ b/db_routines.php @@ -13,6 +13,7 @@ require_once './libraries/common.inc.php'; require_once './libraries/common.lib.php'; require_once './libraries/db_routines.lib.php'; require_once './libraries/mysql_charsets.lib.php'; +require_once './libraries/data_mysql.inc.php';
/** * Include JavaScript libraries diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 61f3102..6d64cb6 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -2872,7 +2872,7 @@ function PMA_getSupportedDatatypes($html = false, $selected = '') foreach ($cfg['ColumnTypes'] as $key => $value) { if (is_array($value)) { $retval .= "<optgroup label='" . htmlspecialchars($key) . "'>"; - foreach ($value as $subkey => $subvalue) { + foreach ($value as $subvalue) { if ($subvalue == $selected) { $retval .= "<option selected='selected'>"; $retval .= $subvalue; @@ -2896,9 +2896,9 @@ function PMA_getSupportedDatatypes($html = false, $selected = '') } } else { $retval = array(); - foreach ($cfg['ColumnTypes'] as $key => $value) { + foreach ($cfg['ColumnTypes'] as $value) { if (is_array($value)) { - foreach ($value as $subkey => $subvalue) { + foreach ($value as $subvalue) { if ($subvalue !== '-') { $retval[] = $subvalue; } diff --git a/libraries/config.default.php b/libraries/config.default.php index 809a48d..d54dc5a 100644 --- a/libraries/config.default.php +++ b/libraries/config.default.php @@ -2740,379 +2740,50 @@ $cfg['DBG']['sql'] = false; */
/** - * Column types; - * VARCHAR, TINYINT, TEXT and DATE are listed first, based on estimated popularity + * Column types + * + * Fill in this array to overwrite data from data_*.inc.php files * * @global array $cfg['ColumnTypes'] */ -$cfg['ColumnTypes'] = array( - // most used - 'INT', - 'VARCHAR', - 'TEXT', - 'DATE', - - // numeric - 'NUMERIC' => array( - 'TINYINT', - 'SMALLINT', - 'MEDIUMINT', - 'INT', - 'BIGINT', - '-', - 'DECIMAL', - 'FLOAT', - 'DOUBLE', - 'REAL', - '-', - 'BIT', - 'BOOLEAN', - 'SERIAL', - ), - - - // Date/Time - 'DATE and TIME' => array( - 'DATE', - 'DATETIME', - 'TIMESTAMP', - 'TIME', - 'YEAR', - ), - - // Text - 'STRING' => array( - 'CHAR', - 'VARCHAR', - '-', - 'TINYTEXT', - 'TEXT', - 'MEDIUMTEXT', - 'LONGTEXT', - '-', - 'BINARY', - 'VARBINARY', - '-', - 'TINYBLOB', - 'MEDIUMBLOB', - 'BLOB', - 'LONGBLOB', - '-', - 'ENUM', - 'SET', - ), - - 'SPATIAL' => array( - 'GEOMETRY', - 'POINT', - 'LINESTRING', - 'POLYGON', - 'MULTIPOINT', - 'MULTILINESTRING', - 'MULTIPOLYGON', - 'GEOMETRYCOLLECTION', - ), -); +$cfg['ColumnTypes'] = array();
/** * Attributes * + * Fill in this array to overwrite data from data_*.inc.php files + * * @global array $cfg['AttributeTypes'] */ -$cfg['AttributeTypes'] = array( - '', - 'BINARY', - 'UNSIGNED', - 'UNSIGNED ZEROFILL', - 'on update CURRENT_TIMESTAMP', -); - +$cfg['AttributeTypes'] = array();
if ($cfg['ShowFunctionFields']) { /** * Available functions * + * Fill in this array to overwrite data from data_*.inc.php files + * * @global array $cfg['Functions'] */ - $cfg['Functions'] = array( - 'ABS', - 'ACOS', - 'ASCII', - 'ASIN', - 'ATAN', - 'BIN', - 'BIT_COUNT', - 'BIT_LENGTH', - 'CEILING', - 'CHAR', - 'CHAR_LENGTH', - 'COMPRESS', - 'CONNECTION_ID', - 'COS', - 'COT', - 'CRC32', - 'CURDATE', - 'CURRENT_USER', - 'CURTIME', - 'DATABASE', - 'DATE', - 'DAYNAME', - 'DAYOFMONTH', - 'DAYOFWEEK', - 'DAYOFYEAR', - 'DEGREES', - 'DES_DECRYPT', - 'DES_ENCRYPT', - 'ENCRYPT', - 'EXP', - 'FLOOR', - 'FROM_DAYS', - 'FROM_UNIXTIME', - 'HEX', - 'HOUR', - 'INET_ATON', - 'INET_NTOA', - 'LAST_DAY', - 'LENGTH', - 'LN', - 'LOAD_FILE', - 'LOG', - 'LOG10', - 'LOG2', - 'LOWER', - 'LTRIM', - 'MD5', - 'MICROSECOND', - 'MINUTE', - 'MONTH', - 'MONTHNAME', - 'NOW', - 'OCT', - 'OLD_PASSWORD', - 'ORD', - 'PASSWORD', - 'PI', - 'QUARTER', - 'QUOTE', - 'RADIANS', - 'RAND', - 'REVERSE', - 'ROUND', - 'RTRIM', - 'SECOND', - 'SEC_TO_TIME', - 'SHA1', - 'SIGN', - 'SIN', - 'SOUNDEX', - 'SPACE', - 'SQRT', - 'SYSDATE', - 'TAN', - 'TIME', - 'TIMESTAMP', - 'TIME_TO_SEC', - 'TO_DAYS', - 'TRIM', - 'UNCOMPRESS', - 'UNCOMPRESSED_LENGTH', - 'UNHEX', - 'UNIX_TIMESTAMP', - 'UPPER', - 'USER', - 'UTC_DATE', - 'UTC_TIME', - 'UTC_TIMESTAMP', - 'UUID', - 'VERSION', - 'WEEK', - 'WEEKDAY', - 'WEEKOFYEAR', - 'YEAR', - 'YEARWEEK', - ); + $cfg['Functions'] = array();
/** * Which column types will be mapped to which Group? * + * Fill in this array to overwrite data from data_*.inc.php files + * * @global array $cfg['RestrictColumnTypes'] */ - $cfg['RestrictColumnTypes'] = array( - 'TINYINT' => 'FUNC_NUMBER', - 'SMALLINT' => 'FUNC_NUMBER', - 'MEDIUMINT' => 'FUNC_NUMBER', - 'INT' => 'FUNC_NUMBER', - 'BIGINT' => 'FUNC_NUMBER', - 'DECIMAL' => 'FUNC_NUMBER', - 'FLOAT' => 'FUNC_NUMBER', - 'DOUBLE' => 'FUNC_NUMBER', - 'REAL' => 'FUNC_NUMBER', - 'BIT' => 'FUNC_NUMBER', - 'BOOLEAN' => 'FUNC_NUMBER', - 'SERIAL' => 'FUNC_NUMBER', - - 'DATE' => 'FUNC_DATE', - 'DATETIME' => 'FUNC_DATE', - 'TIMESTAMP' => 'FUNC_DATE', - 'TIME' => 'FUNC_DATE', - 'YEAR' => 'FUNC_DATE', - - 'CHAR' => 'FUNC_CHAR', - 'VARCHAR' => 'FUNC_CHAR', - 'TINYTEXT' => 'FUNC_CHAR', - 'TEXT' => 'FUNC_CHAR', - 'MEDIUMTEXT' => 'FUNC_CHAR', - 'LONGTEXT' => 'FUNC_CHAR', - 'BINARY' => 'FUNC_CHAR', - 'VARBINARY' => 'FUNC_CHAR', - 'TINYBLOB' => 'FUNC_CHAR', - 'MEDIUMBLOB' => 'FUNC_CHAR', - 'BLOB' => 'FUNC_CHAR', - 'LONGBLOB' => 'FUNC_CHAR', - 'ENUM' => '', - 'SET' => '', - - 'GEOMETRY' => 'FUNC_SPATIAL', - 'POINT' => 'FUNC_SPATIAL', - 'LINESTRING' => 'FUNC_SPATIAL', - 'POLYGON' => 'FUNC_SPATIAL', - 'MULTIPOINT' => 'FUNC_SPATIAL', - 'MULTILINESTRING' => 'FUNC_SPATIAL', - 'MULTIPOLYGON' => 'FUNC_SPATIAL', - 'GEOMETRYCOLLECTION' => 'FUNC_SPATIAL', - - ); + $cfg['RestrictColumnTypes'] = array();
/** * Map above defined groups to any function * + * Fill in this array to overwrite data from data_*.inc.php files + * * @global array $cfg['RestrictFunctions'] */ - $cfg['RestrictFunctions'] = array( - 'FUNC_CHAR' => array( - 'BIN', - 'CHAR', - 'CURRENT_USER', - 'COMPRESS', - 'DATABASE', - 'DAYNAME', - 'DES_DECRYPT', - 'DES_ENCRYPT', - 'ENCRYPT', - 'HEX', - 'INET_NTOA', - 'LOAD_FILE', - 'LOWER', - 'LTRIM', - 'MD5', - 'MONTHNAME', - 'OLD_PASSWORD', - 'PASSWORD', - 'QUOTE', - 'REVERSE', - 'RTRIM', - 'SHA1', - 'SOUNDEX', - 'SPACE', - 'TRIM', - 'UNCOMPRESS', - 'UNHEX', - 'UPPER', - 'USER', - 'UUID', - ), - - 'FUNC_DATE' => array( - 'CURDATE', - 'CURTIME', - 'DATE', - 'FROM_DAYS', - 'FROM_UNIXTIME', - 'LAST_DAY', - 'NOW', - 'SEC_TO_TIME', - 'SYSDATE', - 'TIME', - 'TIMESTAMP', - 'UTC_DATE', - 'UTC_TIME', - 'UTC_TIMESTAMP', - 'YEAR', - ), - - 'FUNC_NUMBER' => array( - 'ABS', - 'ACOS', - 'ASCII', - 'ASIN', - 'ATAN', - 'BIT_LENGTH', - 'BIT_COUNT', - 'CEILING', - 'CHAR_LENGTH', - 'CONNECTION_ID', - 'COS', - 'COT', - 'CRC32', - 'DAYOFMONTH', - 'DAYOFWEEK', - 'DAYOFYEAR', - 'DEGREES', - 'EXP', - 'FLOOR', - 'HOUR', - 'INET_ATON', - 'LENGTH', - 'LN', - 'LOG', - 'LOG2', - 'LOG10', - 'MICROSECOND', - 'MINUTE', - 'MONTH', - 'OCT', - 'ORD', - 'PI', - 'QUARTER', - 'RADIANS', - 'RAND', - 'ROUND', - 'SECOND', - 'SIGN', - 'SIN', - 'SQRT', - 'TAN', - 'TO_DAYS', - 'TIME_TO_SEC', - 'UNCOMPRESSED_LENGTH', - 'UNIX_TIMESTAMP', - 'WEEK', - 'WEEKDAY', - 'WEEKOFYEAR', - 'YEARWEEK', - ), - - 'FUNC_SPATIAL' => array( - 'GeomFromText', - 'GeomFromWKB', - - 'GeomCollFromText', - 'LineFromText', - 'MLineFromText', - 'PointFromText', - 'MPointFromText', - 'PolyFromText', - 'MPolyFromText', - - 'GeomCollFromWKB', - 'LineFromWKB', - 'MLineFromWKB', - 'PointFromWKB', - 'MPointFromWKB', - 'PolyFromWKB', - 'MPolyFromWKB', - ), - ); + $cfg['RestrictFunctions'] = array();
/** * Default functions for above defined groups @@ -3126,90 +2797,6 @@ if ($cfg['ShowFunctionFields']) { 'first_timestamp' => 'NOW', 'pk_char36' => 'UUID', ); -} // end if - -/** - * Search operators - * - * @global array $cfg['NumOperators'] - */ -$cfg['NumOperators'] = array( - '=', - '>', - '>=', - '<', - '<=', - '!=', - 'LIKE', - 'NOT LIKE', - 'IN (...)', - 'NOT IN (...)', - 'BETWEEN', - 'NOT BETWEEN', -); - -/** - * Search operators - * - * @global array $cfg['TextOperators'] - */ -$cfg['TextOperators'] = array( - 'LIKE', - 'LIKE %...%', - 'NOT LIKE', - '=', - '!=', - 'REGEXP', - 'REGEXP ^...$', - 'NOT REGEXP', - "= ''", - "!= ''", - 'IN (...)', - 'NOT IN (...)', - 'BETWEEN', - 'NOT BETWEEN', -); - -/** - * Search operators - * - * @global array $cfg['EnumOperators'] - */ -$cfg['EnumOperators'] = array( - '=', - '!=', -); - -/** - * Search operators - * - * @global array $cfg['SetOperators'] - */ -$cfg['SetOperators'] = array( - 'IN', - 'NOT IN', -); - -/** - * Search operators - * - * @global array $cfg['NullOperators'] - */ -$cfg['NullOperators'] = array( - 'IS NULL', - 'IS NOT NULL', -); - -/** - * Search operators - * - * @global array $cfg['UnaryOperators'] - */ -$cfg['UnaryOperators'] = array( - 'IS NULL' => 1, - 'IS NOT NULL' => 1, - "= ''" => 1, - "!= ''" => 1 -); +}
?> diff --git a/libraries/data_mysql.inc.php b/libraries/data_mysql.inc.php new file mode 100644 index 0000000..e457d57 --- /dev/null +++ b/libraries/data_mysql.inc.php @@ -0,0 +1,276 @@ +<?php +/** + * Column types and functions supported by MySQL + * + * @package phpMyAdmin + */ + +// VARCHAR, TINYINT, TEXT and DATE are listed first, based on estimated popularity +$cfg['ColumnTypes'] = !empty($cfg['ColumnTypes']) ? $cfg['ColumnTypes'] : array( + // most used + 'INT', + 'VARCHAR', + 'TEXT', + 'DATE', + + // numeric + 'NUMERIC' => array( + 'TINYINT', + 'SMALLINT', + 'MEDIUMINT', + 'INT', + 'BIGINT', + '-', + 'DECIMAL', + 'FLOAT', + 'DOUBLE', + 'REAL', + '-', + 'BIT', + 'BOOLEAN', + 'SERIAL', + ), + + + // Date/Time + 'DATE and TIME' => array( + 'DATE', + 'DATETIME', + 'TIMESTAMP', + 'TIME', + 'YEAR', + ), + + // Text + 'STRING' => array( + 'CHAR', + 'VARCHAR', + '-', + 'TINYTEXT', + 'TEXT', + 'MEDIUMTEXT', + 'LONGTEXT', + '-', + 'BINARY', + 'VARBINARY', + '-', + 'TINYBLOB', + 'MEDIUMBLOB', + 'BLOB', + 'LONGBLOB', + '-', + 'ENUM', + 'SET', + ), + + 'SPATIAL' => array( + 'GEOMETRY', + 'POINT', + 'LINESTRING', + 'POLYGON', + 'MULTIPOINT', + 'MULTILINESTRING', + 'MULTIPOLYGON', + 'GEOMETRYCOLLECTION', + ), +); + +$cfg['AttributeTypes'] = !empty($cfg['AttributeTypes']) ? $cfg['AttributeTypes'] : array( + '', + 'BINARY', + 'UNSIGNED', + 'UNSIGNED ZEROFILL', + 'on update CURRENT_TIMESTAMP', +); + +if ($cfg['ShowFunctionFields']) { + $cfg['RestrictColumnTypes'] = !empty($cfg['RestrictColumnTypes']) ? $cfg['RestrictColumnTypes'] : array( + 'TINYINT' => 'FUNC_NUMBER', + 'SMALLINT' => 'FUNC_NUMBER', + 'MEDIUMINT' => 'FUNC_NUMBER', + 'INT' => 'FUNC_NUMBER', + 'BIGINT' => 'FUNC_NUMBER', + 'DECIMAL' => 'FUNC_NUMBER', + 'FLOAT' => 'FUNC_NUMBER', + 'DOUBLE' => 'FUNC_NUMBER', + 'REAL' => 'FUNC_NUMBER', + 'BIT' => 'FUNC_NUMBER', + 'BOOLEAN' => 'FUNC_NUMBER', + 'SERIAL' => 'FUNC_NUMBER', + + 'DATE' => 'FUNC_DATE', + 'DATETIME' => 'FUNC_DATE', + 'TIMESTAMP' => 'FUNC_DATE', + 'TIME' => 'FUNC_DATE', + 'YEAR' => 'FUNC_DATE', + + 'CHAR' => 'FUNC_CHAR', + 'VARCHAR' => 'FUNC_CHAR', + 'TINYTEXT' => 'FUNC_CHAR', + 'TEXT' => 'FUNC_CHAR', + 'MEDIUMTEXT' => 'FUNC_CHAR', + 'LONGTEXT' => 'FUNC_CHAR', + 'BINARY' => 'FUNC_CHAR', + 'VARBINARY' => 'FUNC_CHAR', + 'TINYBLOB' => 'FUNC_CHAR', + 'MEDIUMBLOB' => 'FUNC_CHAR', + 'BLOB' => 'FUNC_CHAR', + 'LONGBLOB' => 'FUNC_CHAR', + 'ENUM' => '', + 'SET' => '', + + 'GEOMETRY' => 'FUNC_SPATIAL', + 'POINT' => 'FUNC_SPATIAL', + 'LINESTRING' => 'FUNC_SPATIAL', + 'POLYGON' => 'FUNC_SPATIAL', + 'MULTIPOINT' => 'FUNC_SPATIAL', + 'MULTILINESTRING' => 'FUNC_SPATIAL', + 'MULTIPOLYGON' => 'FUNC_SPATIAL', + 'GEOMETRYCOLLECTION' => 'FUNC_SPATIAL', + + ); + + $restrict_functions = array( + 'FUNC_CHAR' => array( + 'BIN', + 'CHAR', + 'CURRENT_USER', + 'COMPRESS', + 'DATABASE', + 'DAYNAME', + 'DES_DECRYPT', + 'DES_ENCRYPT', + 'ENCRYPT', + 'HEX', + 'INET_NTOA', + 'LOAD_FILE', + 'LOWER', + 'LTRIM', + 'MD5', + 'MONTHNAME', + 'OLD_PASSWORD', + 'PASSWORD', + 'QUOTE', + 'REVERSE', + 'RTRIM', + 'SHA1', + 'SOUNDEX', + 'SPACE', + 'TRIM', + 'UNCOMPRESS', + 'UNHEX', + 'UPPER', + 'USER', + 'UUID', + 'VERSION', + ), + + 'FUNC_DATE' => array( + 'CURDATE', + 'CURTIME', + 'DATE', + 'FROM_DAYS', + 'FROM_UNIXTIME', + 'LAST_DAY', + 'NOW', + 'SEC_TO_TIME', + 'SYSDATE', + 'TIME', + 'TIMESTAMP', + 'UTC_DATE', + 'UTC_TIME', + 'UTC_TIMESTAMP', + 'YEAR', + ), + + 'FUNC_NUMBER' => array( + 'ABS', + 'ACOS', + 'ASCII', + 'ASIN', + 'ATAN', + 'BIT_LENGTH', + 'BIT_COUNT', + 'CEILING', + 'CHAR_LENGTH', + 'CONNECTION_ID', + 'COS', + 'COT', + 'CRC32', + 'DAYOFMONTH', + 'DAYOFWEEK', + 'DAYOFYEAR', + 'DEGREES', + 'EXP', + 'FLOOR', + 'HOUR', + 'INET_ATON', + 'LENGTH', + 'LN', + 'LOG', + 'LOG2', + 'LOG10', + 'MICROSECOND', + 'MINUTE', + 'MONTH', + 'OCT', + 'ORD', + 'PI', + 'QUARTER', + 'RADIANS', + 'RAND', + 'ROUND', + 'SECOND', + 'SIGN', + 'SIN', + 'SQRT', + 'TAN', + 'TO_DAYS', + 'TIME_TO_SEC', + 'UNCOMPRESSED_LENGTH', + 'UNIX_TIMESTAMP', + 'WEEK', + 'WEEKDAY', + 'WEEKOFYEAR', + 'YEARWEEK', + ), + + 'FUNC_SPATIAL' => array( + 'GeomFromText', + 'GeomFromWKB', + + 'GeomCollFromText', + 'LineFromText', + 'MLineFromText', + 'PointFromText', + 'MPointFromText', + 'PolyFromText', + 'MPolyFromText', + + 'GeomCollFromWKB', + 'LineFromWKB', + 'MLineFromWKB', + 'PointFromWKB', + 'MPointFromWKB', + 'PolyFromWKB', + 'MPolyFromWKB', + ), + ); + if (empty($cfg['RestrictFunctions'])) { + $cfg['RestrictFunctions'] = $restrict_functions; + } + + if (empty($cfg['Functions'])) { + // build a list of functions based on $restrict_functions + $cfg['Functions'] = array(); + foreach ($restrict_functions as $cat => $functions) { + if ($cat != 'FUNC_SPATIAL') { + $cfg['Functions'] = array_merge($cfg['Functions'], $functions); + } + } + sort($cfg['Functions']); + } + unset($restrict_functions); +} // end if + +?> \ No newline at end of file diff --git a/libraries/tbl_properties.inc.php b/libraries/tbl_properties.inc.php index 4cfd48a..f4ade94 100644 --- a/libraries/tbl_properties.inc.php +++ b/libraries/tbl_properties.inc.php @@ -27,6 +27,9 @@ require_once './libraries/StorageEngine.class.php'; */ require_once './libraries/Partition.class.php';
+// load additional configuration variables +require_once './libraries/data_mysql.inc.php'; + if (is_int($cfg['DefaultPropDisplay'])) { if ($num_fields <= $cfg['DefaultPropDisplay']) { $display_type = 'vertical'; diff --git a/tbl_change.php b/tbl_change.php index 94c7da0..7d5bba3 100644 --- a/tbl_change.php +++ b/tbl_change.php @@ -19,6 +19,9 @@ require_once './libraries/common.lib.php'; */ require_once './libraries/db_table_exists.lib.php';
+// load additional configuration variables +require_once './libraries/data_mysql.inc.php'; + /** * Sets global variables. * Here it's better to use a if, instead of the '?' operator diff --git a/tbl_select.php b/tbl_select.php index 33b7e48..52e8b93 100644 --- a/tbl_select.php +++ b/tbl_select.php @@ -129,31 +129,57 @@ if (! isset($param) || $param[0] == '') { <td><?php echo $fields_collation[$i]; ?></td> <td><select name="func[]"> <?php + // determine valid operators if (strncasecmp($fields_type[$i], 'enum', 4) == 0) { - foreach ($GLOBALS['cfg']['EnumOperators'] as $fc) { - echo "\n" . ' ' - . '<option value="' . htmlspecialchars($fc) . '">' - . htmlspecialchars($fc) . '</option>'; - } + // enum operators + $operators = array( + '=', + '!=', + ); } elseif (preg_match('@char|blob|text|set@i', $fields_type[$i])) { - foreach ($GLOBALS['cfg']['TextOperators'] as $fc) { - echo "\n" . ' ' - . '<option value="' . htmlspecialchars($fc) . '">' - . htmlspecialchars($fc) . '</option>'; - } + // text operators + $operators = array( + 'LIKE', + 'LIKE %...%', + 'NOT LIKE', + '=', + '!=', + 'REGEXP', + 'REGEXP ^...$', + 'NOT REGEXP', + "= ''", + "!= ''", + 'IN (...)', + 'NOT IN (...)', + 'BETWEEN', + 'NOT BETWEEN', + ); } else { - foreach ($GLOBALS['cfg']['NumOperators'] as $fc) { - echo "\n" . ' ' - . '<option value="' . htmlspecialchars($fc) . '">' - . htmlspecialchars($fc) . '</option>'; - } + // numeric operators + $operators = array( + '=', + '>', + '>=', + '<', + '<=', + '!=', + 'LIKE', + 'NOT LIKE', + 'IN (...)', + 'NOT IN (...)', + 'BETWEEN', + 'NOT BETWEEN', + ); } // end if... else... + + // if field can be NULL, add IS NULL and IS NOT NULL if ($fields_null[$i]) { - foreach ($GLOBALS['cfg']['NullOperators'] as $fc) { - echo "\n" . ' ' - . '<option value="' . htmlspecialchars($fc) . '">' - . htmlspecialchars($fc) . '</option>'; - } + $operators[] = 'IS NULL'; + $operators[] = 'IS NOT NULL'; + } + foreach ($operators as $op) { + echo "\n" . ' ' + . '<option value="' . htmlspecialchars($op) . '">' . htmlspecialchars($op) . '</option>'; } ?>
@@ -327,11 +353,17 @@ else { $sql_query .= ' WHERE ' . $where; } else { $w = $charsets = array(); + $unary_operators = array( + 'IS NULL' => 1, + 'IS NOT NULL' => 1, + "= ''" => 1, + "!= ''" => 1 + ); $cnt_func = count($func); reset($func); while (list($i, $func_type) = each($func)) { list($charsets[$i]) = explode('_', $collations[$i]); - if (isset($GLOBALS['cfg']['UnaryOperators'][$func_type]) && $GLOBALS['cfg']['UnaryOperators'][$func_type] == 1) { + if (isset($unary_operators[$func_type])) { $fields[$i] = ''; $w[] = PMA_backquote($names[$i]) . ' ' . $func_type;
hooks/post-receive