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 ...@@ -16,16 +16,16 @@ EFF0EEE1E0
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE CREATE TABLE
( (
CHAR(32) CHARACTER SET koi8r NOT NULL CHAR(32) CHARACTER SET koi8r NOT NULL COMMENT " "
); ) COMMENT " ";
SHOW TABLES; SHOW TABLES;
Tables_in_test Tables_in_test
SHOW CREATE TABLE ; SHOW CREATE TABLE ;
Table Create Table Table Create Table
CREATE TABLE `` ( CREATE TABLE `` (
`` char(32) character set koi8r NOT NULL default '' `` char(32) character set koi8r NOT NULL default '' COMMENT ' '
) TYPE=MyISAM CHARSET=latin1 ) TYPE=MyISAM CHARSET=latin1 COMMENT=' '
SHOW FIELDS FROM ; SHOW FIELDS FROM ;
Field Type Null Key Default Extra Field Type Null Key Default Extra
char(32) char(32)
...@@ -36,8 +36,8 @@ Tables_in_test ...@@ -36,8 +36,8 @@ Tables_in_test
SHOW CREATE TABLE ; SHOW CREATE TABLE ;
Table Create Table Table Create Table
CREATE TABLE `` ( CREATE TABLE `` (
`` char(32) character set koi8r NOT NULL default '' `` char(32) character set koi8r NOT NULL default '' COMMENT ' '
) TYPE=MyISAM CHARSET=latin1 ) TYPE=MyISAM CHARSET=latin1 COMMENT=' '
SHOW FIELDS FROM ; SHOW FIELDS FROM ;
Field Type Null Key Default Extra Field Type Null Key Default Extra
char(32) char(32)
...@@ -48,8 +48,8 @@ Tables_in_test ...@@ -48,8 +48,8 @@ Tables_in_test
SHOW CREATE TABLE таблица; SHOW CREATE TABLE таблица;
Table Create Table Table Create Table
таблица CREATE TABLE `таблица` ( таблица CREATE TABLE `таблица` (
`поле` char(32) character set koi8r NOT NULL default '' `поле` char(32) character set koi8r NOT NULL default '' COMMENT 'комментарий поля'
) TYPE=MyISAM CHARSET=latin1 ) TYPE=MyISAM CHARSET=latin1 COMMENT='комментарий таблицы'
SHOW FIELDS FROM таблица; SHOW FIELDS FROM таблица;
Field Type Null Key Default Extra Field Type Null Key Default Extra
поле char(32) поле char(32)
......
...@@ -13,8 +13,8 @@ DROP TABLE t1; ...@@ -13,8 +13,8 @@ DROP TABLE t1;
CREATE TABLE CREATE TABLE
( (
CHAR(32) CHARACTER SET koi8r NOT NULL CHAR(32) CHARACTER SET koi8r NOT NULL COMMENT " "
); ) COMMENT " ";
SHOW TABLES; SHOW TABLES;
SHOW CREATE TABLE ; SHOW CREATE TABLE ;
......
...@@ -598,7 +598,8 @@ void set_item_name(Item *item,char *pos,uint length); ...@@ -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, bool add_field_to_list(THD *thd, char *field_name, enum enum_field_types type,
char *length, char *decimal, char *length, char *decimal,
uint type_modifier, uint type_modifier,
Item *default_value, Item *comment, Item *default_value,
LEX_STRING *comment,
char *change, TYPELIB *interval,CHARSET_INFO *cs, char *change, TYPELIB *interval,CHARSET_INFO *cs,
uint uint_geom_type); uint uint_geom_type);
void store_position_for_column(const char *name); void store_position_for_column(const char *name);
......
...@@ -489,7 +489,8 @@ typedef struct st_lex ...@@ -489,7 +489,8 @@ typedef struct st_lex
String *wild; String *wild;
sql_exchange *exchange; sql_exchange *exchange;
select_result *result; select_result *result;
Item *default_value, *comment; Item *default_value;
LEX_STRING *comment;
LEX_USER *grant_user; LEX_USER *grant_user;
gptr yacc_yyss,yacc_yyvs; gptr yacc_yyss,yacc_yyvs;
THD *thd; THD *thd;
......
...@@ -3709,7 +3709,7 @@ mysql_parse(THD *thd, char *inBuf, uint length) ...@@ -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, bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
char *length, char *decimals, char *length, char *decimals,
uint type_modifier, uint type_modifier,
Item *default_value, Item *comment, Item *default_value, LEX_STRING *comment,
char *change, TYPELIB *interval, CHARSET_INFO *cs, char *change, TYPELIB *interval, CHARSET_INFO *cs,
uint uint_geom_type) uint uint_geom_type)
{ {
...@@ -3783,8 +3783,8 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type, ...@@ -3783,8 +3783,8 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
else else
{ {
/* In this case comment is always of type Item_string */ /* In this case comment is always of type Item_string */
new_field->comment.str= (char*) comment->str_value.ptr(); new_field->comment.str= (char*) comment->str;
new_field->comment.length=comment->str_value.length(); new_field->comment.length=comment->length;
} }
if (length && !(new_field->length= (uint) atoi(length))) if (length && !(new_field->length= (uint) atoi(length)))
length=0; /* purecov: inspected */ length=0; /* purecov: inspected */
......
...@@ -1199,7 +1199,8 @@ field_spec: ...@@ -1199,7 +1199,8 @@ field_spec:
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->length=lex->dec=0; lex->type=0; lex->interval=0; 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->charset=NULL;
} }
type opt_attribute type opt_attribute
...@@ -1411,7 +1412,7 @@ attribute: ...@@ -1411,7 +1412,7 @@ attribute:
| opt_primary KEY_SYM { Lex->type|= PRI_KEY_FLAG | NOT_NULL_FLAG; } | opt_primary KEY_SYM { Lex->type|= PRI_KEY_FLAG | NOT_NULL_FLAG; }
| UNIQUE_SYM { Lex->type|= UNIQUE_FLAG; } | UNIQUE_SYM { Lex->type|= UNIQUE_FLAG; }
| UNIQUE_SYM KEY_SYM { Lex->type|= UNIQUE_KEY_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 | COLLATE_SYM collation_name
{ {
if (Lex->charset && !my_charset_same(Lex->charset,$2)) if (Lex->charset && !my_charset_same(Lex->charset,$2))
...@@ -1668,7 +1669,8 @@ alter_list_item: ...@@ -1668,7 +1669,8 @@ alter_list_item:
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->length=lex->dec=0; lex->type=0; lex->interval=0; 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->charset= NULL;
lex->simple_alter=0; 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