MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Chad MILLER Date:June 14 2007 10:06pm
Subject:bk commit into 5.1 tree (cmiller:1.2489) BUG#28269
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of cmiller. When cmiller 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@stripped, 2007-06-14 18:06:04-04:00, cmiller@stripped +3 -0
  Bug#28269: FEDERATED engine fails to quote reserved words for \
  	field names
  
  When you use a federated table with a column name that is a 
  reserved word, the FEDERATED storage engine will fail to quote 
  it properly when sending remote SQL which will cause a syntax 
  error and hence cause an error for FEDERATED.
  
  Fix it by quoting all names in federated communication.

  mysql-test/r/federated.result@stripped, 2007-06-14 18:06:01-04:00, cmiller@stripped +11 -3
    Prove that keywords work as column names in federated.

  mysql-test/t/federated.test@stripped, 2007-06-14 18:06:01-04:00, cmiller@stripped +7 -1
    Prove that keywords work as column names in federated.

  storage/federated/ha_federated.cc@stripped, 2007-06-14 18:06:01-04:00, cmiller@stripped +6 -1
    Quote all names, so that they're always safe.

# 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:	cmiller
# Host:	zippy.cornsilk.net
# Root:	/home/cmiller/work/mysql/mysql-5.1-maint--bug28269

--- 1.44/mysql-test/r/federated.result	2006-12-01 17:01:28 -05:00
+++ 1.45/mysql-test/r/federated.result	2007-06-14 18:06:01 -04:00
@@ -14,6 +14,7 @@ Warnings:
 Note	1051	Unknown table 't1'
 CREATE TABLE federated.t1 (
 `id` int(20) NOT NULL,
+`group` int NOT NULL default 0,
 `name` varchar(32) NOT NULL default ''
     )
 DEFAULT CHARSET=latin1;
@@ -22,6 +23,7 @@ Warnings:
 Note	1051	Unknown table 't1'
 CREATE TABLE federated.t1 (
 `id` int(20) NOT NULL,
+`group` int NOT NULL default 0,
 `name` varchar(32) NOT NULL default ''
     )
 ENGINE="FEDERATED" DEFAULT CHARSET=latin1
@@ -29,6 +31,7 @@ CONNECTION='mysql://root@stripped:@/too
 ERROR HY000: Can't create federated table. The data source connection string 'mysql://root@stripped:@/too/many/items/federated/t1' is not in the correct format
 CREATE TABLE federated.t1 (
 `id` int(20) NOT NULL,
+`group` int NOT NULL default 0,
 `name` varchar(32) NOT NULL default ''
     )
 ENGINE="FEDERATED" DEFAULT CHARSET=latin1
@@ -36,6 +39,7 @@ CONNECTION='mysql://root@stripped';
 ERROR HY000: Can't create federated table. The data source connection string 'mysql://root@stripped' is not in the correct format
 CREATE TABLE federated.t1 (
 `id` int(20) NOT NULL,
+`group` int NOT NULL default 0,
 `name` varchar(32) NOT NULL default ''
     )
 ENGINE="FEDERATED" DEFAULT CHARSET=latin1
@@ -43,6 +47,7 @@ CONNECTION='mysql://root@stripped:SLAVE
 ERROR HY000: Can't create federated table. Foreign data src error:  error: 1146  'Table 'federated.t3' doesn't exist'
 CREATE TABLE federated.t1 (
 `id` int(20) NOT NULL,
+`group` int NOT NULL default 0,
 `name` varchar(32) NOT NULL default ''
     )
 ENGINE="FEDERATED" DEFAULT CHARSET=latin1
@@ -53,16 +58,19 @@ Warnings:
 Note	1051	Unknown table 't1'
 CREATE TABLE federated.t1 (
 `id` int(20) NOT NULL,
+`group` int NOT NULL default 0,
 `name` varchar(32) NOT NULL default ''
     )
 ENGINE="FEDERATED" DEFAULT CHARSET=latin1
 CONNECTION='mysql://root@stripped:SLAVE_PORT/federated/t1';
 INSERT INTO federated.t1 (id, name) VALUES (1, 'foo');
 INSERT INTO federated.t1 (id, name) VALUES (2, 'fee');
+INSERT INTO federated.t1 (id, `group`) VALUES (3, 42);
 SELECT * FROM federated.t1;
-id	name
-1	foo
-2	fee
+id	group	name
+1	0	foo
+2	0	fee
+3	42	
 DELETE FROM federated.t1;
 DROP TABLE federated.t1;
 DROP TABLE IF EXISTS federated.t2;

