Commit 00d77fdd authored by unknown's avatar unknown

Made changes to add federated CONNECTION information to the .frm file

(per Monty's patch).
Remove references to the "COMMENT" field.
WL#2414


mysql-test/r/federated.result:
  alter from "COMMENT=" to "CONNECTION="
mysql-test/r/federated_archive.result:
  change "COMMENT=" to "CONNECTION="
mysql-test/t/federated.test:
  change from "COMMENT=" to "CONNECTION="
mysql-test/t/federated_archive.test:
  change from "COMMENT=" to "CONNECTION="
sql/ha_federated.cc:
  Change parsing of char* table->s->comment to LEX_STRING table->s->connect_string
  (per Monty's patch)
sql/handler.h:
  added LEX_STRING "connection_string"
  (per Monty's patch)
sql/sql_yacc.yy:
  added setting of "connect_string" string and length
sql/table.cc:
  Modifying frm file to store connecting information (code change came from Monty).
sql/table.h:
  added connect_string
sql/unireg.cc:
  Storing information on connection_string (code came from Monty).
parent 3d1658f7
......@@ -25,28 +25,28 @@ CREATE TABLE federated.t1 (
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:@/too/many/items/federated/t1';
ERROR HY000: Can't create federated table. The data source connection string 'mysql://root@127.0.0.1:@/too/many/items/federated/t1' is not in the correct format
CONNECTION='mysql://root@127.0.0.1:@/too/many/items/federated/t1';
ERROR HY000: Can't create federated table. The data source connection string 'mysql://root@127.0.0.1:@/too/many/items/federated/t1' is not in the correct format
CREATE TABLE federated.t1 (
`id` int(20) NOT NULL,
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1';
CONNECTION='mysql://root@127.0.0.1';
ERROR HY000: Can't create federated table. The data source connection string 'mysql://root@127.0.0.1' is not in the correct format
CREATE TABLE federated.t1 (
`id` int(20) NOT NULL,
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:SLAVE_PORT/federated/t3';
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t3';
ERROR HY000: Can't create federated table. Foreign data src error : ': 1146 : Table 'federated.t3' doesn't exist'
CREATE TABLE federated.t1 (
`id` int(20) NOT NULL,
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
COMMENT='mysql://user:pass@127.0.0.1:SLAVE_PORT/federated/t1';
CONNECTION='mysql://user:pass@127.0.0.1:SLAVE_PORT/federated/t1';
ERROR HY000: Unable to connect to foreign data source - database ' database federated username user hostname 127.0.0.1'!
DROP TABLE IF EXISTS federated.t1;
Warnings:
......@@ -56,7 +56,7 @@ CREATE TABLE federated.t1 (
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
INSERT INTO federated.t1 (id, name) VALUES (1, 'foo');
INSERT INTO federated.t1 (id, name) VALUES (2, 'fee');
SELECT * FROM federated.t1;
......@@ -73,7 +73,7 @@ CREATE TABLE federated.t2 (
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
INSERT INTO federated.t2 (id, name) VALUES (1, 'foo');
INSERT INTO federated.t2 (id, name) VALUES (2, 'fee');
SELECT * FROM federated.t2;
......@@ -98,7 +98,7 @@ CREATE TABLE federated.t1 (
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1%';
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1%';
INSERT INTO federated.t1 (id, name) VALUES (1, 'foo');
INSERT INTO federated.t1 (id, name) VALUES (2, 'fee');
SELECT * FROM federated.t1;
......@@ -112,7 +112,7 @@ CREATE TABLE federated.`t1%` (
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1%';
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1%';
INSERT INTO federated.`t1%` (id, name) VALUES (1, 'foo');
INSERT INTO federated.`t1%` (id, name) VALUES (2, 'fee');
SELECT * FROM federated.`t1%`;
......@@ -139,7 +139,7 @@ CREATE TABLE federated.t1 (
`created` datetime default '2004-04-04 04:04:04',
PRIMARY KEY (`id`))
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
INSERT INTO federated.t1 (name, other) VALUES ('First Name', 11111);
INSERT INTO federated.t1 (name, other) VALUES ('Second Name', 22222);
INSERT INTO federated.t1 (name, other) VALUES ('Third Name', 33333);
......@@ -279,7 +279,7 @@ key name(`name`),
key other(`other`),
key created(`created`))
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
INSERT INTO federated.t1 (name, other, created)
VALUES ('First Name', 11111, '2004-01-01 01:01:01');
INSERT INTO federated.t1 (name, other, created)
......@@ -419,7 +419,7 @@ CREATE TABLE federated.t1 (
PRIMARY KEY (`id`) )
ENGINE="FEDERATED"
DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
INSERT INTO federated.t1 (name, other) VALUES ('First Name', 11111);
INSERT INTO federated.t1 (name, other) VALUES ('Second Name', NULL);
INSERT INTO federated.t1 (name, other) VALUES ('Third Name', 33333);
......@@ -484,7 +484,7 @@ PRIMARY KEY (`id`),
KEY nameoth (name, other))
ENGINE="FEDERATED" DEFAULT
CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
INSERT INTO federated.t1 (name, other) VALUES ('First Name', '1111');
INSERT INTO federated.t1 (name, other) VALUES ('Second Name', '2222');
INSERT INTO federated.t1 (name, other) VALUES ('Third Name', '3333');
......@@ -524,7 +524,7 @@ KEY bincol(bincol),
KEY floatval(floatval))
ENGINE="FEDERATED"
DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
INSERT INTO federated.t1 (name, bincol, floatval, other)
VALUES ('first', 0x65, 11.11, 1111);
INSERT INTO federated.t1 (name, bincol, floatval, other)
......@@ -589,7 +589,7 @@ key col2(col2),
key col3(col3),
key col4(col4))
ENGINE="FEDERATED"
COMMENT='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
INSERT INTO federated.t1 (col1, col2, col3, col4)
VALUES (1, 'one One', 11, 1111);
INSERT INTO federated.t1 (col1, col2, col3, col4)
......@@ -798,7 +798,7 @@ key 3key(`col2`,`col3`,`col4`),
key 2key (`col3`,`col4`),
key col4(col4))
ENGINE="FEDERATED"
COMMENT='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
INSERT INTO federated.t1 (col1, col2, col3, col4)
VALUES ('aaaa', 'aaaaaaaaaaaaaaaaaaa', 'ababababab', 'acacacacacacacac');
INSERT INTO federated.t1 (col1, col2, col3, col4)
......@@ -898,7 +898,7 @@ CREATE TABLE federated.t1 (
primary key (`col1`, `col2`, `col3`))
ENGINE="FEDERATED"
DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
INSERT INTO federated.t1 VALUES ('a00', '110', 'cc0');
INSERT INTO federated.t1 VALUES ('aaa', '111', 'ccc');
INSERT INTO federated.t1 VALUES ('bbb', '222', 'yyy');
......@@ -933,7 +933,7 @@ CREATE TABLE federated.t1 (
`other` int)
ENGINE="FEDERATED"
DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
INSERT INTO federated.t1 values (NULL, NULL, NULL, NULL);
INSERT INTO federated.t1 values ();
INSERT INTO federated.t1 (id) VALUES (1);
......@@ -968,7 +968,7 @@ CREATE TABLE federated.t1 (
PRIMARY KEY (blurb_id))
ENGINE="FEDERATED"
DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
INSERT INTO federated.t1 VALUES (1, " MySQL supports a number of column types in several categories: numeric types, date and time types, and string (character) types. This chapter first gives an overview of these column types, and then provides a more detailed description of the properties of the types in each category, and a summary of the column type storage requirements. The overview is intentionally brief. The more detailed descriptions should be consulted for additional information about particular column types, such as the allowable formats in which you can specify values.");
INSERT INTO federated.t1 VALUES (2, "All arithmetic is done using signed BIGINT or DOUBLE values, so you should not use unsigned big integers larger than 9223372036854775807 (63 bits) except with bit functions! If you do that, some of the last digits in the result may be wrong because of rounding errors when converting a BIGINT value to a DOUBLE.");
INSERT INTO federated.t1 VALUES (3, " A floating-point number. p represents the precision. It can be from 0 to 24 for a single-precision floating-point number and from 25 to 53 for a double-precision floating-point number. These types are like the FLOAT and DOUBLE types described immediately following. FLOAT(p) has the same range as the corresponding FLOAT and DOUBLE types, but the display size and number of decimals are undefined. ");
......@@ -994,7 +994,7 @@ PRIMARY KEY (a),
KEY (b))
ENGINE="FEDERATED"
DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
INSERT INTO federated.t1 VALUES (3,3,3),(1,1,1),(2,2,2),(4,4,4);
DROP TABLE IF EXISTS federated.t1;
CREATE TABLE federated.t1 (i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8
......@@ -1252,7 +1252,7 @@ int, i999 int, i1000 int, b varchar(256))
row_format=dynamic
ENGINE="FEDERATED"
DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
INSERT INTO federated.t1
values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
......@@ -1322,7 +1322,7 @@ PRIMARY KEY(id),
index(code),
index(fileguts(10)))
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
INSERT INTO federated.t1 (code, fileguts, creation_date) VALUES ('ASDFWERQWETWETAWETA', '*()w*09*$()*#)(*09*^90*d)(*s()d8g)(s*ned)(*)(s*d)(*hn(d*)(*sbn)D((#$*(#*%%&#&^$#&#&#&#&^&#*&*#$*&^*(&#(&Q*&&(*!&!(*&*(#&*(%&#<S-F8>*<S-F8><S-F8><S-F8>#<S-F8>#<S-F8>#<S-F8>[[', '2003-03-03 03:03:03');
INSERT INTO federated.t1 (code, fileguts, creation_date) VALUES ('DEUEUEUEUEUEUEUEUEU', '*()w*09*$()*#)(*09*^90*d)(*s()d8g)(s*ned)(*)(s*d)(*hn(d*)(*sbn)D((#$*(#*%%&#&^$#&#&#&#&^&#*&*#$*&^*(&#(&Q*&&(*!&!(*&*(#&*(%&#<S-F8>*<S-F8><S-F8><S-F8>#<S-F8>#<S-F8>#<S-F8>[[', '2004-04-04 04:04:04');
INSERT INTO federated.t1 (code, fileguts, creation_date) VALUES ('DEUEUEUEUEUEUEUEUEU', 'jimbob', '2004-04-04 04:04:04');
......@@ -1340,7 +1340,7 @@ DROP TABLE IF EXISTS federated.t1;
CREATE TABLE federated.t1 (
`a` BLOB)
ENGINE="FEDERATED"
COMMENT='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
INSERT INTO federated.t1 VALUES (0x00);
INSERT INTO federated.t1 VALUES (0x0001);
INSERT INTO federated.t1 VALUES (0x0100);
......@@ -1378,7 +1378,7 @@ CREATE TABLE federated.t1 (
PRIMARY KEY (`id`),
KEY (country_id) )
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
INSERT INTO federated.t1 (name, country_id, other) VALUES ('Kumar', 1, 11111);
INSERT INTO federated.t1 (name, country_id, other) VALUES ('Lenz', 2, 22222);
INSERT INTO federated.t1 (name, country_id, other) VALUES ('Marizio', 3, 33333);
......
......@@ -21,7 +21,7 @@ CREATE TABLE federated.t1 (
PRIMARY KEY (`id`)
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:SLAVE_PORT/federated/archive_table';
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/archive_table';
INSERT INTO federated.t1 (id, name) VALUES (1, 'foo');
INSERT INTO federated.t1 (id, name) VALUES (2, 'bar');
SELECT * FROM federated.t1;
......
......@@ -17,7 +17,7 @@ CREATE TABLE federated.t1 (
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:@/too/many/items/federated/t1';
CONNECTION='mysql://root@127.0.0.1:@/too/many/items/federated/t1';
# test not enough items (malformed) in the comment string url
--error 1432
......@@ -26,7 +26,7 @@ CREATE TABLE federated.t1 (
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1';
CONNECTION='mysql://root@127.0.0.1';
# test non-existant table
--replace_result $SLAVE_MYPORT SLAVE_PORT
......@@ -36,7 +36,7 @@ eval CREATE TABLE federated.t1 (
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t3';
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t3';
# test bad user/password
--replace_result $SLAVE_MYPORT SLAVE_PORT
......@@ -46,7 +46,7 @@ eval CREATE TABLE federated.t1 (
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
COMMENT='mysql://user:pass@127.0.0.1:$SLAVE_MYPORT/federated/t1';
CONNECTION='mysql://user:pass@127.0.0.1:$SLAVE_MYPORT/federated/t1';
DROP TABLE IF EXISTS federated.t1;
# # correct connection, same named tables
......@@ -56,7 +56,7 @@ eval CREATE TABLE federated.t1 (
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
INSERT INTO federated.t1 (id, name) VALUES (1, 'foo');
INSERT INTO federated.t1 (id, name) VALUES (2, 'fee');
......@@ -73,7 +73,7 @@ eval CREATE TABLE federated.t2 (
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
INSERT INTO federated.t2 (id, name) VALUES (1, 'foo');
INSERT INTO federated.t2 (id, name) VALUES (2, 'fee');
......@@ -100,7 +100,7 @@ eval CREATE TABLE federated.t1 (
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1%';
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1%';
INSERT INTO federated.t1 (id, name) VALUES (1, 'foo');
INSERT INTO federated.t1 (id, name) VALUES (2, 'fee');
......@@ -115,7 +115,7 @@ eval CREATE TABLE federated.`t1%` (
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1%';
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1%';
INSERT INTO federated.`t1%` (id, name) VALUES (1, 'foo');
INSERT INTO federated.`t1%` (id, name) VALUES (2, 'fee');
......@@ -146,7 +146,7 @@ eval CREATE TABLE federated.t1 (
`created` datetime default '2004-04-04 04:04:04',
PRIMARY KEY (`id`))
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
INSERT INTO federated.t1 (name, other) VALUES ('First Name', 11111);
INSERT INTO federated.t1 (name, other) VALUES ('Second Name', 22222);
......@@ -213,7 +213,7 @@ eval CREATE TABLE federated.t1 (
key other(`other`),
key created(`created`))
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
INSERT INTO federated.t1 (name, other, created)
VALUES ('First Name', 11111, '2004-01-01 01:01:01');
......@@ -284,7 +284,7 @@ eval CREATE TABLE federated.t1 (
PRIMARY KEY (`id`) )
ENGINE="FEDERATED"
DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
INSERT INTO federated.t1 (name, other) VALUES ('First Name', 11111);
INSERT INTO federated.t1 (name, other) VALUES ('Second Name', NULL);
......@@ -333,7 +333,7 @@ eval CREATE TABLE federated.t1 (
KEY nameoth (name, other))
ENGINE="FEDERATED" DEFAULT
CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
INSERT INTO federated.t1 (name, other) VALUES ('First Name', '1111');
INSERT INTO federated.t1 (name, other) VALUES ('Second Name', '2222');
......@@ -372,7 +372,7 @@ eval CREATE TABLE federated.t1 (
KEY floatval(floatval))
ENGINE="FEDERATED"
DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
INSERT INTO federated.t1 (name, bincol, floatval, other)
VALUES ('first', 0x65, 11.11, 1111);
......@@ -421,7 +421,7 @@ eval CREATE TABLE federated.t1 (
key col3(col3),
key col4(col4))
ENGINE="FEDERATED"
COMMENT='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
INSERT INTO federated.t1 (col1, col2, col3, col4)
VALUES (1, 'one One', 11, 1111);
......@@ -515,7 +515,7 @@ eval CREATE TABLE federated.t1 (
key 2key (`col3`,`col4`),
key col4(col4))
ENGINE="FEDERATED"
COMMENT='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
INSERT INTO federated.t1 (col1, col2, col3, col4)
VALUES ('aaaa', 'aaaaaaaaaaaaaaaaaaa', 'ababababab', 'acacacacacacacac');
......@@ -567,7 +567,7 @@ eval CREATE TABLE federated.t1 (
primary key (`col1`, `col2`, `col3`))
ENGINE="FEDERATED"
DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
INSERT INTO federated.t1 VALUES ('a00', '110', 'cc0');
INSERT INTO federated.t1 VALUES ('aaa', '111', 'ccc');
......@@ -606,7 +606,7 @@ eval CREATE TABLE federated.t1 (
`other` int)
ENGINE="FEDERATED"
DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
# these both should be the same
INSERT INTO federated.t1 values (NULL, NULL, NULL, NULL);
......@@ -640,7 +640,7 @@ eval CREATE TABLE federated.t1 (
PRIMARY KEY (blurb_id))
ENGINE="FEDERATED"
DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
INSERT INTO federated.t1 VALUES (1, " MySQL supports a number of column types in several categories: numeric types, date and time types, and string (character) types. This chapter first gives an overview of these column types, and then provides a more detailed description of the properties of the types in each category, and a summary of the column type storage requirements. The overview is intentionally brief. The more detailed descriptions should be consulted for additional information about particular column types, such as the allowable formats in which you can specify values.");
INSERT INTO federated.t1 VALUES (2, "All arithmetic is done using signed BIGINT or DOUBLE values, so you should not use unsigned big integers larger than 9223372036854775807 (63 bits) except with bit functions! If you do that, some of the last digits in the result may be wrong because of rounding errors when converting a BIGINT value to a DOUBLE.");
......@@ -667,7 +667,7 @@ eval CREATE TABLE federated.t1 (
KEY (b))
ENGINE="FEDERATED"
DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
INSERT INTO federated.t1 VALUES (3,3,3),(1,1,1),(2,2,2),(4,4,4);
......@@ -931,7 +931,7 @@ int, i999 int, i1000 int, b varchar(256))
row_format=dynamic
ENGINE="FEDERATED"
DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
INSERT INTO federated.t1
values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
......@@ -1000,7 +1000,7 @@ eval CREATE TABLE federated.t1 (
index(code),
index(fileguts(10)))
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
INSERT INTO federated.t1 (code, fileguts, creation_date) VALUES ('ASDFWERQWETWETAWETA', '*()w*09*$()*#)(*09*^90*d)(*s()d8g)(s*ned)(*)(s*d)(*hn(d*)(*sbn)D((#$*(#*%%&#&^$#&#&#&#&^&#*&*#$*&^*(&#(&Q*&&(*!&!(*&*(#&*(%&#<S-F8>*<S-F8><S-F8><S-F8>#<S-F8>#<S-F8>#<S-F8>[[', '2003-03-03 03:03:03');
INSERT INTO federated.t1 (code, fileguts, creation_date) VALUES ('DEUEUEUEUEUEUEUEUEU', '*()w*09*$()*#)(*09*^90*d)(*s()d8g)(s*ned)(*)(s*d)(*hn(d*)(*sbn)D((#$*(#*%%&#&^$#&#&#&#&^&#*&*#$*&^*(&#(&Q*&&(*!&!(*&*(#&*(%&#<S-F8>*<S-F8><S-F8><S-F8>#<S-F8>#<S-F8>#<S-F8>[[', '2004-04-04 04:04:04');
INSERT INTO federated.t1 (code, fileguts, creation_date) VALUES ('DEUEUEUEUEUEUEUEUEU', 'jimbob', '2004-04-04 04:04:04');
......@@ -1019,7 +1019,7 @@ DROP TABLE IF EXISTS federated.t1;
eval CREATE TABLE federated.t1 (
`a` BLOB)
ENGINE="FEDERATED"
COMMENT='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
INSERT INTO federated.t1 VALUES (0x00);
INSERT INTO federated.t1 VALUES (0x0001);
......@@ -1031,7 +1031,7 @@ SELECT HEX(a) FROM federated.t1;
# --replace_result $SLAVE_MYPORT SLAVE_PORT
# eval CREATE TABLE federated.t1
# (a char(20)) charset=cp1251
# ENGINE="FEDERATED" COMMENT="mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1";
# ENGINE="FEDERATED" CONNECTION="mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1";
# #
# connection slave;
# DROP TABLE IF EXISTS federated.t1;
......@@ -1093,7 +1093,7 @@ eval CREATE TABLE federated.t1 (
PRIMARY KEY (`id`),
KEY (country_id) )
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
INSERT INTO federated.t1 (name, country_id, other) VALUES ('Kumar', 1, 11111);
INSERT INTO federated.t1 (name, country_id, other) VALUES ('Lenz', 2, 22222);
......
......@@ -25,7 +25,7 @@ eval CREATE TABLE federated.t1 (
PRIMARY KEY (`id`)
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
COMMENT='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/archive_table';
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/archive_table';
INSERT INTO federated.t1 (id, name) VALUES (1, 'foo');
INSERT INTO federated.t1 (id, name) VALUES (2, 'bar');
......
......@@ -518,7 +518,7 @@ error:
/*
Parse connection info from table->s->comment
Parse connection info from table->s->connect_string
SYNOPSIS
parse_url()
......@@ -563,7 +563,14 @@ static int parse_url(FEDERATED_SHARE *share, TABLE *table,
DBUG_ENTER("ha_federated::parse_url");
share->port= 0;
share->scheme= my_strdup(table->s->comment, MYF(0));
DBUG_PRINT("info", ("Length %d \n", table->s->connect_string.length));
DBUG_PRINT("info", ("String %.*s \n", table->s->connect_string.length,
table->s->connect_string.str));
share->scheme= my_strdup_with_length(table->s->connect_string.str,
table->s->connect_string.length+1,
MYF(0));
// Add a null for later termination of table name
share->scheme[table->s->connect_string.length]= 0;
DBUG_PRINT("info",("parse_url alloced share->scheme %lx", share->scheme));
/*
......@@ -673,7 +680,8 @@ error:
my_free((gptr) share->scheme, MYF(0));
share->scheme= 0;
}
my_error(error_num, MYF(0), table->s->comment);
/* FIXME: table->s->connect_string is NOT null terminated */
my_error(error_num, MYF(0), "invalid connection string");
DBUG_RETURN(error_num);
}
......@@ -1313,7 +1321,7 @@ static FEDERATED_SHARE *get_share(const char *table_name, TABLE *table)
&share, sizeof(*share),
&tmp_table_name, tmp_table_name_length+ 1,
&select_query,
query.length()+strlen(table->s->comment)+1,
query.length()+table->s->connect_string.length+1,
NullS)))
{
pthread_mutex_unlock(&federated_mutex);
......@@ -1918,11 +1926,9 @@ int ha_federated::delete_row(const byte *buf)
String delete_string(delete_buffer, sizeof(delete_buffer), &my_charset_bin);
String data_string(data_buffer, sizeof(data_buffer), &my_charset_bin);
delete_string.length(0);
data_string.length(0);
DBUG_ENTER("ha_federated::delete_row");
delete_string.length(0);
delete_string.append(FEDERATED_DELETE);
delete_string.append(FEDERATED_FROM);
delete_string.append(FEDERATED_BTICK);
......@@ -1932,9 +1938,11 @@ int ha_federated::delete_row(const byte *buf)
for (Field **field= table->field; *field; field++)
{
delete_string.append((*field)->field_name);
Field *cur_field= *field;
data_string.length(0);
delete_string.append(cur_field->field_name);
if ((*field)->is_null())
if (cur_field->is_null())
{
delete_string.append(FEDERATED_IS);
data_string.append(FEDERATED_NULL);
......@@ -1942,16 +1950,14 @@ int ha_federated::delete_row(const byte *buf)
else
{
delete_string.append(FEDERATED_EQ);
(*field)->val_str(&data_string);
(*field)->quote_data(&data_string);
cur_field->val_str(&data_string);
cur_field->quote_data(&data_string);
}
delete_string.append(data_string);
data_string.length(0);
if (*(field + 1))
delete_string.append(FEDERATED_AND);
delete_string.append(FEDERATED_AND);
}
delete_string.length(delete_string.length()-5); // Remove trailing AND
delete_string.append(FEDERATED_LIMIT1);
DBUG_PRINT("info",
......
......@@ -209,6 +209,7 @@ enum row_type { ROW_TYPE_NOT_USED=-1, ROW_TYPE_DEFAULT, ROW_TYPE_FIXED,
#define HA_CREATE_USED_ROW_FORMAT (1L << 15)
#define HA_CREATE_USED_COMMENT (1L << 16)
#define HA_CREATE_USED_PASSWORD (1L << 17)
#define HA_CREATE_USED_CONNECTION (1L << 18)
typedef ulonglong my_xid; // this line is the same as in log_event.h
#define MYSQL_XID_PREFIX "MySQLXid"
......@@ -382,6 +383,7 @@ enum enum_tx_isolation { ISO_READ_UNCOMMITTED, ISO_READ_COMMITTED,
typedef struct st_ha_create_information
{
CHARSET_INFO *table_charset, *default_table_charset;
LEX_STRING connect_string;
const char *comment,*password;
const char *data_file_name, *index_file_name;
const char *alias;
......
......@@ -2694,6 +2694,7 @@ create_table_option:
| INSERT_METHOD opt_equal merge_insert_types { Lex->create_info.merge_insert_method= $3; Lex->create_info.used_fields|= HA_CREATE_USED_INSERT_METHOD;}
| DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys { Lex->create_info.data_file_name= $4.str; Lex->create_info.used_fields|= HA_CREATE_USED_DATADIR; }
| INDEX_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys { Lex->create_info.index_file_name= $4.str; Lex->create_info.used_fields|= HA_CREATE_USED_INDEXDIR; }
| CONNECTION_SYM opt_equal TEXT_STRING_sys { Lex->create_info.connect_string.str= $3.str; Lex->create_info.connect_string.length= $3.length; Lex->create_info.used_fields|= HA_CREATE_USED_CONNECTION; }
;
default_charset:
......
......@@ -71,7 +71,7 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
uint rec_buff_length,n_length,int_length,records,key_parts,keys,
interval_count,interval_parts,read_length,db_create_options;
uint key_info_length, com_length;
ulong pos;
ulong pos, record_offset;
char index_file[FN_REFLEN], *names, *keynames, *comment_pos;
uchar head[288],*disk_buff,new_field_pack_flag;
my_string record;
......@@ -321,11 +321,12 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
rec_buff_length * records)))
goto err; /* purecov: inspected */
share->default_values= (byte *) record;
record_offset= (ulong) (uint2korr(head+6)+
((uint2korr(head+14) == 0xffff ?
uint4korr(head+47) : uint2korr(head+14))));
if (my_pread(file,(byte*) record, (uint) share->reclength,
(ulong) (uint2korr(head+6)+
((uint2korr(head+14) == 0xffff ?
uint4korr(head+47) : uint2korr(head+14)))),
MYF(MY_NABP)))
record_offset, MYF(MY_NABP)))
goto err; /* purecov: inspected */
if (records == 1)
......@@ -342,6 +343,19 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
outparam->record[1]= outparam->record[0]; // Safety
}
if ((n_length= uint2korr(head+55)))
{
/* Read extra block information */
char *buff;
if (!(buff= alloc_root(&outparam->mem_root, n_length)))
goto err;
if (my_pread(file, buff, n_length, record_offset + share->reclength,
MYF(MY_NABP)))
goto err;
share->connect_string.length= uint2korr(buff);
share->connect_string.str= buff+2;
}
#ifdef HAVE_purify
/*
We need this because when we read var-length rows, we are not updating
......@@ -1350,10 +1364,15 @@ File create_frm(THD *thd, my_string name, const char *db,
ulong length;
char fill[IO_SIZE];
int create_flags= O_RDWR | O_TRUNC;
uint extra_size;
if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
create_flags|= O_EXCL | O_NOFOLLOW;
extra_size= 0;
if (create_info->connect_string.length)
extra_size= 2+create_info->connect_string.length;
#if SIZEOF_OFF_T > 4
/* Fix this when we have new .frm files; Current limit is 4G rows (QQ) */
if (create_info->max_rows > ~(ulong) 0)
......@@ -1381,7 +1400,7 @@ File create_frm(THD *thd, my_string name, const char *db,
fileinfo[4]=1;
int2store(fileinfo+6,IO_SIZE); /* Next block starts here */
key_length=keys*(7+NAME_LEN+MAX_REF_PARTS*9)+16;
length=(ulong) next_io_size((ulong) (IO_SIZE+key_length+reclength));
length= next_io_size((ulong) (IO_SIZE+key_length+reclength+extra_size));
int4store(fileinfo+10,length);
tmp_key_length= (key_length < 0xffff) ? key_length : 0xffff;
int2store(fileinfo+14,tmp_key_length);
......@@ -1403,6 +1422,7 @@ File create_frm(THD *thd, my_string name, const char *db,
int4store(fileinfo+47, key_length);
tmp= MYSQL_VERSION_ID; // Store to avoid warning from int4store
int4store(fileinfo+51, tmp);
int2store(fileinfo+55, extra_size);
bzero(fill,IO_SIZE);
for (; length > IO_SIZE ; length-= IO_SIZE)
{
......
......@@ -126,6 +126,7 @@ typedef struct st_table_share
const char *db; /* Pointer to db */
const char *table_name; /* Table name (for open) */
const char *path; /* Path to .frm file (from datadir) */
LEX_STRING connect_string;
key_map keys_in_use; /* Keys in use for table */
key_map keys_for_keyread;
ulong avg_row_length; /* create information */
......
......@@ -149,6 +149,15 @@ bool mysql_create_frm(THD *thd, my_string file_name,
if (make_empty_rec(thd,file,create_info->db_type,create_info->table_options,
create_fields,reclength, data_offset))
goto err;
if (create_info->connect_string.length)
{
char buff[2];
int2store(buff,create_info->connect_string.length);
if (my_write(file, buff, sizeof(buff), MYF(MY_NABP)) ||
my_write(file, create_info->connect_string.str,
create_info->connect_string.length, MYF(MY_NABP)))
goto err;
}
VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0)));
if (my_write(file,(byte*) forminfo,288,MYF_RW) ||
......
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