Commit a7431720 authored by unknown's avatar unknown

Merge


mysql-test/t/create.test:
  Auto merged
sql/sql_table.cc:
  Auto merged
mysql-test/r/create.result:
  SCCS merged
parents e672bb70 c819b62b
...@@ -746,6 +746,8 @@ t2 CREATE TABLE `t2` ( ...@@ -746,6 +746,8 @@ t2 CREATE TABLE `t2` (
`a2` int(11) default NULL `a2` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2; drop table t1, t2;
create table t1(a set("a,b","c,d") not null);
ERROR HY000: Illegal set 'a,b' value found during parsing
create table t1 (i int) engine=myisam max_rows=100000000000; create table t1 (i int) engine=myisam max_rows=100000000000;
show create table t1; show create table t1;
Table Create Table Table Create Table
......
...@@ -646,6 +646,12 @@ show create table t2; ...@@ -646,6 +646,12 @@ show create table t2;
drop table t1, t2; drop table t1, t2;
#
# Bug #15316 SET value having comma not correctly handled
#
--error 1105
create table t1(a set("a,b","c,d") not null);
# End of 4.1 tests # End of 4.1 tests
# #
......
...@@ -741,6 +741,11 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, ...@@ -741,6 +741,11 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
sql_field->interval_list); sql_field->interval_list);
List_iterator<String> it(sql_field->interval_list); List_iterator<String> it(sql_field->interval_list);
String conv, *tmp; String conv, *tmp;
char comma_buf[2];
int comma_length= cs->cset->wc_mb(cs, ',', (uchar*) comma_buf,
(uchar*) comma_buf +
sizeof(comma_buf));
DBUG_ASSERT(comma_length > 0);
for (uint i= 0; (tmp= it++); i++) for (uint i= 0; (tmp= it++); i++)
{ {
uint lengthsp; uint lengthsp;
...@@ -759,6 +764,18 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, ...@@ -759,6 +764,18 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
interval->type_lengths[i]); interval->type_lengths[i]);
interval->type_lengths[i]= lengthsp; interval->type_lengths[i]= lengthsp;
((uchar *)interval->type_names[i])[lengthsp]= '\0'; ((uchar *)interval->type_names[i])[lengthsp]= '\0';
if (sql_field->sql_type == FIELD_TYPE_SET)
{
if (cs->coll->instr(cs, interval->type_names[i],
interval->type_lengths[i],
comma_buf, comma_length, NULL, 0))
{
my_printf_error(ER_UNKNOWN_ERROR,
"Illegal %s '%-.64s' value found during parsing",
MYF(0), "set", tmp->ptr());
DBUG_RETURN(-1);
}
}
} }
sql_field->interval_list.empty(); // Don't need interval_list anymore sql_field->interval_list.empty(); // Don't need interval_list anymore
} }
......
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