--- 1.36/mysql-test/t/federated.test	2006-12-01 17:01:28 -05:00
+++ 1.37/mysql-test/t/federated.test	2007-06-14 18:06:01 -04:00
@@ -6,6 +6,7 @@ connection slave;
 DROP TABLE IF EXISTS federated.t1;
 CREATE TABLE federated.t1 (
     `id` int(20) NOT NULL,
+    `group` int NOT NULL default 0,
     `name` varchar(32) NOT NULL default ''
     )
   DEFAULT CHARSET=latin1;
@@ -16,6 +17,7 @@ DROP TABLE IF EXISTS federated.t1;
 --error 1432
 CREATE TABLE federated.t1 (
     `id` int(20) NOT NULL,
+    `group` int NOT NULL default 0,
     `name` varchar(32) NOT NULL default ''
     )
   ENGINE="FEDERATED" DEFAULT CHARSET=latin1
@@ -25,6 +27,7 @@ CREATE TABLE federated.t1 (
 --error 1432 
 CREATE TABLE federated.t1 (
     `id` int(20) NOT NULL,
+    `group` int NOT NULL default 0,
     `name` varchar(32) NOT NULL default ''
     )
   ENGINE="FEDERATED" DEFAULT CHARSET=latin1
@@ -35,6 +38,7 @@ CREATE TABLE federated.t1 (
 --error 1434
 eval CREATE TABLE federated.t1 (
     `id` int(20) NOT NULL,
+    `group` int NOT NULL default 0,
     `name` varchar(32) NOT NULL default ''
     )
   ENGINE="FEDERATED" DEFAULT CHARSET=latin1
@@ -45,6 +49,7 @@ eval CREATE TABLE federated.t1 (
 --error 1429
 eval CREATE TABLE federated.t1 (
     `id` int(20) NOT NULL,
+    `group` int NOT NULL default 0,
     `name` varchar(32) NOT NULL default ''
     )
   ENGINE="FEDERATED" DEFAULT CHARSET=latin1
@@ -55,6 +60,7 @@ DROP TABLE IF EXISTS federated.t1;
 --replace_result $SLAVE_MYPORT SLAVE_PORT
 eval CREATE TABLE federated.t1 (
     `id` int(20) NOT NULL,
+    `group` int NOT NULL default 0,
     `name` varchar(32) NOT NULL default ''
     )
   ENGINE="FEDERATED" DEFAULT CHARSET=latin1
@@ -62,6 +68,7 @@ eval CREATE TABLE federated.t1 (
 
 INSERT INTO federated.t1 (id, name) VALUES (1, 'foo');
 INSERT INTO federated.t1 (id, name) VALUES (2, 'fee');
+INSERT INTO federated.t1 (id, `group`) VALUES (3, 42);
 
 SELECT * FROM federated.t1;
 DELETE FROM federated.t1;
@@ -1628,6 +1635,5 @@ drop table federated.t1;
 
 connection slave;
 drop table federated.t1;
-
 
 source include/federated_cleanup.inc;

--- 1.101/storage/federated/ha_federated.cc	2007-05-23 18:39:27 -04:00
+++ 1.102/storage/federated/ha_federated.cc	2007-06-14 18:06:01 -04:00
@@ -1871,7 +1871,9 @@ int ha_federated::write_row(uchar *buf)
         insert_field_value_string.length(0);
       }
       /* append the field name */
+      insert_string.append('`');
       insert_string.append((*field)->field_name);
+      insert_string.append('`');
 
       /* append commas between both fields and fieldnames */
       /*
@@ -2071,8 +2073,9 @@ int ha_federated::update_row(const uchar
   {
     if (bitmap_is_set(table->write_set, (*field)->field_index))
     {
+      update_string.append('`');
       update_string.append((*field)->field_name);
-      update_string.append(STRING_WITH_LEN(" = "));
+      update_string.append(STRING_WITH_LEN("` = "));
 
       if ((*field)->is_null())
         update_string.append(STRING_WITH_LEN(" NULL "));
@@ -2176,7 +2179,9 @@ int ha_federated::delete_row(const uchar
     if (bitmap_is_set(table->read_set, cur_field->field_index))
     {
       data_string.length(0);
+      delete_string.append('`');
       delete_string.append(cur_field->field_name);
+      delete_string.append('`');
       if (cur_field->is_null())
       {
         delete_string.append(STRING_WITH_LEN(" IS NULL "));
Thread
bk commit into 5.1 tree (cmiller:1.2489) BUG#28269Chad MILLER14 Jun
  • Re: bk commit into 5.1 tree (cmiller:1.2489) BUG#28269Jim Winstead14 Jun
    • Re: bk commit into 5.1 tree (cmiller:1.2489) BUG#28269Chad MILLER14 Jun
      • Re: bk commit into 5.1 tree (cmiller:1.2489) BUG#28269Jim Winstead15 Jun