MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:gluh Date:March 29 2006 2:52pm
Subject:bk commit into 4.1 tree (gluh:1.2480) BUG#15316
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of gluh. When gluh does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2480 06/03/29 19:52:26 gluh@stripped +3 -0
  Fix for bug#15316 SET value having comma not correctly handled
   disallow the use of comma in SET members

  sql/sql_table.cc
    1.306 06/03/29 19:52:22 gluh@stripped +17 -0
    Fix for bug#15316 SET value having comma not correctly handled
     disallow the use of comma in SET members

  mysql-test/t/create.test
    1.61 06/03/29 19:52:22 gluh@stripped +6 -0
    Fix for bug#15316 SET value having comma not correctly handled
     test case

  mysql-test/r/create.result
    1.88 06/03/29 19:52:22 gluh@stripped +2 -0
    Fix for bug#15316 SET value having comma not correctly handled
     test case

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	gluh
# Host:	eagle.intranet.mysql.r18.ru
# Root:	/home/gluh/MySQL/Merge/4.1

--- 1.305/sql/sql_table.cc	Tue Feb 21 20:52:15 2006
+++ 1.306/sql/sql_table.cc	Wed Mar 29 19:52:22 2006
@@ -540,6 +540,11 @@ int mysql_prepare_table(THD *thd, HA_CRE
                                                sql_field->interval_list);
         List_iterator<String> it(sql_field->interval_list);
         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++)
         {
           if (String::needs_conversion(tmp->length(), tmp->charset(),
@@ -559,6 +564,18 @@ int mysql_prepare_table(THD *thd, HA_CRE
                                             interval->type_lengths[i]);
           interval->type_lengths[i]= lengthsp;
           ((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
       }

--- 1.87/mysql-test/r/create.result	Mon Jan 16 19:18:09 2006
+++ 1.88/mysql-test/r/create.result	Wed Mar 29 19:52:22 2006
@@ -699,3 +699,5 @@ t2	CREATE TABLE `t2` (
   `a2` int(11) default NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 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

--- 1.60/mysql-test/t/create.test	Mon Jan 16 19:18:09 2006
+++ 1.61/mysql-test/t/create.test	Wed Mar 29 19:52:22 2006
@@ -603,4 +603,10 @@ show create table 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
Thread
bk commit into 4.1 tree (gluh:1.2480) BUG#15316gluh29 Mar