Commit 4cb99ed5 authored by bar@bar.mysql.r18.ru's avatar bar@bar.mysql.r18.ru

Bug fix:

http://bugs.mysql.com/bug.php?id=1129
From:	Georg Richter
Description: there is a problem with special chars like umlauts in comments 
parent 03327fd4
......@@ -16,16 +16,16 @@ EFF0EEE1E0
DROP TABLE t1;
CREATE TABLE
(
CHAR(32) CHARACTER SET koi8r NOT NULL
);
CHAR(32) CHARACTER SET koi8r NOT NULL COMMENT " "
) COMMENT " ";
SHOW TABLES;
Tables_in_test
SHOW CREATE TABLE ;
Table Create Table
CREATE TABLE `` (
`` char(32) character set koi8r NOT NULL default ''
) TYPE=MyISAM CHARSET=latin1
`` char(32) character set koi8r NOT NULL default '' COMMENT ' '
) TYPE=MyISAM CHARSET=latin1 COMMENT=' '
SHOW FIELDS FROM ;
Field Type Null Key Default Extra
char(32)
......@@ -36,8 +36,8 @@ Tables_in_test
SHOW CREATE TABLE ;
Table Create Table
CREATE TABLE `` (
`` char(32) character set koi8r NOT NULL default ''
) TYPE=MyISAM CHARSET=latin1
`` char(32) character set koi8r NOT NULL default '' COMMENT ' '
) TYPE=MyISAM CHARSET=latin1 COMMENT=' '
SHOW FIELDS FROM ;
Field Type Null Key Default Extra
char(32)
......@@ -48,8 +48,8 @@ Tables_in_test
SHOW CREATE TABLE таблица;
Table Create Table
таблица CREATE TABLE `таблица` (
`поле` char(32) character set koi8r NOT NULL default ''
) TYPE=MyISAM CHARSET=latin1
`поле` char(32) character set koi8r NOT NULL default '' COMMENT 'комментарий поля'
) TYPE=MyISAM CHARSET=latin1 COMMENT='комментарий таблицы'
SHOW FIELDS FROM таблица;
Field Type Null Key Default Extra
поле char(32)
......
......@@ -13,8 +13,8 @@ DROP TABLE t1;
CREATE TABLE
(
CHAR(32) CHARACTER SET koi8r NOT NULL
);
CHAR(32) CHARACTER SET koi8r NOT NULL COMMENT " "
) COMMENT " ";
SHOW TABLES;
SHOW CREATE TABLE ;
......
......@@ -598,7 +598,8 @@ void set_item_name(Item *item,char *pos,uint length);
bool add_field_to_list(THD *thd, char *field_name, enum enum_field_types type,
char *length, char *decimal,
uint type_modifier,
Item *default_value, Item *comment,
Item *default_value,
LEX_STRING *comment,
char *change, TYPELIB *interval,CHARSET_INFO *cs,
uint uint_geom_type);
void store_position_for_column(const char *name);
......
......@@ -489,7 +489,8 @@ typedef struct st_lex
String *wild;
sql_exchange *exchange;
select_result *result;
Item *default_value, *comment;
Item *default_value;
LEX_STRING *comment;
LEX_USER *grant_user;
gptr yacc_yyss,yacc_yyvs;
THD *thd;
......
......@@ -3709,7 +3709,7 @@ mysql_parse(THD *thd, char *inBuf, uint length)
bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
char *length, char *decimals,
uint type_modifier,
Item *default_value, Item *comment,
Item *default_value, LEX_STRING *comment,
char *change, TYPELIB *interval, CHARSET_INFO *cs,
uint uint_geom_type)
{
......@@ -3783,8 +3783,8 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
else
{
/* In this case comment is always of type Item_string */
new_field->comment.str= (char*) comment->str_value.ptr();
new_field->comment.length=comment->str_value.length();
new_field->comment.str= (char*) comment->str;
new_field->comment.length=comment->length;
}
if (length && !(new_field->length= (uint) atoi(length)))
length=0; /* purecov: inspected */
......
......@@ -1199,7 +1199,8 @@ field_spec:
{
LEX *lex=Lex;
lex->length=lex->dec=0; lex->type=0; lex->interval=0;
lex->default_value=lex->comment=0;
lex->default_value=0;
lex->comment=0;
lex->charset=NULL;
}
type opt_attribute
......@@ -1411,7 +1412,7 @@ attribute:
| opt_primary KEY_SYM { Lex->type|= PRI_KEY_FLAG | NOT_NULL_FLAG; }
| UNIQUE_SYM { Lex->type|= UNIQUE_FLAG; }
| UNIQUE_SYM KEY_SYM { Lex->type|= UNIQUE_KEY_FLAG; }
| COMMENT_SYM text_literal { Lex->comment= $2; }
| COMMENT_SYM TEXT_STRING_sys { Lex->comment= &$2; }
| COLLATE_SYM collation_name
{
if (Lex->charset && !my_charset_same(Lex->charset,$2))
......@@ -1668,7 +1669,8 @@ alter_list_item:
{
LEX *lex=Lex;
lex->length=lex->dec=0; lex->type=0; lex->interval=0;
lex->default_value=lex->comment=0;
lex->default_value=0;
lex->comment=0;
lex->charset= NULL;
lex->simple_alter=0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment