Support for CHARACTER SET syntaxes

This commit is contained in:
Alexander M. Turek
2003-05-30 19:55:41 +00:00
parent 101677e2c1
commit cf0b2ac6b3
3 changed files with 255 additions and 233 deletions

View File

@@ -19,7 +19,7 @@ $Source$
- RFE #623665 (MySQL 4.1 support): - RFE #623665 (MySQL 4.1 support):
- Fixed display of field charsets; - Fixed display of field charsets;
- The table charset is now displayed. - The table charset is now displayed.
* libraries/sqlparser.data.php3: Added CHARSET. * libraries/sqlparser.data.php3: Added CHARSET, SQL_CACHE, SQL_NO_CACHE.
* tbl_change.php3: binary fields with CHARACTER SET definition were treated * tbl_change.php3: binary fields with CHARACTER SET definition were treated
as SET fields (again RFE #623665). as SET fields (again RFE #623665).
* Documentation.html: * Documentation.html:
@@ -28,6 +28,8 @@ $Source$
- php 5.0.0-dev should work fine with phpMyAdmin - it has been doing so at - php 5.0.0-dev should work fine with phpMyAdmin - it has been doing so at
least on my test machines for a couple of months. least on my test machines for a couple of months.
* scripts/create-tables.sql: Added some notes about lower_case_table_names. * scripts/create-tables.sql: Added some notes about lower_case_table_names.
* libraries/sqlparser.lib.php3: Parser treated "CHARACTER" as column type,
even if it was used in "CHARACTER SET".
2003-05-29 Michal Cihar <nijel@users.sourceforge.net> 2003-05-29 Michal Cihar <nijel@users.sourceforge.net>
* lang/czech: Updated. * lang/czech: Updated.

View File

@@ -402,11 +402,13 @@ if (!defined('PMA_SQP_DATA_INCLUDED')) {
'SQL_BIG_SELECTS', 'SQL_BIG_SELECTS',
'SQL_BIG_TABLES', 'SQL_BIG_TABLES',
'SQL_BUFFER_RESULT', 'SQL_BUFFER_RESULT',
'SQL_CACHE',
'SQL_LOG_BIN', 'SQL_LOG_BIN',
'SQL_LOG_OFF', 'SQL_LOG_OFF',
'SQL_LOG_UPDATE', 'SQL_LOG_UPDATE',
'SQL_LOW_PRIORITY_UPDATES', 'SQL_LOW_PRIORITY_UPDATES',
'SQL_MAX_JOIN_SIZE', 'SQL_MAX_JOIN_SIZE',
'SQL_NO_CACHE',
'SQL_QUOTE_SHOW_CREATE', 'SQL_QUOTE_SHOW_CREATE',
'SQL_SAFE_UPDATES', 'SQL_SAFE_UPDATES',
'SQL_SELECT_LIMIT', 'SQL_SELECT_LIMIT',

View File

@@ -548,19 +548,32 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
$t_next = $sql_array[0]['type']; $t_next = $sql_array[0]['type'];
$t_prev = ''; $t_prev = '';
$t_cur = ''; $t_cur = '';
$d_next = $sql_array[0]['data'];
$d_prev = '';
$d_cur = '';
$d_next_upper = $t_next == 'alpha' ? strtoupper($d_next) : $d_next;
$d_prev_upper = '';
$d_cur_upper = '';
} }
for ($i = 0; $i < $arraysize; $i++) { for ($i = 0; $i < $arraysize; $i++) {
$t_prev = $t_cur; $t_prev = $t_cur;
$t_cur = $t_next; $t_cur = $t_next;
$d_prev = $d_cur;
$d_cur = $d_next;
$d_prev_upper = $d_cur_upper;
$d_cur_upper = $d_next_upper;
if (($i + 1) < $arraysize) { if (($i + 1) < $arraysize) {
$t_next = $sql_array[$i + 1]['type']; $t_next = $sql_array[$i + 1]['type'];
$d_next = $sql_array[$i + 1]['data'];
$d_next_upper = $t_next == 'alpha' ? strtoupper($d_next) : $d_next;
} else { } else {
$t_next = ''; $t_next = '';
$d_next = '';
$d_next_upper = '';
} }
if ($t_cur == 'alpha') { if ($t_cur == 'alpha') {
$t_suffix = '_identifier'; $t_suffix = '_identifier';
$d_cur_upper = strtoupper($sql_array[$i]['data']);
if (($t_next == 'punct_qualifier') || ($t_prev == 'punct_qualifier')) { if (($t_next == 'punct_qualifier') || ($t_prev == 'punct_qualifier')) {
$t_suffix = '_identifier'; $t_suffix = '_identifier';
} else if (($t_next == 'punct_bracket_open_round') } else if (($t_next == 'punct_bracket_open_round')
@@ -574,6 +587,11 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
$t_suffix = '_reservedWord'; $t_suffix = '_reservedWord';
} }
//END OF TEMPORARY FIX //END OF TEMPORARY FIX
// CHARACTER is a synonym for CHAR, but can also be meant as
// CHARACTER SET. In this case, we have a reserved word.
if ($d_cur_upper == 'CHARACTER' && $d_next_upper == 'SET') {
$t_suffix = '_reservedWord';
}
} else if (PMA_STR_binarySearchInArr($d_cur_upper, $PMA_SQPdata_reserved_word, $PMA_SQPdata_reserved_word_cnt)) { } else if (PMA_STR_binarySearchInArr($d_cur_upper, $PMA_SQPdata_reserved_word, $PMA_SQPdata_reserved_word_cnt)) {
$t_suffix = '_reservedWord'; $t_suffix = '_reservedWord';
} else if (PMA_STR_binarySearchInArr($d_cur_upper, $PMA_SQPdata_column_attrib, $PMA_SQPdata_column_attrib_cnt)) { } else if (PMA_STR_binarySearchInArr($d_cur_upper, $PMA_SQPdata_column_attrib, $PMA_SQPdata_column_attrib_cnt)) {