Commit 2b1a8acd authored by unknown's avatar unknown

This changeset contains changes approved in code review by

Konstja and Georg, change sets 1.1806, 1.1805. These changes has been successfully 
tested on both my own workstation (Suse 9.0) and production.mysql.com.


mysql-test/r/federated.result:
  new test results for error handling tests.
mysql-test/t/federated.test:
  new error handling tests
sql/ha_federated.cc:
  - check_foreign_data source added
  - table names now enclosed in '`' to allow for '%' or other characters
  - better error handling
  - mysql_init now checked to see if it returns true/false, error out if false (Georg)
BitKeeper/etc/logging_ok:
  Logging to logging@openlogging.org accepted
parent 6950d57f
......@@ -182,6 +182,7 @@ ndbdev@shark.
nick@mysql.com
nick@nick.leippe.com
papa@gbichot.local
patg@krsna.
patg@krsna.patg.net
patg@patrick-galbraiths-computer.local
patg@pc248.lfp.kcls.org
......
......@@ -8,6 +8,120 @@ stop slave;
DROP DATABASE IF EXISTS federated;
CREATE DATABASE federated;
CREATE TABLE federated.t1 (
`id` int(20) NOT NULL,
`name` varchar(32) NOT NULL default ''
)
DEFAULT CHARSET=latin1;
DROP DATABASE IF EXISTS federated;
CREATE DATABASE federated;
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:@/too/many/items/federated/t1';
ERROR HY000: Can't create table 'this connection string is not in the correct format!
' (errno: 0)
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';
ERROR HY000: Can't create table 'this connection string is not in the correct format!
' (errno: 0)
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';
ERROR HY000: Error running query on master: foreign table 't3' does not 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';
ERROR 08S01: Error connecting to master: unable to connect to database 'federated' on host '127.0.0.1 as user 'user' !
DROP TABLE IF EXISTS federated.t1;
Warnings:
Note 1051 Unknown table 't1'
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/t1';
INSERT INTO federated.t1 (id, name) VALUES (1, 'foo');
INSERT INTO federated.t1 (id, name) VALUES (2, 'fee');
SELECT * FROM federated.t1;
id name
1 foo
2 fee
DELETE FROM federated.t1;
DROP TABLE federated.t1;
DROP TABLE IF EXISTS federated.t2;
Warnings:
Note 1051 Unknown table 't2'
CREATE TABLE federated.t2 (
`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/t1';
INSERT INTO federated.t2 (id, name) VALUES (1, 'foo');
INSERT INTO federated.t2 (id, name) VALUES (2, 'fee');
SELECT * FROM federated.t2;
id name
1 foo
2 fee
DROP TABLE federated.t2;
DROP TABLE IF EXISTS federated.t1;
DROP TABLE IF EXISTS federated.`t1%`;
Warnings:
Note 1051 Unknown table 't1%'
CREATE TABLE federated.`t1%` (
`id` int(20) NOT NULL,
`name` varchar(32) NOT NULL default ''
)
DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS federated.t1;
Warnings:
Note 1051 Unknown table 't1'
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/t1%';
INSERT INTO federated.t1 (id, name) VALUES (1, 'foo');
INSERT INTO federated.t1 (id, name) VALUES (2, 'fee');
SELECT * FROM federated.t1;
id name
1 foo
2 fee
DELETE FROM federated.t1;
DROP TABLE IF EXISTS federated.t1;
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:9308/federated/t1%';
INSERT INTO federated.`t1%` (id, name) VALUES (1, 'foo');
INSERT INTO federated.`t1%` (id, name) VALUES (2, 'fee');
SELECT * FROM federated.`t1%`;
id name
1 foo
2 fee
DELETE FROM federated.`t1%`;
DROP TABLE IF EXISTS federated.`t1%`;
DROP TABLE IF EXISTS federated.`t1%`;
DROP TABLE IF EXISTS federated.t1;
Warnings:
Note 1051 Unknown table 't1'
CREATE TABLE federated.t1 (
`id` int(20) NOT NULL auto_increment,
`name` varchar(32) NOT NULL default '',
`other` int(20) NOT NULL default '0',
......@@ -16,8 +130,6 @@ PRIMARY KEY (`id`),
KEY `name` (`name`),
KEY `other_key` (`other`))
DEFAULT CHARSET=latin1;
DROP DATABASE IF EXISTS federated;
CREATE DATABASE federated;
CREATE TABLE federated.t1 (
`id` int(20) NOT NULL auto_increment,
`name` varchar(32) NOT NULL default '',
......
......@@ -14,7 +14,136 @@ DROP DATABASE IF EXISTS federated;
--enable_warnings
CREATE DATABASE federated;
CREATE TABLE federated.t1 (
`id` int(20) NOT NULL,
`name` varchar(32) NOT NULL default ''
)
DEFAULT CHARSET=latin1;
connection master;
--disable_warnings
DROP DATABASE IF EXISTS federated;
--enable_warnings
CREATE DATABASE federated;
# test too many items (malformed) in the comment string url
--error 1005
eval 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:@/too/many/items/federated/t1';
# test not enough items (malformed) in the comment string url
--error 1005
eval 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';
# test non-existant table
--replace_result $SLAVE_MYPORT SLAVE_PORT
--error 1219
eval 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_MYPORT/federated/t3';
# test bad user/password
--replace_result $SLAVE_MYPORT SLAVE_PORT
--error 1218
eval 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_MYPORT/federated/t1';
DROP TABLE IF EXISTS federated.t1;
# # correct connection, same named tables
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval 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_MYPORT/federated/t1';
INSERT INTO federated.t1 (id, name) VALUES (1, 'foo');
INSERT INTO federated.t1 (id, name) VALUES (2, 'fee');
SELECT * FROM federated.t1;
DELETE FROM federated.t1;
DROP TABLE federated.t1;
# correct connection, differently named tables
DROP TABLE IF EXISTS federated.t2;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE federated.t2 (
`id` int(20) NOT NULL,
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
COMMENT='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');
SELECT * FROM federated.t2;
DROP TABLE federated.t2;
connection slave;
DROP TABLE IF EXISTS federated.t1;
DROP TABLE IF EXISTS federated.`t1%`;
CREATE TABLE federated.`t1%` (
`id` int(20) NOT NULL,
`name` varchar(32) NOT NULL default ''
)
DEFAULT CHARSET=latin1;
connection master;
DROP TABLE IF EXISTS federated.t1;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval 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_MYPORT/federated/t1%';
INSERT INTO federated.t1 (id, name) VALUES (1, 'foo');
INSERT INTO federated.t1 (id, name) VALUES (2, 'fee');
SELECT * FROM federated.t1;
DELETE FROM federated.t1;
DROP TABLE IF EXISTS federated.t1;
eval 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_MYPORT/federated/t1%';
INSERT INTO federated.`t1%` (id, name) VALUES (1, 'foo');
INSERT INTO federated.`t1%` (id, name) VALUES (2, 'fee');
SELECT * FROM federated.`t1%`;
DELETE FROM federated.`t1%`;
DROP TABLE IF EXISTS federated.`t1%`;
connection slave;
DROP TABLE IF EXISTS federated.`t1%`;
# I wanted to use timestamp, but results will fail if so!!!
DROP TABLE IF EXISTS federated.t1;
CREATE TABLE federated.t1 (
`id` int(20) NOT NULL auto_increment,
`name` varchar(32) NOT NULL default '',
......@@ -25,12 +154,8 @@ CREATE TABLE federated.t1 (
KEY `other_key` (`other`))
DEFAULT CHARSET=latin1;
connection master;
--disable_warnings
DROP DATABASE IF EXISTS federated;
--enable_warnings
CREATE DATABASE federated;
connection master;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE federated.t1 (
`id` int(20) NOT NULL auto_increment,
......@@ -660,33 +785,36 @@ INSERT INTO federated.t1 VALUES (0x0001);
INSERT INTO federated.t1 VALUES (0x0100);
SELECT HEX(a) FROM federated.t1;
# TODO
#
# CREATE TABLE federated.t1
# (a char(20)) charset=cp1251
# ENGINE="FEDERATED" COMMENT="mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1";
#
# connection slave;
# # simple tests for cyrillic, given to me by
# DROP TABLE IF EXISTS 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";
# #
# connection slave;
# DROP TABLE IF EXISTS federated.t1;
# CREATE TABLE federated.t1 (a char(20)) charset=cp1251;
#
# connection master;
# #
# connection master;
# INSERT INTO federated.t1 values (_cp1251'--1');
# INSERT INTO federated.t1 values (_cp1251'--2');
# SELECT * FROM federated.t1;
# SET names cp1251;
# INSERT INTO federated.t1 values ('--3');
# INSERT INTO federated.t1 values ('-Ũ-4');
# SELECT * FROM federated.t1;
# select hex(a) from federated.t1;
# select hex(a) from federated.t1 ORDER BY a desc;
# update federated.t1 SET a='--1' WHERE a='--1';
# SELECT hex(a) from federated.t1;
# SELECT hex(a) from federated.t1 ORDER BY a desc;
# UPDATE federated.t1 SET a='--1' WHERE a='--1';
# SELECT * FROM federated.t1;
# DELETE FROM federated.t1 WHERE a='-Ũ-4';
# SELECT * FROM federated.t1;
# DELETE FROM federated.t1 WHERE a>'-';
# SELECT * FROM federated.t1;
# SET names default;
# DROP TABLE IF EXISTS federated.t1;
#
# DROP TABLE IF EXISTS federated.t1;
#
......
This diff is collapsed.
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