From 58d880b6ab60d895440d8f3f027ed6f9b4a0909c Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sun, 15 Nov 2009 13:50:32 +0000 Subject: [PATCH] bug #2897536 [parser] Copying table with bit field with default --- ChangeLog | 1 + libraries/sqlparser.lib.php | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 48cb769901..4648c5c64c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -57,6 +57,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA + [lang] Russian update, thanks to Victor Volkov - bug #2823599 [edit] UUID Primary Key wrongly updated - bug #2895894 [structure] Empty default value not set properly +- bug #2897536 [parser] Copying table with bit field with default 3.2.3.0 (2009-10-30) - patch #2856664 [export] Date, time, and datetime column types now export correctly to diff --git a/libraries/sqlparser.lib.php b/libraries/sqlparser.lib.php index 581062aac2..0974741962 100644 --- a/libraries/sqlparser.lib.php +++ b/libraries/sqlparser.lib.php @@ -676,7 +676,10 @@ if (! defined('PMA_MINIMUM_COMMON')) { if ($t_cur == 'alpha') { $t_suffix = '_identifier'; - if (($t_next == 'punct_qualifier') || ($t_prev == 'punct_qualifier')) { + // for example: `thebit` bit(8) NOT NULL DEFAULT b'0' + if ($t_prev == 'alpha' && $d_prev == 'DEFAULT' && $d_cur == 'b' && $t_next == 'quote_single') { + $t_suffix = '_bitfield_constant_introducer'; + } elseif (($t_next == 'punct_qualifier') || ($t_prev == 'punct_qualifier')) { $t_suffix = '_identifier'; } elseif (($t_next == 'punct_bracket_open_round') && PMA_STR_binarySearchInArr($d_cur_upper, $PMA_SQPdata_function_name, $PMA_SQPdata_function_name_cnt)) { @@ -2183,6 +2186,10 @@ if (! defined('PMA_MINIMUM_COMMON')) { } switch ($typearr[2]) { + case 'alpha_bitfield_constant_introducer': + $before = ' '; + $after = ''; + break; case 'white_newline': $before = ''; break; @@ -2417,7 +2424,7 @@ if (! defined('PMA_MINIMUM_COMMON')) { // the @ is incorrectly marked as alpha_variable // in the parser, and here, the '%' gets a blank before, // which is a syntax error - if ($typearr[1] != 'punct_user') { + if ($typearr[1] != 'punct_user' && $typearr[1] != 'alpha_bitfield_constant_introducer') { $before .= ' '; } if ($infunction && $typearr[3] == 'punct_bracket_close_round') { -- 2.11.4.GIT