Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
5576ed8b
Commit
5576ed8b
authored
Aug 17, 2006
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/usr/home/ram/work/4.1.b20695
parents
be3047a0
fe3dee06
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
63 additions
and
34 deletions
+63
-34
mysql-test/r/ctype_recoding.result
mysql-test/r/ctype_recoding.result
+11
-0
mysql-test/t/ctype_recoding.test
mysql-test/t/ctype_recoding.test
+12
-0
sql/sql_lex.cc
sql/sql_lex.cc
+3
-2
sql/sql_lex.h
sql/sql_lex.h
+1
-1
sql/sql_table.cc
sql/sql_table.cc
+34
-29
sql/sql_yacc.yy
sql/sql_yacc.yy
+2
-2
No files found.
mysql-test/r/ctype_recoding.result
View file @
5576ed8b
...
@@ -247,3 +247,14 @@ lpad(c1,3,'
...
@@ -247,3 +247,14 @@ lpad(c1,3,'
select rpad(c1,3,''), rpad('',3,c1) from t1;
select rpad(c1,3,''), rpad('',3,c1) from t1;
rpad(c1,3,'') rpad('',3,c1)
rpad(c1,3,'') rpad('',3,c1)
drop table t1;
set names koi8r;
create table t1(a char character set cp1251 default _koi8r 0xFF);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(1) character set cp1251 default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1(a char character set latin1 default _cp1251 0xFF);
ERROR 42000: Invalid default value for 'a'
mysql-test/t/ctype_recoding.test
View file @
5576ed8b
...
@@ -186,5 +186,17 @@ select rpad(c1,3,'
...
@@ -186,5 +186,17 @@ select rpad(c1,3,'
# TODO
# TODO
#select case c1 when '' then '' when '' then '' else 'c' end from t1;
#select case c1 when '' then '' when '' then '' else 'c' end from t1;
#select export_set(5,c1,''), export_set(5,'',c1) from t1;
#select export_set(5,c1,''), export_set(5,'',c1) from t1;
drop
table
t1
;
#
# Bug 20695: problem with field default value's character set
#
set
names
koi8r
;
create
table
t1
(
a
char
character
set
cp1251
default
_koi8r
0xFF
);
show
create
table
t1
;
drop
table
t1
;
--
error
1067
create
table
t1
(
a
char
character
set
latin1
default
_cp1251
0xFF
);
# End of 4.1 tests
# End of 4.1 tests
sql/sql_lex.cc
View file @
5576ed8b
...
@@ -643,7 +643,8 @@ int yylex(void *arg, void *yythd)
...
@@ -643,7 +643,8 @@ int yylex(void *arg, void *yythd)
*/
*/
if
((
yylval
->
lex_str
.
str
[
0
]
==
'_'
)
&&
if
((
yylval
->
lex_str
.
str
[
0
]
==
'_'
)
&&
(
lex
->
charset
=
get_charset_by_csname
(
yylval
->
lex_str
.
str
+
1
,
(
lex
->
underscore_charset
=
get_charset_by_csname
(
yylval
->
lex_str
.
str
+
1
,
MY_CS_PRIMARY
,
MYF
(
0
))))
MY_CS_PRIMARY
,
MYF
(
0
))))
return
(
UNDERSCORE_CHARSET
);
return
(
UNDERSCORE_CHARSET
);
return
(
result_state
);
// IDENT or IDENT_QUOTED
return
(
result_state
);
// IDENT or IDENT_QUOTED
...
...
sql/sql_lex.h
View file @
5576ed8b
...
@@ -613,7 +613,7 @@ typedef struct st_lex
...
@@ -613,7 +613,7 @@ typedef struct st_lex
LEX_USER
*
grant_user
;
LEX_USER
*
grant_user
;
gptr
yacc_yyss
,
yacc_yyvs
;
gptr
yacc_yyss
,
yacc_yyvs
;
THD
*
thd
;
THD
*
thd
;
CHARSET_INFO
*
charset
;
CHARSET_INFO
*
charset
,
*
underscore_charset
;
List
<
key_part_spec
>
col_list
;
List
<
key_part_spec
>
col_list
;
List
<
key_part_spec
>
ref_list
;
List
<
key_part_spec
>
ref_list
;
...
...
sql/sql_table.cc
View file @
5576ed8b
...
@@ -516,6 +516,40 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
...
@@ -516,6 +516,40 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
DBUG_RETURN
(
-
1
);
DBUG_RETURN
(
-
1
);
}
}
/*
Convert the default value character
set into the column character set if necessary.
*/
if
(
sql_field
->
def
&&
savecs
!=
sql_field
->
def
->
collation
.
collation
&&
(
sql_field
->
sql_type
==
FIELD_TYPE_VAR_STRING
||
sql_field
->
sql_type
==
FIELD_TYPE_STRING
||
sql_field
->
sql_type
==
FIELD_TYPE_SET
||
sql_field
->
sql_type
==
FIELD_TYPE_ENUM
))
{
Item_arena
backup_arena
;
bool
need_to_change_arena
=
!
thd
->
current_arena
->
is_conventional_execution
();
if
(
need_to_change_arena
)
{
/* Assert that we don't do that at every PS execute */
DBUG_ASSERT
(
thd
->
current_arena
->
is_first_stmt_execute
());
thd
->
set_n_backup_item_arena
(
thd
->
current_arena
,
&
backup_arena
);
}
sql_field
->
def
=
sql_field
->
def
->
safe_charset_converter
(
savecs
);
if
(
need_to_change_arena
)
thd
->
restore_backup_item_arena
(
thd
->
current_arena
,
&
backup_arena
);
if
(
sql_field
->
def
==
NULL
)
{
/* Could not convert */
my_error
(
ER_INVALID_DEFAULT
,
MYF
(
0
),
sql_field
->
field_name
);
DBUG_RETURN
(
-
1
);
}
}
if
(
sql_field
->
sql_type
==
FIELD_TYPE_SET
||
if
(
sql_field
->
sql_type
==
FIELD_TYPE_SET
||
sql_field
->
sql_type
==
FIELD_TYPE_ENUM
)
sql_field
->
sql_type
==
FIELD_TYPE_ENUM
)
{
{
...
@@ -580,35 +614,6 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
...
@@ -580,35 +614,6 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
sql_field
->
interval_list
.
empty
();
// Don't need interval_list anymore
sql_field
->
interval_list
.
empty
();
// Don't need interval_list anymore
}
}
/*
Convert the default value from client character
set into the column character set if necessary.
*/
if
(
sql_field
->
def
&&
cs
!=
sql_field
->
def
->
collation
.
collation
)
{
Item_arena
backup_arena
;
bool
need_to_change_arena
=
!
thd
->
current_arena
->
is_conventional_execution
();
if
(
need_to_change_arena
)
{
/* Asser that we don't do that at every PS execute */
DBUG_ASSERT
(
thd
->
current_arena
->
is_first_stmt_execute
());
thd
->
set_n_backup_item_arena
(
thd
->
current_arena
,
&
backup_arena
);
}
sql_field
->
def
=
sql_field
->
def
->
safe_charset_converter
(
cs
);
if
(
need_to_change_arena
)
thd
->
restore_backup_item_arena
(
thd
->
current_arena
,
&
backup_arena
);
if
(
sql_field
->
def
==
NULL
)
{
/* Could not convert */
my_error
(
ER_INVALID_DEFAULT
,
MYF
(
0
),
sql_field
->
field_name
);
DBUG_RETURN
(
-
1
);
}
}
if
(
sql_field
->
sql_type
==
FIELD_TYPE_SET
)
if
(
sql_field
->
sql_type
==
FIELD_TYPE_SET
)
{
{
if
(
sql_field
->
def
!=
NULL
)
if
(
sql_field
->
def
!=
NULL
)
...
...
sql/sql_yacc.yy
View file @
5576ed8b
...
@@ -4896,7 +4896,7 @@ text_literal:
...
@@ -4896,7 +4896,7 @@ text_literal:
| NCHAR_STRING
| NCHAR_STRING
{ $$= new Item_string($1.str,$1.length,national_charset_info); }
{ $$= new Item_string($1.str,$1.length,national_charset_info); }
| UNDERSCORE_CHARSET TEXT_STRING
| UNDERSCORE_CHARSET TEXT_STRING
{ $$ = new Item_string($2.str,$2.length,Lex->charset); }
{ $$ = new Item_string($2.str,$2.length,Lex->
underscore_
charset); }
| text_literal TEXT_STRING_literal
| text_literal TEXT_STRING_literal
{ ((Item_string*) $1)->append($2.str,$2.length); }
{ ((Item_string*) $1)->append($2.str,$2.length); }
;
;
...
@@ -4963,7 +4963,7 @@ literal:
...
@@ -4963,7 +4963,7 @@ literal:
(String*) 0;
(String*) 0;
$$= new Item_string(str ? str->ptr() : "",
$$= new Item_string(str ? str->ptr() : "",
str ? str->length() : 0,
str ? str->length() : 0,
Lex->charset);
Lex->
underscore_
charset);
}
}
| DATE_SYM text_literal { $$ = $2; }
| DATE_SYM text_literal { $$ = $2; }
| TIME_SYM text_literal { $$ = $2; }
| TIME_SYM text_literal { $$ = $2; }
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment