Merge remote-tracking branch 'origin/master'

This commit is contained in:
Pootle server 2011-06-06 00:40:07 +02:00
commit 75f2a2315c
5 changed files with 16 additions and 55 deletions

View File

@ -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;
}
}

View File

@ -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);
}

View File

@ -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;
?>

View File

@ -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;

View File

@ -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) {