[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_2RC1-2983-g8b47a1d
Piotr Przybylski
crackpl at users.sourceforge.net
Mon Jun 6 00:32:11 CEST 2011
The branch, master has been updated
via 8b47a1dbd4a38fa12abe57f0eb0cbf74f1e433de (commit)
via 610614c95fad9c3e4bebff0ce4900d850471c5f5 (commit)
from 47528c2048d2f8cccb0fbe7477a87960211edcc9 (commit)
- Log -----------------------------------------------------------------
commit 8b47a1dbd4a38fa12abe57f0eb0cbf74f1e433de
Author: Piotr Przybylski <piotrprz at gmail.com>
Date: Mon Jun 6 00:31:52 2011 +0200
Remove $mysql_charsets_count and $mysql_collations_count
commit 610614c95fad9c3e4bebff0ce4900d850471c5f5
Author: Piotr Przybylski <piotrprz at gmail.com>
Date: Mon Jun 6 00:25:52 2011 +0200
Removed global variables with array counts in sqlparser.lib.php
-----------------------------------------------------------------------
Summary of changes:
libraries/common.lib.php | 3 +--
libraries/mysql_charsets.lib.php | 8 +-------
libraries/sqlparser.data.php | 34 +---------------------------------
libraries/sqlparser.lib.php | 24 ++++++++++++------------
server_collations.php | 2 +-
5 files changed, 16 insertions(+), 55 deletions(-)
diff --git a/libraries/common.lib.php b/libraries/common.lib.php
index 77fc3fc..807376f 100644
--- a/libraries/common.lib.php
+++ b/libraries/common.lib.php
@@ -826,9 +826,8 @@ function PMA_backquote($a_name, $do_it = true)
if (! $do_it) {
global $PMA_SQPdata_forbidden_word;
- global $PMA_SQPdata_forbidden_word_cnt;
- if(! PMA_STR_binarySearchInArr(strtoupper($a_name), $PMA_SQPdata_forbidden_word, $PMA_SQPdata_forbidden_word_cnt)) {
+ if(! PMA_STR_binarySearchInArr(strtoupper($a_name), $PMA_SQPdata_forbidden_word, count($PMA_SQPdata_forbidden_word))) {
return $a_name;
}
}
diff --git a/libraries/mysql_charsets.lib.php b/libraries/mysql_charsets.lib.php
index 51b79ba..8d1eb83 100644
--- a/libraries/mysql_charsets.lib.php
+++ b/libraries/mysql_charsets.lib.php
@@ -11,7 +11,7 @@ if (! defined('PHPMYADMIN')) {
/**
*
*/
-if (! PMA_cacheExists('mysql_charsets_count', true)) {
+if (! PMA_cacheExists('mysql_charsets', true)) {
$sql = PMA_DRIZZLE
? 'SELECT * FROM data_dictionary.CHARACTER_SETS'
: 'SELECT * FROM information_schema.CHARACTER_SETS';
@@ -26,7 +26,6 @@ if (! PMA_cacheExists('mysql_charsets_count', true)) {
}
PMA_DBI_free_result($res);
- $mysql_charsets_count = count($mysql_charsets);
sort($mysql_charsets, SORT_STRING);
$mysql_collations = array_flip($mysql_charsets);
@@ -60,7 +59,6 @@ if (! PMA_cacheExists('mysql_charsets_count', true)) {
unset($mysql_collations['utf8_general_ci']);
}
- $mysql_collations_count = count($mysql_collations_flat);
sort($mysql_collations_flat, SORT_STRING);
foreach ($mysql_collations AS $key => $value) {
sort($mysql_collations[$key], SORT_STRING);
@@ -70,22 +68,18 @@ if (! PMA_cacheExists('mysql_charsets_count', true)) {
PMA_cacheSet('mysql_charsets', $GLOBALS['mysql_charsets'], true);
PMA_cacheSet('mysql_charsets_descriptions', $GLOBALS['mysql_charsets_descriptions'], true);
- PMA_cacheSet('mysql_charsets_count', $GLOBALS['mysql_charsets_count'], true);
PMA_cacheSet('mysql_charsets_available', $GLOBALS['mysql_charsets_available'], true);
PMA_cacheSet('mysql_collations', $GLOBALS['mysql_collations'], true);
PMA_cacheSet('mysql_default_collations', $GLOBALS['mysql_default_collations'], true);
PMA_cacheSet('mysql_collations_flat', $GLOBALS['mysql_collations_flat'], true);
- PMA_cacheSet('mysql_collations_count', $GLOBALS['mysql_collations_count'], true);
PMA_cacheSet('mysql_collations_available', $GLOBALS['mysql_collations_available'], true);
} else {
$GLOBALS['mysql_charsets'] = PMA_cacheGet('mysql_charsets', true);
$GLOBALS['mysql_charsets_descriptions'] = PMA_cacheGet('mysql_charsets_descriptions', true);
- $GLOBALS['mysql_charsets_count'] = PMA_cacheGet('mysql_charsets_count', true);
$GLOBALS['mysql_charsets_available'] = PMA_cacheGet('mysql_charsets_available', true);
$GLOBALS['mysql_collations'] = PMA_cacheGet('mysql_collations', true);
$GLOBALS['mysql_default_collations'] = PMA_cacheGet('mysql_default_collations', true);
$GLOBALS['mysql_collations_flat'] = PMA_cacheGet('mysql_collations_flat', true);
- $GLOBALS['mysql_collations_count'] = PMA_cacheGet('mysql_collations_count', true);
$GLOBALS['mysql_collations_available'] = PMA_cacheGet('mysql_collations_available', true);
}
diff --git a/libraries/sqlparser.data.php b/libraries/sqlparser.data.php
index c7dacc6..5011ca7 100644
--- a/libraries/sqlparser.data.php
+++ b/libraries/sqlparser.data.php
@@ -12,9 +12,7 @@
* (around 4.0.2) as well as the MySQL documentation.
*
* Note: before adding a value in the arrays, ensure that you respect
- * proper sorting, especially with underscores. And don't forget to
- * update the _cnt variable at the end of each array.
- * (It's slower to have PHP do the count).
+ * proper sorting, especially with underscores.
*
* It's easier to use only uppercase for proper sorting. In case of
* doubt, use the test case to verify.
@@ -332,12 +330,6 @@ $PMA_SQPdata_function_name = array (
'YEAR',
'YEARWEEK'
);
-/**
- * $PMA_SQPdata_function_name_cnt = count($PMA_SQPdata_function_name);
- *
- * @global integer MySQL attributes count
- */
-$PMA_SQPdata_function_name_cnt = 298;
/**
* @global array MySQL attributes
@@ -374,12 +366,6 @@ $PMA_SQPdata_column_attrib = array (
'VARYING',
'ZEROFILL'
);
-/**
- * $PMA_SQPdata_column_attrib_cnt = count($PMA_SQPdata_column_attrib);
- *
- * @global integer MySQL attributes count
- */
-$PMA_SQPdata_column_attrib_cnt = 30;
/**
* words that are reserved by MySQL and may not be used as identifiers without quotes
@@ -679,12 +665,6 @@ $PMA_SQPdata_reserved_word = array (
'XOR',
'YEAR_MONTH'
);
-/**
- * $PMA_SQPdata_reserved_word_cnt = count($PMA_SQPdata_reserved_word);
- *
- * @global integer MySQL reserved words count
- */
-$PMA_SQPdata_reserved_word_cnt = 287;
/**
* words forbidden to be used as column or table name wihtout quotes
@@ -1176,12 +1156,6 @@ $PMA_SQPdata_forbidden_word = array (
'YEAR_MONTH',
'ZEROFILL'
);
-/**
- * count($PMA_SQPdata_forbidden_word);
- *
- * @global integer MySQL forbidden words count
- */
-$PMA_SQPdata_forbidden_word_cnt = 482;
/**
* the MySQL column/data types
@@ -1247,11 +1221,5 @@ $PMA_SQPdata_column_type = array (
'VARCHAR',
'YEAR'
);
-/**
- * $PMA_SQPdata_column_type_cnt = count($PMA_SQPdata_column_type);
- *
- * @global integer MySQL column types count
- */
-$PMA_SQPdata_column_type_cnt = 54;
?>
diff --git a/libraries/sqlparser.lib.php b/libraries/sqlparser.lib.php
index 5000f4c..171a4a3 100644
--- a/libraries/sqlparser.lib.php
+++ b/libraries/sqlparser.lib.php
@@ -48,9 +48,7 @@ if (! defined('PMA_MINIMUM_COMMON')) {
}
if (! isset($mysql_charsets)) {
$mysql_charsets = array();
- $mysql_charsets_count = 0;
$mysql_collations_flat = array();
- $mysql_collations_count = 0;
}
if (!defined('DEBUG_TIMING')) {
@@ -193,23 +191,16 @@ if (! defined('PMA_MINIMUM_COMMON')) {
* @global array MySQL reserved words
* @global array MySQL column types
* @global array MySQL function names
- * @global integer MySQL column attributes count
- * @global integer MySQL reserved words count
- * @global integer MySQL column types count
- * @global integer MySQL function names count
* @global array List of available character sets
* @global array List of available collations
- * @global integer Character sets count
- * @global integer Collations count
*
* @access public
*/
function PMA_SQP_parse($sql)
{
- global $PMA_SQPdata_column_attrib, $PMA_SQPdata_reserved_word, $PMA_SQPdata_column_type, $PMA_SQPdata_function_name,
- $PMA_SQPdata_column_attrib_cnt, $PMA_SQPdata_reserved_word_cnt, $PMA_SQPdata_column_type_cnt, $PMA_SQPdata_function_name_cnt;
- global $mysql_charsets, $mysql_collations_flat, $mysql_charsets_count, $mysql_collations_count;
- global $PMA_SQPdata_forbidden_word, $PMA_SQPdata_forbidden_word_cnt;
+ global $PMA_SQPdata_column_attrib, $PMA_SQPdata_reserved_word, $PMA_SQPdata_column_type;
+ global $PMA_SQPdata_function_name, $PMA_SQPdata_forbidden_word;
+ global $mysql_charsets, $mysql_collations_flat;
// Convert all line feeds to Unix style
$sql = str_replace("\r\n", "\n", $sql);
@@ -220,6 +211,15 @@ if (! defined('PMA_MINIMUM_COMMON')) {
return array();
}
+ // Get counts of some arrays
+ $PMA_SQPdata_column_attrib_cnt = count($PMA_SQPdata_column_attrib);
+ $PMA_SQPdata_function_name_cnt = count($PMA_SQPdata_function_name);
+ $PMA_SQPdata_reserved_word_cnt = count($PMA_SQPdata_reserved_word);
+ $PMA_SQPdata_forbidden_word_cnt = count($PMA_SQPdata_forbidden_word);
+ $PMA_SQPdata_column_type_cnt = count($PMA_SQPdata_column_type);
+ $mysql_charsets_count = count($mysql_charsets);
+ $mysql_collations_count = count($mysql_collations_flat);
+
$sql_array = array();
$sql_array['raw'] = $sql;
$count1 = 0;
diff --git a/server_collations.php b/server_collations.php
index 0adc4d3..44d5157 100644
--- a/server_collations.php
+++ b/server_collations.php
@@ -55,7 +55,7 @@ echo '<div id="div_mysql_charset_collations">' . "\n"
. '</tr>' . "\n";
$i = 0;
-$table_row_count = count($mysql_charsets) + $mysql_collations_count;
+$table_row_count = count($mysql_charsets) + count($mysql_collations);
foreach ($mysql_charsets as $current_charset) {
if ($i >= $table_row_count / 2) {
hooks/post-receive
--
phpMyAdmin
More information about the Git
mailing list