From 9cd9c3cf16697d203eb822930ce9497cafdacfde Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Fri, 4 Oct 2024 10:13:10 +0200 Subject: [PATCH 01/13] fix grant5 test to return to the original database. --- mysql-test/main/grant5.result | 1 + mysql-test/main/grant5.test | 1 + 2 files changed, 2 insertions(+) diff --git a/mysql-test/main/grant5.result b/mysql-test/main/grant5.result index c3a4baad259..9407c17f52e 100644 --- a/mysql-test/main/grant5.result +++ b/mysql-test/main/grant5.result @@ -38,6 +38,7 @@ connection default; disconnect u1; drop user u1@localhost; drop database mysqltest1; +use test; # # MDEV-22313: Neither SHOW CREATE USER nor SHOW GRANTS prints a user's default role # diff --git a/mysql-test/main/grant5.test b/mysql-test/main/grant5.test index 49e0ab1abf1..a7b82f454dc 100644 --- a/mysql-test/main/grant5.test +++ b/mysql-test/main/grant5.test @@ -50,6 +50,7 @@ connection default; disconnect u1; drop user u1@localhost; drop database mysqltest1; +use test; --echo # --echo # MDEV-22313: Neither SHOW CREATE USER nor SHOW GRANTS prints a user's default role From cc59fbfffa63fe3cb5846f92231bd7f0448a29b3 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Fri, 4 Oct 2024 09:28:46 +0200 Subject: [PATCH 02/13] MDEV-18151 Skipped error returning for GRANT/SET PASSWORD Make error issueing for GRANT and SET PASSWORD the same. Report errors wich were skipped before. --- mysql-test/main/grant5.result | 10 ++++++++- mysql-test/main/grant5.test | 16 +++++++++++++- mysql-test/main/grant_plugin.result | 17 +++++++++++++++ mysql-test/main/grant_plugin.test | 24 +++++++++++++++++++++ mysql-test/main/plugin_auth.test | 2 +- mysql-test/suite/plugins/r/multiauth.result | 1 + mysql-test/suite/plugins/t/multiauth.test | 1 + sql/sql_acl.cc | 20 ++++++++++++++--- 8 files changed, 85 insertions(+), 6 deletions(-) create mode 100644 mysql-test/main/grant_plugin.result create mode 100644 mysql-test/main/grant_plugin.test diff --git a/mysql-test/main/grant5.result b/mysql-test/main/grant5.result index 9407c17f52e..817a58e6ec2 100644 --- a/mysql-test/main/grant5.result +++ b/mysql-test/main/grant5.result @@ -461,6 +461,14 @@ create table mysql.host (host char(60) binary default '' not null, db char(64) b insert mysql.host values('10.5.0.0/255.255.0.0','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','N'); flush privileges; drop table mysql.host; -# # End of 10.4 tests # +# MDEV-18151: Skipped error returning for GRANT/SET PASSWORD +# +CREATE USER foo@localhost; +GRANT FILE ON *.* TO foo@localhost IDENTIFIED VIA not_installed_plugin; +ERROR HY000: Plugin 'not_installed_plugin' is not loaded +DROP USER foo@localhost; +CREATE USER foo@localhost IDENTIFIED VIA not_installed_plugin; +ERROR HY000: Plugin 'not_installed_plugin' is not loaded +# End of 10.5 tests diff --git a/mysql-test/main/grant5.test b/mysql-test/main/grant5.test index a7b82f454dc..48cc3087ffc 100644 --- a/mysql-test/main/grant5.test +++ b/mysql-test/main/grant5.test @@ -419,6 +419,20 @@ insert mysql.host values('10.5.0.0/255.255.0.0','','Y','Y','Y','Y','Y','Y','Y',' flush privileges; drop table mysql.host; ---echo # --echo # End of 10.4 tests + --echo # +--echo # MDEV-18151: Skipped error returning for GRANT/SET PASSWORD +--echo # + +CREATE USER foo@localhost; +--error ER_PLUGIN_IS_NOT_LOADED +GRANT FILE ON *.* TO foo@localhost IDENTIFIED VIA not_installed_plugin; + +# Cleanup +DROP USER foo@localhost; + +--error ER_PLUGIN_IS_NOT_LOADED +CREATE USER foo@localhost IDENTIFIED VIA not_installed_plugin; + +--echo # End of 10.5 tests diff --git a/mysql-test/main/grant_plugin.result b/mysql-test/main/grant_plugin.result new file mode 100644 index 00000000000..bf5b42b28b6 --- /dev/null +++ b/mysql-test/main/grant_plugin.result @@ -0,0 +1,17 @@ +# +# MDEV-18151: Skipped error returning for GRANT/SET PASSWORD +# +install soname 'auth_0x0100'; +CREATE USER foo@localhost IDENTIFIED VIA auth_0x0100; +uninstall plugin auth_0x0100; +select Priv from mysql.global_priv where User = "foo" and host="localhost" +into @priv; +Warnings: +Warning 1287 ' INTO FROM...' instead +SET PASSWORD FOR foo@localhost = "1111"; +ERROR HY000: Plugin 'auth_0x0100' is not loaded +select Priv = @priv as "Nothing changed" from mysql.global_priv where User = "foo" and host="localhost"; +Nothing changed +1 +DROP USER foo@localhost; +# End of 10.5 tests diff --git a/mysql-test/main/grant_plugin.test b/mysql-test/main/grant_plugin.test new file mode 100644 index 00000000000..610176b0ce7 --- /dev/null +++ b/mysql-test/main/grant_plugin.test @@ -0,0 +1,24 @@ + +--source include/not_embedded.inc + +if (!$AUTH_0X0100_SO) { + skip No auth_0x0100 plugin; +} + +--echo # +--echo # MDEV-18151: Skipped error returning for GRANT/SET PASSWORD +--echo # + +install soname 'auth_0x0100'; +CREATE USER foo@localhost IDENTIFIED VIA auth_0x0100; +uninstall plugin auth_0x0100; + +select Priv from mysql.global_priv where User = "foo" and host="localhost" +into @priv; +--error ER_PLUGIN_IS_NOT_LOADED +SET PASSWORD FOR foo@localhost = "1111"; +select Priv = @priv as "Nothing changed" from mysql.global_priv where User = "foo" and host="localhost"; + +DROP USER foo@localhost; + +--echo # End of 10.5 tests diff --git a/mysql-test/main/plugin_auth.test b/mysql-test/main/plugin_auth.test index 6912462066c..54d4b6637cb 100644 --- a/mysql-test/main/plugin_auth.test +++ b/mysql-test/main/plugin_auth.test @@ -31,7 +31,7 @@ connect(plug_con,localhost,plug,plug_dest); select USER(),CURRENT_USER(); --echo ## test SET PASSWORD -#--error ER_SET_PASSWORD_AUTH_PLUGIN +# here we set for native password plugin SET PASSWORD = PASSWORD('plug_dest'); connection default; diff --git a/mysql-test/suite/plugins/r/multiauth.result b/mysql-test/suite/plugins/r/multiauth.result index d1ecd600d84..07238b0940d 100644 --- a/mysql-test/suite/plugins/r/multiauth.result +++ b/mysql-test/suite/plugins/r/multiauth.result @@ -139,6 +139,7 @@ show create user mysqltest1; CREATE USER for mysqltest1@% CREATE USER `mysqltest1`@`%` IDENTIFIED VIA unix_socket OR mysql_native_password USING '*BFE3F4604CFD21E6595080A261D92EF0183B5971' set password for mysqltest1 = password('foobar'); +ERROR HY000: SET PASSWORD is ignored for users authenticating via unix_socket plugin show create user mysqltest1; CREATE USER for mysqltest1@% CREATE USER `mysqltest1`@`%` IDENTIFIED VIA unix_socket OR mysql_native_password USING '*9B500343BC52E2911172EB52AE5CF4847604C6E5' diff --git a/mysql-test/suite/plugins/t/multiauth.test b/mysql-test/suite/plugins/t/multiauth.test index 86c98a5d5c3..8f8a093e401 100644 --- a/mysql-test/suite/plugins/t/multiauth.test +++ b/mysql-test/suite/plugins/t/multiauth.test @@ -145,6 +145,7 @@ set password for mysqltest1 = password('foobar'); show create user mysqltest1; alter user mysqltest1 identified via unix_socket OR mysql_native_password as password("some"); show create user mysqltest1; +--error ER_SET_PASSWORD_AUTH_PLUGIN set password for mysqltest1 = password('foobar'); show create user mysqltest1; alter user mysqltest1 identified via unix_socket; diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index d0fa2ff9c1f..cd579be8010 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -2312,11 +2312,10 @@ static int set_user_auth(THD *thd, const LEX_CSTRING &user, mysql_mutex_assert_owner(&acl_cache->lock); + // check for SET PASSWORD if (!plugin) { - push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, - ER_PLUGIN_IS_NOT_LOADED, - ER_THD(thd, ER_PLUGIN_IS_NOT_LOADED), plugin_name); + my_error(ER_PLUGIN_IS_NOT_LOADED, MYF(0), plugin_name); return ER_PLUGIN_IS_NOT_LOADED; } @@ -2370,6 +2369,21 @@ static int set_user_auth(THD *thd, const LEX_CSTRING &user, res= 0; end: + switch(res) + { + case ER_OUTOFMEMORY: // should be reported by my_malloc + case ER_NOT_VALID_PASSWORD: // should be reported by plugin + case ER_PASSWD_LENGTH: // should be reported by plugin + DBUG_ASSERT(thd->is_error()); + /* fall through*/ + case 0: + break; + case ER_SET_PASSWORD_AUTH_PLUGIN: + my_error(res, MYF(0), plugin_name); + break; + default: + DBUG_ASSERT(0); + } if (unlock_plugin) plugin_unlock(thd, plugin); return res; From b138f428ea2d3496a3a5a2212c424f8218547ef1 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Fri, 4 Oct 2024 10:15:35 +0200 Subject: [PATCH 03/13] MDEV-18151 Skipped error returning for GRANT/SET PASSWORD Make message of error not warning. --- mysql-test/main/failed_auth_unixsocket.result | 8 ++++++++ mysql-test/main/failed_auth_unixsocket.test | 14 ++++++++++++++ mysql-test/suite/plugins/r/multiauth.result | 4 ++-- sql/share/errmsg-utf8.txt | 4 ++-- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/mysql-test/main/failed_auth_unixsocket.result b/mysql-test/main/failed_auth_unixsocket.result index 7e8b8fe70b9..084eb2fab64 100644 --- a/mysql-test/main/failed_auth_unixsocket.result +++ b/mysql-test/main/failed_auth_unixsocket.result @@ -8,3 +8,11 @@ ERROR 28000: Access denied for user 'USER'@'localhost' replace mysql.global_priv select * from global_priv_backup; flush privileges; drop table global_priv_backup; +# +# MDEV-18151: Skipped error returning for GRANT/SET PASSWORD +# +CREATE USER foo; +GRANT EXECUTE ON * TO foo IDENTIFIED WITH unix_socket AS PASSWORD('bar'); +ERROR HY000: SET PASSWORD is not applicable for users authenticating via unix_socket plugin +DROP USER foo; +# End of 10.5 tests diff --git a/mysql-test/main/failed_auth_unixsocket.test b/mysql-test/main/failed_auth_unixsocket.test index fe80d947036..5a77e1cdbda 100644 --- a/mysql-test/main/failed_auth_unixsocket.test +++ b/mysql-test/main/failed_auth_unixsocket.test @@ -27,3 +27,17 @@ change_user $USER; replace mysql.global_priv select * from global_priv_backup; flush privileges; drop table global_priv_backup; + + +--echo # +--echo # MDEV-18151: Skipped error returning for GRANT/SET PASSWORD +--echo # + +CREATE USER foo; +--error ER_SET_PASSWORD_AUTH_PLUGIN +GRANT EXECUTE ON * TO foo IDENTIFIED WITH unix_socket AS PASSWORD('bar'); + +# Cleanup +DROP USER foo; + +--echo # End of 10.5 tests diff --git a/mysql-test/suite/plugins/r/multiauth.result b/mysql-test/suite/plugins/r/multiauth.result index 07238b0940d..e002172073e 100644 --- a/mysql-test/suite/plugins/r/multiauth.result +++ b/mysql-test/suite/plugins/r/multiauth.result @@ -139,13 +139,13 @@ show create user mysqltest1; CREATE USER for mysqltest1@% CREATE USER `mysqltest1`@`%` IDENTIFIED VIA unix_socket OR mysql_native_password USING '*BFE3F4604CFD21E6595080A261D92EF0183B5971' set password for mysqltest1 = password('foobar'); -ERROR HY000: SET PASSWORD is ignored for users authenticating via unix_socket plugin +ERROR HY000: SET PASSWORD is not applicable for users authenticating via unix_socket plugin show create user mysqltest1; CREATE USER for mysqltest1@% CREATE USER `mysqltest1`@`%` IDENTIFIED VIA unix_socket OR mysql_native_password USING '*9B500343BC52E2911172EB52AE5CF4847604C6E5' alter user mysqltest1 identified via unix_socket; set password for mysqltest1 = password('bla'); -ERROR HY000: SET PASSWORD is ignored for users authenticating via unix_socket plugin +ERROR HY000: SET PASSWORD is not applicable for users authenticating via unix_socket plugin alter user mysqltest1 identified via mysql_native_password as password("some") or unix_socket; show create user mysqltest1; CREATE USER for mysqltest1@% diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 13642a62c73..96bdb38f335 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -7235,8 +7235,8 @@ ER_ACCESS_DENIED_NO_PASSWORD_ERROR 28000 ukr "Доступ заборонено для користувача: '%s'@'%s'" ER_SET_PASSWORD_AUTH_PLUGIN - chi "通过%s插件验证的用户忽略SET PASSWORD" - eng "SET PASSWORD is ignored for users authenticating via %s plugin" + eng "SET PASSWORD is not applicable for users authenticating via %s plugin" + ukr "SET PASSWORD не можна застосувати для користувачів, що автентифікуються з допомогою плагінy %s" ER_GRANT_PLUGIN_USER_EXISTS chi "由于用户%-.*s已经存在,GRANT IDENTIFIED WITH授权是非法的" From 5777d9f2821011101423209a1e4994939ef44818 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Mon, 14 Oct 2024 02:25:25 +0530 Subject: [PATCH 04/13] MDEV-35116 InnoDB fails to set error index for HA_ERR_NULL_IN_SPATIAL - InnoDB fails to set the index information or index number for the spatial index error HA_ERR_NULL_IN_SPATIAL. row_build_spatial_index_key(): Initialize the tmp_mbr array completely. check_if_supported_inplace_alter(): Fix the spelling mistake of alter --- .../suite/innodb/r/instant_alter.result | 30 +++++++++---------- mysql-test/suite/innodb_gis/r/rtree.result | 14 +++++++++ mysql-test/suite/innodb_gis/t/rtree.test | 16 ++++++++++ storage/innobase/handler/ha_innodb.cc | 1 + storage/innobase/handler/handler0alter.cc | 2 +- storage/innobase/row/row0ins.cc | 28 ++++++++--------- storage/innobase/row/row0merge.cc | 1 + storage/innobase/row/row0row.cc | 2 +- 8 files changed, 62 insertions(+), 32 deletions(-) diff --git a/mysql-test/suite/innodb/r/instant_alter.result b/mysql-test/suite/innodb/r/instant_alter.result index 4a67e04205b..6c319454e4f 100644 --- a/mysql-test/suite/innodb/r/instant_alter.result +++ b/mysql-test/suite/innodb/r/instant_alter.result @@ -552,18 +552,18 @@ ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT; ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE SET GLOBAL innodb_instant_alter_column_allowed = add_last; ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT; -ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT; -ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE SET GLOBAL innodb_instant_alter_column_allowed = add_drop_reorder; ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT; SET GLOBAL innodb_instant_alter_column_allowed = add_last; ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT; -ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT; -ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE ALTER TABLE t1 MODIFY a INT DEFAULT 0, ALGORITHM=INSTANT; -ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE ALTER TABLE t1 MODIFY a INT DEFAULT 0; affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 0 @@ -1486,18 +1486,18 @@ ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT; ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE SET GLOBAL innodb_instant_alter_column_allowed = add_last; ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT; -ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT; -ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE SET GLOBAL innodb_instant_alter_column_allowed = add_drop_reorder; ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT; SET GLOBAL innodb_instant_alter_column_allowed = add_last; ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT; -ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT; -ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE ALTER TABLE t1 MODIFY a INT DEFAULT 0, ALGORITHM=INSTANT; -ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE ALTER TABLE t1 MODIFY a INT DEFAULT 0; affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 0 @@ -2420,18 +2420,18 @@ ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT; ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE SET GLOBAL innodb_instant_alter_column_allowed = add_last; ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT; -ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT; -ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE SET GLOBAL innodb_instant_alter_column_allowed = add_drop_reorder; ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT; SET GLOBAL innodb_instant_alter_column_allowed = add_last; ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT; -ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT; -ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE ALTER TABLE t1 MODIFY a INT DEFAULT 0, ALGORITHM=INSTANT; -ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE ALTER TABLE t1 MODIFY a INT DEFAULT 0; affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 0 diff --git a/mysql-test/suite/innodb_gis/r/rtree.result b/mysql-test/suite/innodb_gis/r/rtree.result index 11451821386..e8bca379c68 100644 --- a/mysql-test/suite/innodb_gis/r/rtree.result +++ b/mysql-test/suite/innodb_gis/r/rtree.result @@ -866,3 +866,17 @@ INSERT INTO `address` VALUES (1,'47 MySakila Drive',NULL,'Alberta',300,'','',0x0 (605,'1325 Fukuyama Street','','Heilongjiang',537,'27107','288241215394',0x00000000010100000017540A70700160401E1C47077F7D4740,'2014-09-25 22:30:44'); COMMIT; DROP TABLE address; +# +# MDEV-35116 InnoDB fails to set error index +# for HA_ERR_NULL_IN_SPATIAL +# +BINLOG ' SOgWTg8BAAAAbgAAAHIAAAAAAAQANS42LjMtbTUtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAABI6BZOEzgNAAgAEgAEBAQEEgAAVgAEGggAAAAICAgCAAAAAAVAYI8='; +CREATE TABLE t1 (i INT, g GEOMETRY NOT NULL, +SPATIAL INDEX (g)) ENGINE=InnoDB; +CREATE TEMPORARY TABLE t2 (PRIMARY KEY(a)) ENGINE=InnoDB +WITH RECURSIVE t(a) AS (VALUES(1),(1)) SELECT * FROM t; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +call mtr.add_suppression("BINLOG_BASE64_EVENT: Could not execute Write_rows_v1 event on table .*"); +BINLOG ' SVtYRxMBAAAAKQAAADQBAAAAABAAAAAAAAAABHRlc3QAAnQxAAEDAAE=SVtYRxcBAAAAIgAAAFYBAAAQABAAAAAAAAEAAf /+ AgAAAA=='; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_gis/t/rtree.test b/mysql-test/suite/innodb_gis/t/rtree.test index 98931e70e62..7cccb56a2d5 100644 --- a/mysql-test/suite/innodb_gis/t/rtree.test +++ b/mysql-test/suite/innodb_gis/t/rtree.test @@ -851,3 +851,19 @@ INSERT INTO `address` VALUES (1,'47 MySakila Drive',NULL,'Alberta',300,'','',0x0 COMMIT; DROP TABLE address; + +--echo # +--echo # MDEV-35116 InnoDB fails to set error index +--echo # for HA_ERR_NULL_IN_SPATIAL +--echo # +BINLOG ' SOgWTg8BAAAAbgAAAHIAAAAAAAQANS42LjMtbTUtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAABI6BZOEzgNAAgAEgAEBAQEEgAAVgAEGggAAAAICAgCAAAAAAVAYI8='; +CREATE TABLE t1 (i INT, g GEOMETRY NOT NULL, + SPATIAL INDEX (g)) ENGINE=InnoDB; +--error ER_DUP_ENTRY +CREATE TEMPORARY TABLE t2 (PRIMARY KEY(a)) ENGINE=InnoDB +WITH RECURSIVE t(a) AS (VALUES(1),(1)) SELECT * FROM t; + +call mtr.add_suppression("BINLOG_BASE64_EVENT: Could not execute Write_rows_v1 event on table .*"); +--error ER_CANT_CREATE_GEOMETRY_OBJECT +BINLOG ' SVtYRxMBAAAAKQAAADQBAAAAABAAAAAAAAAABHRlc3QAAnQxAAEDAAE=SVtYRxcBAAAAIgAAAFYBAAAQABAAAAAAAAEAAf /+ AgAAAA=='; +DROP TABLE t1; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 7fe91cd6c17..f12212c1aeb 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -8140,6 +8140,7 @@ calc_row_difference( to block it. */ if (DATA_GEOMETRY_MTYPE(col_type) && o_len != 0 && n_len == 0) { + trx->error_info = clust_index; return(DB_CANT_CREATE_GEOMETRY_OBJECT); } diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 9053762014d..936333ecba5 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -2108,7 +2108,7 @@ innodb_instant_alter_column_allowed_reason: if ((ha_alter_info->handler_flags & (ALTER_STORED_COLUMN_ORDER | ALTER_DROP_STORED_COLUMN)) || m_prebuilt->table->instant) { - reason_rebuild = "innodb_instant_atler_column_allowed=" + reason_rebuild = "innodb_instant_alter_column_allowed=" "add_last"; goto innodb_instant_alter_column_allowed_reason; } diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index 4f14ccbd7ab..d0b640338e4 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -3434,24 +3434,22 @@ row_ins_spatial_index_entry_set_mbr_field( /** Sets the values of the dtuple fields in entry from the values of appropriate columns in row. -@param[in] index index handler -@param[out] entry index entry to make -@param[in] row row -@return DB_SUCCESS if the set is successful */ +@param[in] node row insert node +@param[in] thr query thread +@retval DB_SUCCESS if the set is successful +@retval DB_CANT_CREATE_GEOMETRY_OBJECT when spatial index fails to +create geometry object */ static dberr_t -row_ins_index_entry_set_vals( - const dict_index_t* index, - dtuple_t* entry, - const dtuple_t* row) +row_ins_index_entry_set_vals(const ins_node_t* node, que_thr_t* thr) { - ulint n_fields; - ulint i; + const dict_index_t* index = node->index; + dtuple_t* entry = *node->entry; + const dtuple_t* row = node->row; ulint num_v = dtuple_get_n_v_fields(entry); + ulint n_fields = dtuple_get_n_fields(entry); - n_fields = dtuple_get_n_fields(entry); - - for (i = 0; i < n_fields + num_v; i++) { + for (ulint i = 0; i < n_fields + num_v; i++) { dict_field_t* ind_field = NULL; dfield_t* field; const dfield_t* row_field; @@ -3521,6 +3519,7 @@ row_ins_index_entry_set_vals( if ((i == 0) && dict_index_is_spatial(index)) { if (!row_field->data || row_field->len < GEO_DATA_HEADER_SIZE) { + thr_get_trx(thr)->error_info = index; return(DB_CANT_CREATE_GEOMETRY_OBJECT); } row_ins_spatial_index_entry_set_mbr_field( @@ -3555,8 +3554,7 @@ row_ins_index_entry_step( ut_ad(dtuple_check_typed(node->row)); - err = row_ins_index_entry_set_vals(node->index, *node->entry, - node->row); + err = row_ins_index_entry_set_vals(node, thr); if (err != DB_SUCCESS) { DBUG_RETURN(err); diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index 9a44bb7d314..14c761e301c 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -2292,6 +2292,7 @@ write_buffers: error. */ if (!row_geo_field_is_valid(row, buf->index)) { err = DB_CANT_CREATE_GEOMETRY_OBJECT; + trx->error_key_num = i; break; } diff --git a/storage/innobase/row/row0row.cc b/storage/innobase/row/row0row.cc index 30622d031ea..ebd6b248721 100644 --- a/storage/innobase/row/row0row.cc +++ b/storage/innobase/row/row0row.cc @@ -162,7 +162,7 @@ static bool row_build_spatial_index_key( write_mbr: if (dlen <= GEO_DATA_HEADER_SIZE) { - for (uint i = 0; i < SPDIMS; i += 2) { + for (uint i = 0; i < 2 * SPDIMS; i += 2) { tmp_mbr[i] = DBL_MAX; tmp_mbr[i + 1] = -DBL_MAX; } From d5f5062a48d22d7ca3444831b48c5e5328a8acef Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 14 Oct 2024 13:09:20 +0200 Subject: [PATCH 05/13] our release packages on rhel8 use bundled readline for historical reasons, but we keep doing it for compatibility --- cmake/build_configurations/mysql_release.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index 03eda11db54..8f306548dc9 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -117,6 +117,9 @@ ELSEIF(RPM) SET(WITH_ROCKSDB_LZ4 OFF CACHE STRING "") SET(GRN_WITH_LZ4 no CACHE STRING "") ENDIF() + IF(RPM MATCHES "rhel8") + SET(WITH_READLINE ON CACHE BOOL "") + ENDIF() ELSEIF(DEB) SET(WITH_SSL system CACHE STRING "") SET(WITH_ZLIB system CACHE STRING "") From 8a52639ede533affdc35272894819daff581e7c8 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 7 Aug 2024 13:27:44 +1000 Subject: [PATCH 06/13] MDEV-34716 spider: some trivial cleanups and documentation - document tmp_share, which are temporary spider shares with only one link (no ha) - simplify spider_get_sys_tables_connect_info() where link_idx is always 0 --- storage/spider/spd_copy_tables.cc | 1 + storage/spider/spd_include.h | 3 + storage/spider/spd_sys_table.cc | 192 +++++++++++++++--------------- storage/spider/spd_table.cc | 10 +- storage/spider/spd_trx.cc | 1 + 5 files changed, 106 insertions(+), 101 deletions(-) diff --git a/storage/spider/spd_copy_tables.cc b/storage/spider/spd_copy_tables.cc index d76c8e425ec..4c361df0562 100644 --- a/storage/spider/spd_copy_tables.cc +++ b/storage/spider/spd_copy_tables.cc @@ -249,6 +249,7 @@ int spider_udf_get_copy_tgt_tables( char table_key[MAX_KEY_LENGTH]; SPIDER_COPY_TABLE_CONN *table_conn = NULL, *src_table_conn_prev = NULL, *dst_table_conn_prev = NULL; + /* This share has only one link. */ SPIDER_SHARE *tmp_share; char **tmp_connect_info; uint *tmp_connect_info_length; diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h index 473bdc2c416..7371c6da6f3 100644 --- a/storage/spider/spd_include.h +++ b/storage/spider/spd_include.h @@ -1440,6 +1440,7 @@ typedef struct st_spider_mon_table_result typedef struct st_spider_table_mon { + /* This share has only one link. */ SPIDER_SHARE *share; uint32 server_id; st_spider_table_mon_list *parent; @@ -1466,6 +1467,7 @@ typedef struct st_spider_table_mon_list SPIDER_TABLE_MON *current; volatile int mon_status; + /* This share has only one link */ SPIDER_SHARE *share; pthread_mutex_t caller_mutex; @@ -1479,6 +1481,7 @@ typedef struct st_spider_table_mon_list typedef struct st_spider_copy_table_conn { + /* This share has only one link. */ SPIDER_SHARE *share; int link_idx; SPIDER_CONN *conn; diff --git a/storage/spider/spd_sys_table.cc b/storage/spider/spd_sys_table.cc index 9e39ffc8d90..d65a9f72f8c 100644 --- a/storage/spider/spd_sys_table.cc +++ b/storage/spider/spd_sys_table.cc @@ -2095,9 +2095,7 @@ int spider_get_sys_tables_connect_info( ) { char *ptr; int error_num = 0; - const int link_idx= 0; DBUG_ENTER("spider_get_sys_tables_connect_info"); - DBUG_PRINT("info",("spider link_idx:%d", link_idx)); if ((ptr = get_field(mem_root, table->field[SPIDER_TABLES_PRIORITY_POS]))) { share->priority = my_strtoll10(ptr, (char**) NULL, &error_num); @@ -2108,223 +2106,223 @@ int spider_get_sys_tables_connect_info( !table->field[SPIDER_TABLES_SERVER_POS]->is_null() && (ptr = get_field(mem_root, table->field[SPIDER_TABLES_SERVER_POS])) ) { - share->server_names_lengths[link_idx] = strlen(ptr); - share->server_names[link_idx] = - spider_create_string(ptr, share->server_names_lengths[link_idx]); + share->server_names_lengths[0] = strlen(ptr); + share->server_names[0] = + spider_create_string(ptr, share->server_names_lengths[0]); DBUG_PRINT("info",("spider server_name:%s", - share->server_names[link_idx])); + share->server_names[0])); } else { - share->server_names_lengths[link_idx] = 0; - share->server_names[link_idx] = NULL; + share->server_names_lengths[0] = 0; + share->server_names[0] = NULL; DBUG_PRINT("info",("spider server_name is NULL")); } if ( !table->field[SPIDER_TABLES_SCHEME_POS]->is_null() && (ptr = get_field(mem_root, table->field[SPIDER_TABLES_SCHEME_POS])) ) { - share->tgt_wrappers_lengths[link_idx] = strlen(ptr); - share->tgt_wrappers[link_idx] = - spider_create_string(ptr, share->tgt_wrappers_lengths[link_idx]); + share->tgt_wrappers_lengths[0] = strlen(ptr); + share->tgt_wrappers[0] = + spider_create_string(ptr, share->tgt_wrappers_lengths[0]); DBUG_PRINT("info",("spider tgt_wrapper:%s", - share->tgt_wrappers[link_idx])); + share->tgt_wrappers[0])); } else { - share->tgt_wrappers_lengths[link_idx] = 0; - share->tgt_wrappers[link_idx] = NULL; + share->tgt_wrappers_lengths[0] = 0; + share->tgt_wrappers[0] = NULL; DBUG_PRINT("info",("spider tgt_wrapper is NULL")); } if ( !table->field[SPIDER_TABLES_HOST_POS]->is_null() && (ptr = get_field(mem_root, table->field[SPIDER_TABLES_HOST_POS])) ) { - share->tgt_hosts_lengths[link_idx] = strlen(ptr); - share->tgt_hosts[link_idx] = - spider_create_string(ptr, share->tgt_hosts_lengths[link_idx]); + share->tgt_hosts_lengths[0] = strlen(ptr); + share->tgt_hosts[0] = + spider_create_string(ptr, share->tgt_hosts_lengths[0]); DBUG_PRINT("info",("spider tgt_host:%s", - share->tgt_hosts[link_idx])); + share->tgt_hosts[0])); } else { - share->tgt_hosts_lengths[link_idx] = 0; - share->tgt_hosts[link_idx] = NULL; + share->tgt_hosts_lengths[0] = 0; + share->tgt_hosts[0] = NULL; DBUG_PRINT("info",("spider tgt_host is NULL")); } if ( !table->field[SPIDER_TABLES_PORT_POS]->is_null() && (ptr = get_field(mem_root, table->field[SPIDER_TABLES_PORT_POS])) ) { - share->tgt_ports[link_idx] = atol(ptr); + share->tgt_ports[0] = atol(ptr); } else { - share->tgt_ports[link_idx] = -1; + share->tgt_ports[0] = -1; } - DBUG_PRINT("info",("spider port:%ld", share->tgt_ports[link_idx])); + DBUG_PRINT("info",("spider port:%ld", share->tgt_ports[0])); if ( !table->field[SPIDER_TABLES_SOCKET_POS]->is_null() && (ptr = get_field(mem_root, table->field[SPIDER_TABLES_SOCKET_POS])) ) { - share->tgt_sockets_lengths[link_idx] = strlen(ptr); - share->tgt_sockets[link_idx] = - spider_create_string(ptr, share->tgt_sockets_lengths[link_idx]); + share->tgt_sockets_lengths[0] = strlen(ptr); + share->tgt_sockets[0] = + spider_create_string(ptr, share->tgt_sockets_lengths[0]); } else { - share->tgt_sockets_lengths[link_idx] = 0; - share->tgt_sockets[link_idx] = NULL; + share->tgt_sockets_lengths[0] = 0; + share->tgt_sockets[0] = NULL; } if ( !table->field[SPIDER_TABLES_USERNAME_POS]->is_null() && (ptr = get_field(mem_root, table->field[SPIDER_TABLES_USERNAME_POS])) ) { - share->tgt_usernames_lengths[link_idx] = strlen(ptr); - share->tgt_usernames[link_idx] = - spider_create_string(ptr, share->tgt_usernames_lengths[link_idx]); + share->tgt_usernames_lengths[0] = strlen(ptr); + share->tgt_usernames[0] = + spider_create_string(ptr, share->tgt_usernames_lengths[0]); } else { - share->tgt_usernames_lengths[link_idx] = 0; - share->tgt_usernames[link_idx] = NULL; + share->tgt_usernames_lengths[0] = 0; + share->tgt_usernames[0] = NULL; } if ( !table->field[SPIDER_TABLES_PASSWORD_POS]->is_null() && (ptr = get_field(mem_root, table->field[SPIDER_TABLES_PASSWORD_POS])) ) { - share->tgt_passwords_lengths[link_idx] = strlen(ptr); - share->tgt_passwords[link_idx] = - spider_create_string(ptr, share->tgt_passwords_lengths[link_idx]); + share->tgt_passwords_lengths[0] = strlen(ptr); + share->tgt_passwords[0] = + spider_create_string(ptr, share->tgt_passwords_lengths[0]); } else { - share->tgt_passwords_lengths[link_idx] = 0; - share->tgt_passwords[link_idx] = NULL; + share->tgt_passwords_lengths[0] = 0; + share->tgt_passwords[0] = NULL; } if ( !table->field[SPIDER_TABLES_SSL_CA_POS]->is_null() && (ptr = get_field(mem_root, table->field[SPIDER_TABLES_SSL_CA_POS])) ) { - share->tgt_ssl_cas_lengths[link_idx] = strlen(ptr); - share->tgt_ssl_cas[link_idx] = - spider_create_string(ptr, share->tgt_ssl_cas_lengths[link_idx]); + share->tgt_ssl_cas_lengths[0] = strlen(ptr); + share->tgt_ssl_cas[0] = + spider_create_string(ptr, share->tgt_ssl_cas_lengths[0]); } else { - share->tgt_ssl_cas_lengths[link_idx] = 0; - share->tgt_ssl_cas[link_idx] = NULL; + share->tgt_ssl_cas_lengths[0] = 0; + share->tgt_ssl_cas[0] = NULL; } if ( !table->field[SPIDER_TABLES_SSL_CAPATH_POS]->is_null() && (ptr = get_field(mem_root, table->field[SPIDER_TABLES_SSL_CAPATH_POS])) ) { - share->tgt_ssl_capaths_lengths[link_idx] = strlen(ptr); - share->tgt_ssl_capaths[link_idx] = - spider_create_string(ptr, share->tgt_ssl_capaths_lengths[link_idx]); + share->tgt_ssl_capaths_lengths[0] = strlen(ptr); + share->tgt_ssl_capaths[0] = + spider_create_string(ptr, share->tgt_ssl_capaths_lengths[0]); } else { - share->tgt_ssl_capaths_lengths[link_idx] = 0; - share->tgt_ssl_capaths[link_idx] = NULL; + share->tgt_ssl_capaths_lengths[0] = 0; + share->tgt_ssl_capaths[0] = NULL; } if ( !table->field[SPIDER_TABLES_SSL_CERT_POS]->is_null() && (ptr = get_field(mem_root, table->field[SPIDER_TABLES_SSL_CERT_POS])) ) { - share->tgt_ssl_certs_lengths[link_idx] = strlen(ptr); - share->tgt_ssl_certs[link_idx] = - spider_create_string(ptr, share->tgt_ssl_certs_lengths[link_idx]); + share->tgt_ssl_certs_lengths[0] = strlen(ptr); + share->tgt_ssl_certs[0] = + spider_create_string(ptr, share->tgt_ssl_certs_lengths[0]); } else { - share->tgt_ssl_certs_lengths[link_idx] = 0; - share->tgt_ssl_certs[link_idx] = NULL; + share->tgt_ssl_certs_lengths[0] = 0; + share->tgt_ssl_certs[0] = NULL; } if ( !table->field[SPIDER_TABLES_SSL_CIPHER_POS]->is_null() && (ptr = get_field(mem_root, table->field[SPIDER_TABLES_SSL_CIPHER_POS])) ) { - share->tgt_ssl_ciphers_lengths[link_idx] = strlen(ptr); - share->tgt_ssl_ciphers[link_idx] = - spider_create_string(ptr, share->tgt_ssl_ciphers_lengths[link_idx]); + share->tgt_ssl_ciphers_lengths[0] = strlen(ptr); + share->tgt_ssl_ciphers[0] = + spider_create_string(ptr, share->tgt_ssl_ciphers_lengths[0]); } else { - share->tgt_ssl_ciphers_lengths[link_idx] = 0; - share->tgt_ssl_ciphers[link_idx] = NULL; + share->tgt_ssl_ciphers_lengths[0] = 0; + share->tgt_ssl_ciphers[0] = NULL; } if ( !table->field[SPIDER_TABLES_SSL_KEY_POS]->is_null() && (ptr = get_field(mem_root, table->field[SPIDER_TABLES_SSL_KEY_POS])) ) { - share->tgt_ssl_keys_lengths[link_idx] = strlen(ptr); - share->tgt_ssl_keys[link_idx] = - spider_create_string(ptr, share->tgt_ssl_keys_lengths[link_idx]); + share->tgt_ssl_keys_lengths[0] = strlen(ptr); + share->tgt_ssl_keys[0] = + spider_create_string(ptr, share->tgt_ssl_keys_lengths[0]); } else { - share->tgt_ssl_keys_lengths[link_idx] = 0; - share->tgt_ssl_keys[link_idx] = NULL; + share->tgt_ssl_keys_lengths[0] = 0; + share->tgt_ssl_keys[0] = NULL; } if ( !table->field[SPIDER_TABLES_SSL_VERIFY_SERVER_CERT_POS]->is_null() && (ptr = get_field(mem_root, table->field[SPIDER_TABLES_SSL_VERIFY_SERVER_CERT_POS])) ) { - share->tgt_ssl_vscs[link_idx] = atol(ptr); + share->tgt_ssl_vscs[0] = atol(ptr); } else - share->tgt_ssl_vscs[link_idx] = -1; + share->tgt_ssl_vscs[0] = -1; if ( !table->field[SPIDER_TABLES_MONITORING_BINLOG_POS_AT_FAILING_POS]-> is_null() && (ptr = get_field(mem_root, table-> field[SPIDER_TABLES_MONITORING_BINLOG_POS_AT_FAILING_POS])) ) { - share->monitoring_binlog_pos_at_failing[link_idx] = atol(ptr); + share->monitoring_binlog_pos_at_failing[0] = atol(ptr); } else - share->monitoring_binlog_pos_at_failing[link_idx] = 0; + share->monitoring_binlog_pos_at_failing[0] = 0; if ( !table->field[SPIDER_TABLES_DEFAULT_FILE_POS]->is_null() && (ptr = get_field(mem_root, table->field[SPIDER_TABLES_DEFAULT_FILE_POS])) ) { - share->tgt_default_files_lengths[link_idx] = strlen(ptr); - share->tgt_default_files[link_idx] = - spider_create_string(ptr, share->tgt_default_files_lengths[link_idx]); + share->tgt_default_files_lengths[0] = strlen(ptr); + share->tgt_default_files[0] = + spider_create_string(ptr, share->tgt_default_files_lengths[0]); } else { - share->tgt_default_files_lengths[link_idx] = 0; - share->tgt_default_files[link_idx] = NULL; + share->tgt_default_files_lengths[0] = 0; + share->tgt_default_files[0] = NULL; } if ( !table->field[SPIDER_TABLES_DEFAULT_GROUP_POS]->is_null() && (ptr = get_field(mem_root, table->field[SPIDER_TABLES_DEFAULT_GROUP_POS])) ) { - share->tgt_default_groups_lengths[link_idx] = strlen(ptr); - share->tgt_default_groups[link_idx] = - spider_create_string(ptr, share->tgt_default_groups_lengths[link_idx]); + share->tgt_default_groups_lengths[0] = strlen(ptr); + share->tgt_default_groups[0] = + spider_create_string(ptr, share->tgt_default_groups_lengths[0]); } else { - share->tgt_default_groups_lengths[link_idx] = 0; - share->tgt_default_groups[link_idx] = NULL; + share->tgt_default_groups_lengths[0] = 0; + share->tgt_default_groups[0] = NULL; } if ( !table->field[SPIDER_TABLES_DSN_POS]->is_null() && (ptr = get_field(mem_root, table->field[SPIDER_TABLES_DSN_POS])) ) { - share->tgt_dsns_lengths[link_idx] = strlen(ptr); - share->tgt_dsns[link_idx] = - spider_create_string(ptr, share->tgt_dsns_lengths[link_idx]); + share->tgt_dsns_lengths[0] = strlen(ptr); + share->tgt_dsns[0] = + spider_create_string(ptr, share->tgt_dsns_lengths[0]); } else { - share->tgt_dsns_lengths[link_idx] = 0; - share->tgt_dsns[link_idx] = NULL; + share->tgt_dsns_lengths[0] = 0; + share->tgt_dsns[0] = NULL; } if ( !table->field[SPIDER_TABLES_TGT_DB_NAME_POS]->is_null() && (ptr = get_field(mem_root, table->field[SPIDER_TABLES_TGT_DB_NAME_POS])) ) { - share->tgt_dbs_lengths[link_idx] = strlen(ptr); - share->tgt_dbs[link_idx] = - spider_create_string(ptr, share->tgt_dbs_lengths[link_idx]); + share->tgt_dbs_lengths[0] = strlen(ptr); + share->tgt_dbs[0] = + spider_create_string(ptr, share->tgt_dbs_lengths[0]); } else { - share->tgt_dbs_lengths[link_idx] = 0; - share->tgt_dbs[link_idx] = NULL; + share->tgt_dbs_lengths[0] = 0; + share->tgt_dbs[0] = NULL; } if ( !table->field[SPIDER_TABLES_TGT_TABLE_NAME_POS]->is_null() && (ptr = get_field(mem_root, table->field[SPIDER_TABLES_TGT_TABLE_NAME_POS])) ) { - share->tgt_table_names_lengths[link_idx] = strlen(ptr); - share->tgt_table_names[link_idx] = - spider_create_string(ptr, share->tgt_table_names_lengths[link_idx]); + share->tgt_table_names_lengths[0] = strlen(ptr); + share->tgt_table_names[0] = + spider_create_string(ptr, share->tgt_table_names_lengths[0]); } else { - share->tgt_table_names_lengths[link_idx] = 0; - share->tgt_table_names[link_idx] = NULL; + share->tgt_table_names_lengths[0] = 0; + share->tgt_table_names[0] = NULL; } if ( !table->field[SPIDER_TABLES_STATIC_LINK_ID_POS]->is_null() && (ptr = get_field(mem_root, table->field[SPIDER_TABLES_STATIC_LINK_ID_POS])) ) { - share->static_link_ids_lengths[link_idx] = strlen(ptr); - share->static_link_ids[link_idx] = - spider_create_string(ptr, share->static_link_ids_lengths[link_idx]); + share->static_link_ids_lengths[0] = strlen(ptr); + share->static_link_ids[0] = + spider_create_string(ptr, share->static_link_ids_lengths[0]); } else { - share->static_link_ids_lengths[link_idx] = 0; - share->static_link_ids[link_idx] = NULL; + share->static_link_ids_lengths[0] = 0; + share->static_link_ids[0] = NULL; } DBUG_RETURN(error_num); } diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index d41a957d436..36bac44f150 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -857,6 +857,7 @@ int spider_free_share_alloc( DBUG_RETURN(0); } +/* Free a tmp_share, which has only one link */ void spider_free_tmp_share_alloc( SPIDER_SHARE *share ) { @@ -5610,6 +5611,7 @@ int spider_open_all_tables( THD *thd = trx->thd; TABLE *table_tables; int error_num, *need_mon, mon_val; + /* This share has only one link */ SPIDER_SHARE tmp_share; char *db_name, *table_name; uint db_name_length, table_name_length; @@ -5696,9 +5698,6 @@ int spider_open_all_tables( table_name_length )) || (error_num = spider_create_conn_keys(&tmp_share)) || -/* - (error_num = spider_db_create_table_names_str(&tmp_share)) || -*/ (error_num = spider_create_tmp_dbton_share(&tmp_share)) ) { spider_sys_index_end(table_tables); @@ -7170,7 +7169,10 @@ bool spider_check_pk_update( DBUG_RETURN(FALSE); } - +/* + Set fields of a tmp share which has only one link. For use in + monitoring, spider_copy_tables udf etc. +*/ void spider_set_tmp_share_pointer( SPIDER_SHARE *tmp_share, char **tmp_connect_info, diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc index 305d8fc7327..694b75dfbce 100644 --- a/storage/spider/spd_trx.cc +++ b/storage/spider/spd_trx.cc @@ -2774,6 +2774,7 @@ int spider_internal_xa_rollback_by_xid( int error_num; char xa_key[MAX_KEY_LENGTH]; char xa_member_key[MAX_KEY_LENGTH]; + /* This share has only one link */ SPIDER_SHARE tmp_share; char *tmp_connect_info[SPIDER_TMP_SHARE_CHAR_PTR_COUNT]; uint tmp_connect_info_length[SPIDER_TMP_SHARE_UINT_COUNT]; From d3b84ff10d855fa4b4fc42dcbe542f045f6cc970 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Mon, 14 Oct 2024 17:19:22 +1100 Subject: [PATCH 07/13] MDEV-30067 Remove some overly enthusiastic asserts when deleting from a partitioned table When an DDL statement results in a local partition table with partitions not covering all values in the table, a failure is emitted. However, when the table in question is a spider table, the issue does not surface until some future statements (DELETE in the test examples in this commit) are executed. This is consistent with the design of spider which aims to minimise connections with the data node. The resulting error is legitimate and should not result in an assertion failure. Similarly, a partitioned spider table could have misplaced rows, so we remove the other assertion as well. --- sql/ha_partition.cc | 20 ---------- .../spider/bugfix/r/mdev_30067.result | 27 +++++++++++++ .../spider/bugfix/t/mdev_30067.test | 40 +++++++++++++++++++ 3 files changed, 67 insertions(+), 20 deletions(-) create mode 100644 storage/spider/mysql-test/spider/bugfix/r/mdev_30067.result create mode 100644 storage/spider/mysql-test/spider/bugfix/t/mdev_30067.test diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 587e30339bc..22d1dca0ad9 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -4704,35 +4704,15 @@ int ha_partition::delete_row(const uchar *buf) DBUG_ASSERT(bitmap_is_subset(&m_part_info->full_part_field_set, table->read_set)); #ifndef DBUG_OFF - THD* thd = ha_thd(); /* The protocol for deleting a row is: 1) position the handler (cursor) on the row to be deleted, either through the last read row (rnd or index) or by rnd_pos. 2) call delete_row with the full record as argument. - This means that m_last_part should already be set to actual partition - where the row was read from. And if that is not the same as the - calculated part_id we found a misplaced row, we return an error to - notify the user that something is broken in the row distribution - between partitions! Since we don't check all rows on read, we return an - error instead of forwarding the delete to the correct (m_last_part) - partition! - Notice that HA_READ_BEFORE_WRITE_REMOVAL does not require this protocol, so this is not supported for this engine. - - For partitions by system_time, get_part_for_buf() is always either current - or last historical partition, but DELETE HISTORY can delete from any - historical partition. So, skip the check in this case. */ - if (!thd->lex->vers_conditions.delete_history) - { - uint32 part_id; - error= get_part_for_buf(buf, m_rec0, m_part_info, &part_id); - DBUG_ASSERT(!error); - DBUG_ASSERT(part_id == m_last_part); - } DBUG_ASSERT(bitmap_is_set(&(m_part_info->read_partitions), m_last_part)); DBUG_ASSERT(bitmap_is_set(&(m_part_info->lock_partitions), m_last_part)); #endif diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_30067.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_30067.result new file mode 100644 index 00000000000..180e3e144bc --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_30067.result @@ -0,0 +1,27 @@ +for master_1 +for child2 +for child3 +set spider_same_server_link= 1; +CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); +CREATE TABLE t (c INT); +INSERT INTO t VALUES (13); +CREATE TABLE t1 (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv",TABLE "t"' PARTITION BY LIST (c) (PARTITION p VALUES IN (42)); +DELETE FROM a1 USING t1 AS a1; +drop table t, t1; +CREATE TABLE t (c INT KEY,c1 BLOB,c2 TEXT) ENGINE=InnoDB; +INSERT INTO t VALUES (0,1,0),(1,0,0),(2,0,0); +CREATE TABLE t1 (c INT KEY,c1 BLOB,c2 TEXT) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv",TABLE "t"'; +ALTER TABLE t1 ENGINE=Spider PARTITION BY LIST (c) (PARTITION p VALUES IN (1,2)); +DELETE FROM a2,a1 USING t1 AS a1 JOIN t1 AS a2,t1 AS a3; +drop table t, t1; +CREATE TABLE t (c INT); +CREATE TABLE t1 (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv",TABLE "t"' PARTITION BY LIST (c) (PARTITION p1 VALUES IN (42), PARTITION p2 VALUES IN (13)); +INSERT INTO t1 VALUES (13); +ALTER TABLE t1 PARTITION BY LIST (c) (PARTITION p1 VALUES IN (13), PARTITION p2 VALUES IN (87)); +DELETE FROM a1 USING t1 AS a1; +drop table t, t1; +drop server srv; +for master_1 +for child2 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_30067.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_30067.test new file mode 100644 index 00000000000..9e905a85e8b --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_30067.test @@ -0,0 +1,40 @@ +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log + +set spider_same_server_link= 1; +evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); + +# simplified case; triggering DBUG_ASSERT(!error) +CREATE TABLE t (c INT); +INSERT INTO t VALUES (13); +CREATE TABLE t1 (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv",TABLE "t"' PARTITION BY LIST (c) (PARTITION p VALUES IN (42)); +DELETE FROM a1 USING t1 AS a1; +drop table t, t1; + +# original case; triggering DBUG_ASSERT(!error) +CREATE TABLE t (c INT KEY,c1 BLOB,c2 TEXT) ENGINE=InnoDB; +INSERT INTO t VALUES (0,1,0),(1,0,0),(2,0,0); +CREATE TABLE t1 (c INT KEY,c1 BLOB,c2 TEXT) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv",TABLE "t"'; +ALTER TABLE t1 ENGINE=Spider PARTITION BY LIST (c) (PARTITION p VALUES IN (1,2)); +DELETE FROM a2,a1 USING t1 AS a1 JOIN t1 AS a2,t1 AS a3; +drop table t, t1; + +# triggering DBUG_ASSERT(part_id == m_last_part) +CREATE TABLE t (c INT); +CREATE TABLE t1 (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv",TABLE "t"' PARTITION BY LIST (c) (PARTITION p1 VALUES IN (42), PARTITION p2 VALUES IN (13)); +INSERT INTO t1 VALUES (13); +ALTER TABLE t1 PARTITION BY LIST (c) (PARTITION p1 VALUES IN (13), PARTITION p2 VALUES IN (87)); +DELETE FROM a1 USING t1 AS a1; +drop table t, t1; + +drop server srv; + +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log From 98a9c75ea38e1bec2a3a7b39209ecbb8deb93d9f Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Mon, 29 Jul 2024 17:03:11 +1000 Subject: [PATCH 08/13] MDEV-34659 Use evalp in CREATE SERVER's in init_spider.inc This was already fixed in higher versions. --- .../mysql-test/spider/include/init_spider.inc | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/storage/spider/mysql-test/spider/include/init_spider.inc b/storage/spider/mysql-test/spider/include/init_spider.inc index 9ec26b9eeee..74d8c4436b5 100644 --- a/storage/spider/mysql-test/spider/include/init_spider.inc +++ b/storage/spider/mysql-test/spider/include/init_spider.inc @@ -5,7 +5,7 @@ if ($VERSION_COMPILE_OS_WIN) INSTALL SONAME 'ha_spider'; if ($MASTER_1_MYPORT) { - eval CREATE SERVER s_1 FOREIGN DATA WRAPPER mysql OPTIONS ( + evalp CREATE SERVER s_1 FOREIGN DATA WRAPPER mysql OPTIONS ( HOST 'localhost', DATABASE 'auto_test_local', USER 'root', @@ -15,7 +15,7 @@ if ($VERSION_COMPILE_OS_WIN) } if ($CHILD2_1_MYPORT) { - eval CREATE SERVER s_2_1 FOREIGN DATA WRAPPER mysql OPTIONS ( + evalp CREATE SERVER s_2_1 FOREIGN DATA WRAPPER mysql OPTIONS ( HOST 'localhost', DATABASE 'auto_test_remote', USER 'root', @@ -25,7 +25,7 @@ if ($VERSION_COMPILE_OS_WIN) } if ($CHILD2_2_MYPORT) { - eval CREATE SERVER s_2_2 FOREIGN DATA WRAPPER mysql OPTIONS ( + evalp CREATE SERVER s_2_2 FOREIGN DATA WRAPPER mysql OPTIONS ( HOST 'localhost', DATABASE 'auto_test_remote2', USER 'root', @@ -35,7 +35,7 @@ if ($VERSION_COMPILE_OS_WIN) } if ($CHILD2_3_MYPORT) { - eval CREATE SERVER s_2_3 FOREIGN DATA WRAPPER mysql OPTIONS ( + evalp CREATE SERVER s_2_3 FOREIGN DATA WRAPPER mysql OPTIONS ( HOST 'localhost', DATABASE 'auto_test_remote3', USER 'root', @@ -45,7 +45,7 @@ if ($VERSION_COMPILE_OS_WIN) } if ($CHILD3_1_MYPORT) { - eval CREATE SERVER s_3_1 FOREIGN DATA WRAPPER mysql OPTIONS ( + evalp CREATE SERVER s_3_1 FOREIGN DATA WRAPPER mysql OPTIONS ( HOST 'localhost', DATABASE 'auto_test_local', USER 'root', @@ -55,7 +55,7 @@ if ($VERSION_COMPILE_OS_WIN) } if ($CHILD3_2_MYPORT) { - eval CREATE SERVER s_3_2 FOREIGN DATA WRAPPER mysql OPTIONS ( + evalp CREATE SERVER s_3_2 FOREIGN DATA WRAPPER mysql OPTIONS ( HOST 'localhost', DATABASE 'auto_test_local', USER 'root', @@ -65,7 +65,7 @@ if ($VERSION_COMPILE_OS_WIN) } if ($CHILD2_3_MYPORT) { - eval CREATE SERVER s_3_3 FOREIGN DATA WRAPPER mysql OPTIONS ( + evalp CREATE SERVER s_3_3 FOREIGN DATA WRAPPER mysql OPTIONS ( HOST 'localhost', DATABASE 'auto_test_local', USER 'root', @@ -79,7 +79,7 @@ if (!$VERSION_COMPILE_OS_WIN) INSTALL SONAME 'ha_spider'; if ($MASTER_1_MYSOCK) { - eval CREATE SERVER s_1 FOREIGN DATA WRAPPER mysql OPTIONS ( + evalp CREATE SERVER s_1 FOREIGN DATA WRAPPER mysql OPTIONS ( HOST 'localhost', DATABASE 'auto_test_local', USER 'root', @@ -89,7 +89,7 @@ if (!$VERSION_COMPILE_OS_WIN) } if ($CHILD2_1_MYSOCK) { - eval CREATE SERVER s_2_1 FOREIGN DATA WRAPPER mysql OPTIONS ( + evalp CREATE SERVER s_2_1 FOREIGN DATA WRAPPER mysql OPTIONS ( HOST 'localhost', DATABASE 'auto_test_remote', USER 'root', @@ -99,7 +99,7 @@ if (!$VERSION_COMPILE_OS_WIN) } if ($CHILD2_2_MYSOCK) { - eval CREATE SERVER s_2_2 FOREIGN DATA WRAPPER mysql OPTIONS ( + evalp CREATE SERVER s_2_2 FOREIGN DATA WRAPPER mysql OPTIONS ( HOST 'localhost', DATABASE 'auto_test_remote2', USER 'root', @@ -109,7 +109,7 @@ if (!$VERSION_COMPILE_OS_WIN) } if ($CHILD2_3_MYSOCK) { - eval CREATE SERVER s_2_3 FOREIGN DATA WRAPPER mysql OPTIONS ( + evalp CREATE SERVER s_2_3 FOREIGN DATA WRAPPER mysql OPTIONS ( HOST 'localhost', DATABASE 'auto_test_remote3', USER 'root', @@ -119,7 +119,7 @@ if (!$VERSION_COMPILE_OS_WIN) } if ($CHILD3_1_MYSOCK) { - eval CREATE SERVER s_3_1 FOREIGN DATA WRAPPER mysql OPTIONS ( + evalp CREATE SERVER s_3_1 FOREIGN DATA WRAPPER mysql OPTIONS ( HOST 'localhost', DATABASE 'auto_test_local', USER 'root', @@ -129,7 +129,7 @@ if (!$VERSION_COMPILE_OS_WIN) } if ($CHILD3_2_MYSOCK) { - eval CREATE SERVER s_3_2 FOREIGN DATA WRAPPER mysql OPTIONS ( + evalp CREATE SERVER s_3_2 FOREIGN DATA WRAPPER mysql OPTIONS ( HOST 'localhost', DATABASE 'auto_test_local', USER 'root', @@ -139,7 +139,7 @@ if (!$VERSION_COMPILE_OS_WIN) } if ($CHILD3_3_MYSOCK) { - eval CREATE SERVER s_3_3 FOREIGN DATA WRAPPER mysql OPTIONS ( + evalp CREATE SERVER s_3_3 FOREIGN DATA WRAPPER mysql OPTIONS ( HOST 'localhost', DATABASE 'auto_test_local', USER 'root', From 0a59aafc5fa0637e3197544e6adb4bb522cfcc96 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Tue, 15 Oct 2024 14:30:30 +1100 Subject: [PATCH 09/13] MDEV-34659 Bound check in spider cast function query construction During spider query construction of certain cast functions, it locates the last occurrence of a keyword in the output of the Item::print() function and append from there to the constructed query so far. For example, consider the following query SELECT * FROM t2 ORDER BY CAST(c AS INET6); It constructs the following query and executes it at the data node (assuming the data node table is called t0). select cast(t0.`c` as inet6) ``,t0.`c` `c` from `test`.`t1` t0 order by `` When the construction has completed the initial part select cast(t0.`c` It then attempts to construct the " as inet6" part. To that end, it calls print() on the Item_typecast_fbt corresponding to the cast item, and obtains cast(`test`.`t2`.`c` as inet6) It then looks for " as ", and places cursor there for appending: cast(`test`.`t2`.`c` as inet6) ^ In this patch, if the search fails, i.e. there's no " as ...", we make sure that the cursor is not placed before the beginning of the string (out of bound). We also relax the search from " as char" to " as " in the case of CHAR_TYPECAST_FUNC, since there is more than one Item type with this func type. For example, "AS INET6" is an Item_typecast_fbt which has this func type. --- .../spider/bugfix/r/mdev_34659.result | 23 ++++++++++++++++++ .../spider/bugfix/t/mdev_34659.test | 24 +++++++++++++++++++ storage/spider/spd_db_include.h | 2 -- storage/spider/spd_db_mysql.cc | 17 +++++++------ 4 files changed, 57 insertions(+), 9 deletions(-) create mode 100644 storage/spider/mysql-test/spider/bugfix/r/mdev_34659.result create mode 100644 storage/spider/mysql-test/spider/bugfix/t/mdev_34659.test diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_34659.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_34659.result new file mode 100644 index 00000000000..e77939396b0 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_34659.result @@ -0,0 +1,23 @@ +for master_1 +for child2 +for child3 +SET spider_same_server_link= on; +SET sql_mode=''; +CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); +CREATE TABLE t1 (c INT) ENGINE=MyISAM; +CREATE TABLE t2 (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql",SRV "srv",TABLE "t1"'; +insert into t2 values (456), (123); +SELECT * FROM t2 ORDER BY CAST(c AS char(60)); +c +123 +456 +SELECT * FROM t2 ORDER BY CAST(c AS INET6); +c +456 +123 +DROP TABLE t1,t2; +drop server srv; +for master_1 +for child2 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_34659.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_34659.test new file mode 100644 index 00000000000..3b481d2277f --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_34659.test @@ -0,0 +1,24 @@ +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log + +SET spider_same_server_link= on; +SET sql_mode=''; +evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); +CREATE TABLE t1 (c INT) ENGINE=MyISAM; +CREATE TABLE t2 (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql",SRV "srv",TABLE "t1"'; +insert into t2 values (456), (123); +SELECT * FROM t2 ORDER BY CAST(c AS char(60)); +SELECT * FROM t2 ORDER BY CAST(c AS INET6); +# Cleanup +DROP TABLE t1,t2; +drop server srv; + +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h index 17ae8a42704..015b65b2674 100644 --- a/storage/spider/spd_db_include.h +++ b/storage/spider/spd_db_include.h @@ -128,8 +128,6 @@ typedef st_spider_result SPIDER_RESULT; #define SPIDER_SQL_LIKE_LEN (sizeof(SPIDER_SQL_LIKE_STR) - 1) #define SPIDER_SQL_NOT_LIKE_STR "not like" #define SPIDER_SQL_NOT_LIKE_LEN (sizeof(SPIDER_SQL_NOT_LIKE_STR) - 1) -#define SPIDER_SQL_AS_CHAR_STR " as char" -#define SPIDER_SQL_AS_CHAR_LEN (sizeof(SPIDER_SQL_AS_CHAR_STR) - 1) #define SPIDER_SQL_CAST_STR "cast(" #define SPIDER_SQL_CAST_LEN (sizeof(SPIDER_SQL_CAST_STR) - 1) #define SPIDER_SQL_AS_DATETIME_STR " as datetime" diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index 06dcee81462..022b789b641 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -5451,11 +5451,12 @@ int spider_db_mbase_util::print_item_func( tmp_str.mem_calc(); if (tmp_str.reserve(1)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); - tmp_ptr = tmp_str.c_ptr_quick(); + last_str = tmp_ptr = tmp_str.c_ptr_quick(); DBUG_PRINT("info",("spider tmp_ptr = %s", tmp_ptr)); while ((tmp_ptr2 = strstr(tmp_ptr, SPIDER_SQL_AS_BINARY_STR))) tmp_ptr = tmp_ptr2 + 1; - last_str = tmp_ptr - 1; + if (tmp_ptr != last_str) + last_str = tmp_ptr - 1; last_str_length = strlen(last_str) - SPIDER_SQL_CLOSE_PAREN_LEN; break; } else if (!strncasecmp("cast_as_signed", func_name, func_name_length)) @@ -5573,11 +5574,12 @@ int spider_db_mbase_util::print_item_func( tmp_str.mem_calc(); if (tmp_str.reserve(1)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); - tmp_ptr = tmp_str.c_ptr_quick(); + last_str = tmp_ptr = tmp_str.c_ptr_quick(); DBUG_PRINT("info",("spider tmp_ptr = %s", tmp_ptr)); while ((tmp_ptr2 = strstr(tmp_ptr, SPIDER_SQL_AS_DECIMAL_STR))) tmp_ptr = tmp_ptr2 + 1; - last_str = tmp_ptr - 1; + if (tmp_ptr != last_str) + last_str = tmp_ptr - 1; last_str_length = strlen(last_str) - SPIDER_SQL_CLOSE_PAREN_LEN; break; } else if (!strncasecmp("cast_as_datetime", func_name, @@ -5708,11 +5710,12 @@ int spider_db_mbase_util::print_item_func( tmp_str.mem_calc(); if (tmp_str.reserve(1)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); - tmp_ptr = tmp_str.c_ptr_quick(); + last_str = tmp_ptr = tmp_str.c_ptr_quick(); DBUG_PRINT("info",("spider tmp_ptr = %s", tmp_ptr)); - while ((tmp_ptr2 = strstr(tmp_ptr, SPIDER_SQL_AS_CHAR_STR))) + while ((tmp_ptr2 = strstr(tmp_ptr, SPIDER_SQL_AS_STR))) tmp_ptr = tmp_ptr2 + 1; - last_str = tmp_ptr - 1; + if (tmp_ptr != last_str) + last_str = tmp_ptr - 1; last_str_length = strlen(last_str) - SPIDER_SQL_CLOSE_PAREN_LEN; } break; From 03a5c683f930bdd6c044842232b254ba14b8f6b0 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Tue, 8 Oct 2024 11:46:52 +1100 Subject: [PATCH 10/13] MDEV-27650 Spider: remove #ifdef SPIDER_HAS_GROUP_BY_HANDLER --- storage/spider/ha_spider.cc | 6 ------ storage/spider/ha_spider.h | 2 -- storage/spider/spd_conn.cc | 8 -------- storage/spider/spd_db_conn.cc | 16 ---------------- storage/spider/spd_db_include.h | 8 -------- storage/spider/spd_db_mysql.cc | 6 ------ storage/spider/spd_db_mysql.h | 6 ------ storage/spider/spd_db_oracle.cc | 6 ------ storage/spider/spd_db_oracle.h | 6 ------ storage/spider/spd_group_by_handler.cc | 2 -- storage/spider/spd_group_by_handler.h | 2 -- storage/spider/spd_include.h | 2 -- storage/spider/spd_table.cc | 6 ------ 13 files changed, 76 deletions(-) diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index b4be3c2fd8e..2acf9a9d3af 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -87,9 +87,7 @@ ha_spider::ha_spider( sql_kinds = 0; error_mode = 0; use_spatial_index = FALSE; -#ifdef SPIDER_HAS_GROUP_BY_HANDLER use_fields = FALSE; -#endif dml_inited = FALSE; use_pre_call = FALSE; use_pre_action = FALSE; @@ -155,9 +153,7 @@ ha_spider::ha_spider( sql_kinds = 0; error_mode = 0; use_spatial_index = FALSE; -#ifdef SPIDER_HAS_GROUP_BY_HANDLER use_fields = FALSE; -#endif dml_inited = FALSE; use_pre_call = FALSE; use_pre_action = FALSE; @@ -1213,9 +1209,7 @@ int ha_spider::reset() result_list.set_split_read = FALSE; result_list.insert_dup_update_pushdown = FALSE; use_spatial_index = FALSE; -#ifdef SPIDER_HAS_GROUP_BY_HANDLER use_fields = FALSE; -#endif error_mode = 0; DBUG_RETURN(error_num); } diff --git a/storage/spider/ha_spider.h b/storage/spider/ha_spider.h index 446bbbc4d94..6d2e0e40c57 100644 --- a/storage/spider/ha_spider.h +++ b/storage/spider/ha_spider.h @@ -99,13 +99,11 @@ public: bool da_status; bool use_spatial_index; -#ifdef SPIDER_HAS_GROUP_BY_HANDLER uint idx_for_direct_join; bool use_fields; spider_fields *fields; SPIDER_LINK_IDX_CHAIN *link_idx_chain; SPIDER_LINK_IDX_CHAIN *result_link_idx_chain; -#endif /* for mrr */ bool mrr_with_cnt; diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc index 8cb55e8415f..8b7193ed94a 100644 --- a/storage/spider/spd_conn.cc +++ b/storage/spider/spd_conn.cc @@ -1749,7 +1749,6 @@ int spider_set_conn_bg_param( if (result_list->bgs_phase > 0) { -#ifdef SPIDER_HAS_GROUP_BY_HANDLER if (spider->use_fields) { SPIDER_LINK_IDX_CHAIN *link_idx_chain; @@ -1761,7 +1760,6 @@ int spider_set_conn_bg_param( DBUG_RETURN(error_num); } } else { -#endif for ( roop_count = spider_conn_link_idx_next(share->link_statuses, spider->conn_link_idx, -1, share->link_count, @@ -1776,9 +1774,7 @@ int spider_set_conn_bg_param( if ((error_num = spider_create_conn_thread(spider->conns[roop_count]))) DBUG_RETURN(error_num); } -#ifdef SPIDER_HAS_GROUP_BY_HANDLER } -#endif } DBUG_RETURN(0); } @@ -2234,9 +2230,7 @@ int spider_bg_conn_search( conn->bg_target = spider; conn->link_idx = link_idx; conn->bg_discard_result = discard_result; -#ifdef SPIDER_HAS_GROUP_BY_HANDLER conn->link_idx_chain = spider->link_idx_chain; -#endif pthread_mutex_lock(&conn->bg_conn_sync_mutex); pthread_cond_signal(&conn->bg_conn_cond); pthread_mutex_unlock(&conn->bg_conn_mutex); @@ -2378,9 +2372,7 @@ int spider_bg_conn_search( conn->bg_target = spider; conn->link_idx = link_idx; conn->bg_discard_result = discard_result; -#ifdef SPIDER_HAS_GROUP_BY_HANDLER conn->link_idx_chain = spider->link_idx_chain; -#endif result_list->bgs_working = TRUE; conn->bg_search = TRUE; if (with_lock) diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc index 8750e87237e..c4259968b68 100644 --- a/storage/spider/spd_db_conn.cc +++ b/storage/spider/spd_db_conn.cc @@ -2928,16 +2928,12 @@ int spider_db_fetch_table( DBUG_RETURN(error_num); } -#ifdef SPIDER_HAS_GROUP_BY_HANDLER if (!spider->use_fields) { -#endif if ((error_num = spider_db_append_match_fetch(spider, spider->ft_first, spider->ft_current, row))) DBUG_RETURN(error_num); -#ifdef SPIDER_HAS_GROUP_BY_HANDLER } -#endif for ( field = table->field; @@ -4521,10 +4517,8 @@ int spider_db_seek_next( (SPIDER_RESULT*) result_list->current); int roop_start = 0, roop_end = 1, roop_count, lock_mode, link_ok = 0; -#ifdef SPIDER_HAS_GROUP_BY_HANDLER if (!spider->use_fields) { -#endif lock_mode = spider_conn_lock_mode(spider); if (lock_mode) { @@ -4541,14 +4535,11 @@ int spider_db_seek_next( roop_start = link_idx; roop_end = link_idx + 1; } -#ifdef SPIDER_HAS_GROUP_BY_HANDLER } -#endif #ifndef WITHOUT_SPIDER_BG_SEARCH if (result_list->bgs_phase > 0) { -#ifdef SPIDER_HAS_GROUP_BY_HANDLER if (spider->use_fields) { SPIDER_LINK_IDX_CHAIN *link_idx_chain; @@ -4572,7 +4563,6 @@ int spider_db_seek_next( } } } else { -#endif for (roop_count = roop_start; roop_count < roop_end; roop_count = spider_conn_link_idx_next(share->link_statuses, spider->conn_link_idx, roop_count, share->link_count, @@ -4585,9 +4575,7 @@ int spider_db_seek_next( DBUG_RETURN(error_num); } } -#ifdef SPIDER_HAS_GROUP_BY_HANDLER } -#endif } else { #endif if (result_list->current == result_list->bgs_current) @@ -4639,7 +4627,6 @@ int spider_db_seek_next( } } -#ifdef SPIDER_HAS_GROUP_BY_HANDLER if (spider->use_fields) { SPIDER_LINK_IDX_CHAIN *link_idx_chain; @@ -4729,7 +4716,6 @@ int spider_db_seek_next( } } } else { -#endif for (roop_count = roop_start; roop_count < roop_end; roop_count = spider_conn_link_idx_next(share->link_statuses, spider->conn_link_idx, roop_count, share->link_count, @@ -4865,9 +4851,7 @@ int spider_db_seek_next( } } } -#ifdef SPIDER_HAS_GROUP_BY_HANDLER } -#endif } else { spider->connection_ids[link_idx] = conn->connection_id; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h index 015b65b2674..eb7875ac056 100644 --- a/storage/spider/spd_db_include.h +++ b/storage/spider/spd_db_include.h @@ -44,8 +44,6 @@ #define SPIDER_ITEM_STRING_WITHOUT_SET_STR_WITH_COPY #define SPIDER_ITEM_STRING_WITHOUT_SET_STR_WITH_COPY_AND_THDPTR -#define SPIDER_HAS_GROUP_BY_HANDLER - #define SPIDER_ORDER_HAS_ENUM_ORDER #define SPIDER_ITEM_GEOFUNC_NAME_HAS_MBR @@ -776,7 +774,6 @@ public: spider_string *to, String *from ) = 0; -#ifdef SPIDER_HAS_GROUP_BY_HANDLER virtual int append_from_and_tables( ha_spider *spider, spider_fields *fields, @@ -790,7 +787,6 @@ public: virtual int append_having( spider_string *str ) = 0; -#endif virtual bool tables_on_different_db_are_joinable(); virtual bool socket_has_default_value(); virtual bool database_has_default_value(); @@ -1411,13 +1407,11 @@ public: virtual int reset_sql( ulong sql_type ) = 0; -#ifdef SPIDER_HAS_GROUP_BY_HANDLER virtual int set_sql_for_exec( ulong sql_type, int link_idx, SPIDER_LINK_IDX_CHAIN *link_idx_chain ) = 0; -#endif virtual int set_sql_for_exec( ulong sql_type, int link_idx @@ -1531,7 +1525,6 @@ public: int link_idx, ulong sql_type ) = 0; -#ifdef SPIDER_HAS_GROUP_BY_HANDLER virtual int append_from_and_tables_part( spider_fields *fields, ulong sql_type @@ -1574,7 +1567,6 @@ public: spider_fields *fields, ulong sql_type ) = 0; -#endif virtual bool check_direct_update( st_select_lex *select_lex, longlong select_limit, diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index 022b789b641..7e10b796f25 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -6216,7 +6216,6 @@ int spider_db_mbase_util::append_escaped_util( DBUG_RETURN(0); } -#ifdef SPIDER_HAS_GROUP_BY_HANDLER /* Walk a TABLE_LIST, or format it to a string and append it. @@ -6500,7 +6499,6 @@ int spider_db_mbase_util::append_having( str->q_append(SPIDER_SQL_HAVING_STR, SPIDER_SQL_HAVING_LEN); DBUG_RETURN(0); } -#endif bool spider_db_mbase_util::append_charset_name_before_string() { @@ -12475,7 +12473,6 @@ int spider_mbase_handler::reset_sql( } -#ifdef SPIDER_HAS_GROUP_BY_HANDLER int spider_mbase_handler::set_sql_for_exec( ulong sql_type, int link_idx, @@ -12489,7 +12486,6 @@ int spider_mbase_handler::set_sql_for_exec( } DBUG_RETURN(0); } -#endif int spider_mbase_handler::set_sql_for_exec( ulong sql_type, @@ -13853,7 +13849,6 @@ int spider_mbase_handler::reset_union_table_name( DBUG_RETURN(0); } -#ifdef SPIDER_HAS_GROUP_BY_HANDLER int spider_mbase_handler::append_from_and_tables_part( spider_fields *fields, ulong sql_type @@ -14154,7 +14149,6 @@ int spider_mbase_handler::append_order_by( } DBUG_RETURN(0); } -#endif bool spider_mbase_handler::check_direct_update( st_select_lex *select_lex, diff --git a/storage/spider/spd_db_mysql.h b/storage/spider/spd_db_mysql.h index 7eeb5bed7fb..028a69e843b 100644 --- a/storage/spider/spd_db_mysql.h +++ b/storage/spider/spd_db_mysql.h @@ -158,7 +158,6 @@ public: spider_string *to, String *from ) override; -#ifdef SPIDER_HAS_GROUP_BY_HANDLER int append_tables_top_down_check( TABLE_LIST *table_list, TABLE_LIST **used_table_list, @@ -188,7 +187,6 @@ public: int append_having( spider_string *str ) override; -#endif bool append_charset_name_before_string() override; }; @@ -1348,13 +1346,11 @@ public: int reset_sql( ulong sql_type ) override; -#ifdef SPIDER_HAS_GROUP_BY_HANDLER int set_sql_for_exec( ulong sql_type, int link_idx, SPIDER_LINK_IDX_CHAIN *link_idx_chain ) override; -#endif int set_sql_for_exec( ulong sql_type, int link_idx @@ -1473,7 +1469,6 @@ public: int link_idx, ulong sql_type ) override; -#ifdef SPIDER_HAS_GROUP_BY_HANDLER int append_from_and_tables_part( spider_fields *fields, ulong sql_type @@ -1540,7 +1535,6 @@ public: bool use_fields, spider_fields *fields ); -#endif bool check_direct_update( st_select_lex *select_lex, longlong select_limit, diff --git a/storage/spider/spd_db_oracle.cc b/storage/spider/spd_db_oracle.cc index 455b52177dd..19295d40c5f 100644 --- a/storage/spider/spd_db_oracle.cc +++ b/storage/spider/spd_db_oracle.cc @@ -4304,7 +4304,6 @@ int spider_db_oracle_util::append_escaped_util( DBUG_RETURN(0); } -#ifdef SPIDER_HAS_GROUP_BY_HANDLER int spider_db_oracle_util::append_from_and_tables( ha_spider *spider, spider_fields *fields, @@ -4422,7 +4421,6 @@ int spider_db_oracle_util::append_having( str->q_append(SPIDER_SQL_HAVING_STR, SPIDER_SQL_HAVING_LEN); DBUG_RETURN(0); } -#endif spider_oracle_share::spider_oracle_share( st_spider_share *share @@ -10426,7 +10424,6 @@ bool spider_oracle_handler::need_lock_before_set_sql_for_exec( DBUG_RETURN(FALSE); } -#ifdef SPIDER_HAS_GROUP_BY_HANDLER int spider_oracle_handler::set_sql_for_exec( ulong sql_type, int link_idx, @@ -10471,7 +10468,6 @@ int spider_oracle_handler::set_sql_for_exec( } DBUG_RETURN(0); } -#endif int spider_oracle_handler::set_sql_for_exec( ulong sql_type, @@ -12304,7 +12300,6 @@ int spider_oracle_handler::reset_union_table_name( DBUG_RETURN(0); } -#ifdef SPIDER_HAS_GROUP_BY_HANDLER int spider_oracle_handler::append_from_and_tables_part( spider_fields *fields, ulong sql_type @@ -12633,7 +12628,6 @@ int spider_oracle_handler::append_order_by( } DBUG_RETURN(0); } -#endif spider_oracle_copy_table::spider_oracle_copy_table( spider_oracle_share *db_share diff --git a/storage/spider/spd_db_oracle.h b/storage/spider/spd_db_oracle.h index d47bc9f7ea6..5f7f4e8ff1f 100644 --- a/storage/spider/spd_db_oracle.h +++ b/storage/spider/spd_db_oracle.h @@ -144,7 +144,6 @@ public: spider_string *to, String *from ); -#ifdef SPIDER_HAS_GROUP_BY_HANDLER int append_from_and_tables( ha_spider *spider, spider_fields *fields, @@ -163,7 +162,6 @@ public: int append_having( spider_string *str ); -#endif }; class spider_db_oracle_row: public spider_db_row @@ -1264,13 +1262,11 @@ public: bool need_lock_before_set_sql_for_exec( ulong sql_type ); -#ifdef SPIDER_HAS_GROUP_BY_HANDLER int set_sql_for_exec( ulong sql_type, int link_idx, SPIDER_LINK_IDX_CHAIN *link_idx_chain ); -#endif int set_sql_for_exec( ulong sql_type, int link_idx @@ -1385,7 +1381,6 @@ public: int link_idx, ulong sql_type ); -#ifdef SPIDER_HAS_GROUP_BY_HANDLER int append_from_and_tables_part( spider_fields *fields, ulong sql_type @@ -1456,7 +1451,6 @@ public: bool use_fields, spider_fields *fields ); -#endif }; class spider_oracle_copy_table: public spider_db_copy_table diff --git a/storage/spider/spd_group_by_handler.cc b/storage/spider/spd_group_by_handler.cc index 481291ec6f0..2e4eb003371 100644 --- a/storage/spider/spd_group_by_handler.cc +++ b/storage/spider/spd_group_by_handler.cc @@ -975,7 +975,6 @@ int spider_fields::ping_table_mon_from_table( DBUG_RETURN(error_num); } -#ifdef SPIDER_HAS_GROUP_BY_HANDLER spider_group_by_handler::spider_group_by_handler( THD *thd_arg, Query *query_arg, @@ -1842,4 +1841,3 @@ skip_free_table_holder: spider_free(spider_current_trx, table_holder, MYF(0)); DBUG_RETURN(NULL); } -#endif diff --git a/storage/spider/spd_group_by_handler.h b/storage/spider/spd_group_by_handler.h index b3984951ec5..db100de92f2 100644 --- a/storage/spider/spd_group_by_handler.h +++ b/storage/spider/spd_group_by_handler.h @@ -13,7 +13,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef SPIDER_HAS_GROUP_BY_HANDLER class spider_group_by_handler: public group_by_handler { Query query; @@ -41,4 +40,3 @@ group_by_handler *spider_create_group_by_handler( THD *thd, Query *query ); -#endif diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h index 7371c6da6f3..1643d1b350e 100644 --- a/storage/spider/spd_include.h +++ b/storage/spider/spd_include.h @@ -755,10 +755,8 @@ typedef struct st_spider_conn query_id_t connect_error_query_id; time_t connect_error_time; -#ifdef SPIDER_HAS_GROUP_BY_HANDLER SPIDER_CONN_HOLDER *conn_holder_for_direct_join; SPIDER_LINK_IDX_CHAIN *link_idx_chain; -#endif SPIDER_IP_PORT_CONN *ip_port_conn; pthread_mutex_t loop_check_mutex; diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 36bac44f150..5711de586d8 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -6233,9 +6233,7 @@ int spider_db_init( spider_hton->create = spider_create_handler; spider_hton->drop_database = spider_drop_database; spider_hton->show_status = spider_show_status; -#ifdef SPIDER_HAS_GROUP_BY_HANDLER spider_hton->create_group_by = spider_create_group_by_handler; -#endif if (my_gethwaddr((uchar *) addr)) { @@ -7481,13 +7479,11 @@ longlong spider_split_read_param( DBUG_PRINT("info",("spider bulk_update_mode=%d", bulk_update_mode)); DBUG_PRINT("info",("spider support_bulk_update_sql=%s", spider->support_bulk_update_sql() ? "TRUE" : "FALSE")); -#ifdef SPIDER_HAS_GROUP_BY_HANDLER bool inserting = ( spider->wide_handler->sql_command == SQLCOM_INSERT || spider->wide_handler->sql_command == SQLCOM_INSERT_SELECT ); -#endif bool updating = ( spider->wide_handler->sql_command == SQLCOM_UPDATE || @@ -7508,12 +7504,10 @@ longlong spider_split_read_param( DBUG_PRINT("info",("spider replacing=%s", replacing ? "TRUE" : "FALSE")); TABLE *table = spider->get_table(); if ( -#ifdef SPIDER_HAS_GROUP_BY_HANDLER ( inserting && spider->use_fields ) || -#endif replacing || ( ( From 6080e3af19e00e27cffefe10ffa2980e89e055fa Mon Sep 17 00:00:00 2001 From: Nayuta Yanagisawa Date: Thu, 10 Feb 2022 15:36:44 +0900 Subject: [PATCH 11/13] MDEV-26912 Spider: Remove dead code related to Oracle OCI Remove the dead-code, in Spider, which is related to the Spider's Oracle OCI support. The code has been disabled for a long time and it is unlikely that the code will be enabled. --- storage/spider/CMakeLists.txt | 20 +- .../spider/oracle/include/deinit_child2_1.inc | 0 .../spider/oracle/include/deinit_child2_2.inc | 0 .../spider/oracle/include/deinit_child2_3.inc | 0 .../spider/oracle/include/deinit_child3_1.inc | 3 - .../spider/oracle/include/deinit_child3_2.inc | 3 - .../spider/oracle/include/deinit_child3_3.inc | 3 - .../spider/oracle/include/deinit_master_1.inc | 1 - .../spider/oracle/include/deinit_slave1_1.inc | 0 .../oracle/include/ha_deinit_child2_1.inc | 0 .../oracle/include/ha_deinit_child2_2.inc | 0 .../oracle/include/ha_deinit_child2_3.inc | 0 .../oracle/include/ha_deinit_child3_1.inc | 1 - .../oracle/include/ha_deinit_child3_2.inc | 1 - .../oracle/include/ha_deinit_child3_3.inc | 1 - .../oracle/include/ha_deinit_master_1.inc | 0 .../oracle/include/ha_init_child2_1.inc | 8 - .../oracle/include/ha_init_child2_2.inc | 4 - .../oracle/include/ha_init_child2_3.inc | 4 - .../oracle/include/ha_init_child3_1.inc | 140 - .../oracle/include/ha_init_child3_2.inc | 140 - .../oracle/include/ha_init_child3_3.inc | 140 - .../oracle/include/ha_init_master_1.inc | 109 - .../oracle/include/hs_deinit_child2_1.inc | 0 .../oracle/include/hs_deinit_child2_2.inc | 0 .../oracle/include/hs_deinit_child2_3.inc | 0 .../oracle/include/hs_deinit_master_1.inc | 0 .../oracle/include/hs_init_child2_1.inc | 24 - .../oracle/include/hs_init_child2_2.inc | 12 - .../oracle/include/hs_init_child2_3.inc | 0 .../oracle/include/hs_init_master_1.inc | 12 - .../spider/oracle/include/init_child2_1.inc | 192 - .../spider/oracle/include/init_child2_2.inc | 94 - .../spider/oracle/include/init_child2_3.inc | 15 - .../spider/oracle/include/init_child3_1.inc | 3 - .../spider/oracle/include/init_child3_2.inc | 3 - .../spider/oracle/include/init_child3_3.inc | 3 - .../spider/oracle/include/init_master_1.inc | 149 - .../spider/oracle/include/init_slave1_1.inc | 10 - .../spider/oracle/include/init_spider.inc | 105 - .../spider/mysql-test/spider/oracle/my.cnf | 146 - .../spider/oracle/r/basic_sql.result | 634 - .../spider/oracle/r/basic_sql_part.result | 121 - .../spider/oracle/r/direct_aggregate.result | 91 - .../oracle/r/direct_aggregate_part.result | 82 - .../spider/oracle/r/direct_update.result | 138 - .../spider/oracle/r/direct_update_part.result | 129 - .../spider/oracle/r/function.result | 149 - .../mysql-test/spider/oracle/r/ha.result | 240 - .../mysql-test/spider/oracle/r/ha_part.result | 262 - .../spider/oracle/r/spider3_fixes.result | 194 - .../spider/oracle/r/spider3_fixes_part.result | 192 - .../spider/oracle/r/spider_fixes.result | 552 - .../spider/oracle/r/spider_fixes_part.result | 199 - .../spider/oracle/r/vp_fixes.result | 80 - .../mysql-test/spider/oracle/t/basic_sql.test | 2701 ---- .../spider/oracle/t/basic_sql_part.test | 571 - .../spider/oracle/t/connect_child2_1.inc | 1 - .../spider/oracle/t/connect_child2_2.inc | 1 - .../spider/oracle/t/connect_child2_3.inc | 1 - .../spider/oracle/t/connect_child3_1.inc | 1 - .../spider/oracle/t/connect_child3_2.inc | 1 - .../spider/oracle/t/connect_child3_3.inc | 1 - .../spider/oracle/t/connect_master_1.inc | 1 - .../spider/oracle/t/connect_slave1_1.inc | 1 - .../spider/oracle/t/direct_aggregate.test | 181 - .../oracle/t/direct_aggregate_part.test | 194 - .../spider/oracle/t/direct_update.test | 198 - .../spider/oracle/t/direct_update_part.test | 211 - .../mysql-test/spider/oracle/t/function.test | 253 - .../spider/mysql-test/spider/oracle/t/ha.test | 882 - .../mysql-test/spider/oracle/t/ha_part.test | 1017 -- .../spider/oracle/t/ha_test_deinit.inc | 30 - .../spider/oracle/t/ha_test_init.inc | 30 - .../spider/oracle/t/have_engine.inc | 7 - .../mysql-test/spider/oracle/t/have_func.inc | 5 - .../spider/oracle/t/have_partition.inc | 7 - .../spider/oracle/t/have_trigger.inc | 2 - .../spider/oracle/t/hs_test_deinit.inc | 17 - .../spider/oracle/t/hs_test_init.inc | 17 - .../spider/oracle/t/slave_test_deinit.inc | 6 - .../spider/oracle/t/slave_test_init.inc | 44 - .../spider/oracle/t/spider3_fixes.test | 292 - .../spider/oracle/t/spider3_fixes_part.test | 345 - .../spider/oracle/t/spider_fixes.test | 1425 -- .../spider/oracle/t/spider_fixes_part.test | 645 - .../spider/oracle/t/test_deinit.inc | 37 - .../mysql-test/spider/oracle/t/test_init.inc | 74 - .../mysql-test/spider/oracle/t/vp_fixes.test | 335 - .../oracle2/include/deinit_child2_1.inc | 0 .../oracle2/include/deinit_child2_2.inc | 0 .../oracle2/include/deinit_child2_3.inc | 0 .../oracle2/include/deinit_child3_1.inc | 3 - .../oracle2/include/deinit_child3_2.inc | 3 - .../oracle2/include/deinit_child3_3.inc | 3 - .../oracle2/include/deinit_master_1.inc | 1 - .../oracle2/include/deinit_slave1_1.inc | 0 .../oracle2/include/ha_deinit_child2_1.inc | 0 .../oracle2/include/ha_deinit_child2_2.inc | 0 .../oracle2/include/ha_deinit_child2_3.inc | 0 .../oracle2/include/ha_deinit_child3_1.inc | 1 - .../oracle2/include/ha_deinit_child3_2.inc | 1 - .../oracle2/include/ha_deinit_child3_3.inc | 1 - .../oracle2/include/ha_deinit_master_1.inc | 0 .../oracle2/include/ha_init_child2_1.inc | 8 - .../oracle2/include/ha_init_child2_2.inc | 4 - .../oracle2/include/ha_init_child2_3.inc | 4 - .../oracle2/include/ha_init_child3_1.inc | 140 - .../oracle2/include/ha_init_child3_2.inc | 140 - .../oracle2/include/ha_init_child3_3.inc | 140 - .../oracle2/include/ha_init_master_1.inc | 109 - .../oracle2/include/hs_deinit_child2_1.inc | 0 .../oracle2/include/hs_deinit_child2_2.inc | 0 .../oracle2/include/hs_deinit_child2_3.inc | 0 .../oracle2/include/hs_deinit_master_1.inc | 0 .../oracle2/include/hs_init_child2_1.inc | 24 - .../oracle2/include/hs_init_child2_2.inc | 12 - .../oracle2/include/hs_init_child2_3.inc | 0 .../oracle2/include/hs_init_master_1.inc | 12 - .../spider/oracle2/include/init_child2_1.inc | 192 - .../spider/oracle2/include/init_child2_2.inc | 94 - .../spider/oracle2/include/init_child2_3.inc | 15 - .../spider/oracle2/include/init_child3_1.inc | 3 - .../spider/oracle2/include/init_child3_2.inc | 3 - .../spider/oracle2/include/init_child3_3.inc | 3 - .../spider/oracle2/include/init_master_1.inc | 150 - .../spider/oracle2/include/init_slave1_1.inc | 10 - .../spider/oracle2/include/init_spider.inc | 105 - .../spider/mysql-test/spider/oracle2/my.cnf | 146 - .../spider/oracle2/r/basic_sql.result | 634 - .../spider/oracle2/r/basic_sql_part.result | 121 - .../spider/oracle2/r/direct_aggregate.result | 91 - .../oracle2/r/direct_aggregate_part.result | 82 - .../spider/oracle2/r/direct_update.result | 138 - .../oracle2/r/direct_update_part.result | 129 - .../spider/oracle2/r/function.result | 149 - .../mysql-test/spider/oracle2/r/ha.result | 240 - .../spider/oracle2/r/ha_part.result | 262 - .../spider/oracle2/r/spider3_fixes.result | 210 - .../oracle2/r/spider3_fixes_part.result | 208 - .../spider/oracle2/r/spider_fixes.result | 556 - .../spider/oracle2/r/spider_fixes_part.result | 203 - .../spider/oracle2/r/vp_fixes.result | 80 - .../spider/oracle2/t/basic_sql.test | 2701 ---- .../spider/oracle2/t/basic_sql_part.test | 571 - .../spider/oracle2/t/connect_child2_1.inc | 1 - .../spider/oracle2/t/connect_child2_2.inc | 1 - .../spider/oracle2/t/connect_child2_3.inc | 1 - .../spider/oracle2/t/connect_child3_1.inc | 1 - .../spider/oracle2/t/connect_child3_2.inc | 1 - .../spider/oracle2/t/connect_child3_3.inc | 1 - .../spider/oracle2/t/connect_master_1.inc | 1 - .../spider/oracle2/t/connect_slave1_1.inc | 1 - .../spider/oracle2/t/direct_aggregate.test | 181 - .../oracle2/t/direct_aggregate_part.test | 194 - .../spider/oracle2/t/direct_update.test | 198 - .../spider/oracle2/t/direct_update_part.test | 211 - .../mysql-test/spider/oracle2/t/function.test | 253 - .../mysql-test/spider/oracle2/t/ha.test | 882 - .../mysql-test/spider/oracle2/t/ha_part.test | 1017 -- .../spider/oracle2/t/ha_test_deinit.inc | 30 - .../spider/oracle2/t/ha_test_init.inc | 30 - .../spider/oracle2/t/have_engine.inc | 7 - .../mysql-test/spider/oracle2/t/have_func.inc | 5 - .../spider/oracle2/t/have_partition.inc | 7 - .../spider/oracle2/t/have_trigger.inc | 2 - .../spider/oracle2/t/hs_test_deinit.inc | 17 - .../spider/oracle2/t/hs_test_init.inc | 17 - .../spider/oracle2/t/slave_test_deinit.inc | 6 - .../spider/oracle2/t/slave_test_init.inc | 44 - .../spider/oracle2/t/spider3_fixes.test | 292 - .../spider/oracle2/t/spider3_fixes_part.test | 345 - .../spider/oracle2/t/spider_fixes.test | 1425 -- .../spider/oracle2/t/spider_fixes_part.test | 645 - .../spider/oracle2/t/test_deinit.inc | 37 - .../mysql-test/spider/oracle2/t/test_init.inc | 74 - .../mysql-test/spider/oracle2/t/vp_fixes.test | 335 - storage/spider/spd_db_oracle.cc | 13404 ---------------- storage/spider/spd_db_oracle.h | 1543 -- storage/spider/spd_table.cc | 9 - 180 files changed, 1 insertion(+), 42862 deletions(-) delete mode 100644 storage/spider/mysql-test/spider/oracle/include/deinit_child2_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/deinit_child2_2.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/deinit_child2_3.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/deinit_child3_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/deinit_child3_2.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/deinit_child3_3.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/deinit_master_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/deinit_slave1_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/ha_deinit_child2_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/ha_deinit_child2_2.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/ha_deinit_child2_3.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_2.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_3.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/ha_deinit_master_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/ha_init_child2_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/ha_init_child2_2.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/ha_init_child2_3.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/ha_init_child3_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/ha_init_child3_2.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/ha_init_child3_3.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/ha_init_master_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/hs_deinit_child2_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/hs_deinit_child2_2.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/hs_deinit_child2_3.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/hs_deinit_master_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/hs_init_child2_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/hs_init_child2_2.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/hs_init_child2_3.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/hs_init_master_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/init_child2_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/init_child2_2.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/init_child2_3.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/init_child3_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/init_child3_2.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/init_child3_3.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/init_master_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/init_slave1_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/include/init_spider.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/my.cnf delete mode 100644 storage/spider/mysql-test/spider/oracle/r/basic_sql.result delete mode 100644 storage/spider/mysql-test/spider/oracle/r/basic_sql_part.result delete mode 100644 storage/spider/mysql-test/spider/oracle/r/direct_aggregate.result delete mode 100644 storage/spider/mysql-test/spider/oracle/r/direct_aggregate_part.result delete mode 100644 storage/spider/mysql-test/spider/oracle/r/direct_update.result delete mode 100644 storage/spider/mysql-test/spider/oracle/r/direct_update_part.result delete mode 100644 storage/spider/mysql-test/spider/oracle/r/function.result delete mode 100644 storage/spider/mysql-test/spider/oracle/r/ha.result delete mode 100644 storage/spider/mysql-test/spider/oracle/r/ha_part.result delete mode 100644 storage/spider/mysql-test/spider/oracle/r/spider3_fixes.result delete mode 100644 storage/spider/mysql-test/spider/oracle/r/spider3_fixes_part.result delete mode 100644 storage/spider/mysql-test/spider/oracle/r/spider_fixes.result delete mode 100644 storage/spider/mysql-test/spider/oracle/r/spider_fixes_part.result delete mode 100644 storage/spider/mysql-test/spider/oracle/r/vp_fixes.result delete mode 100644 storage/spider/mysql-test/spider/oracle/t/basic_sql.test delete mode 100644 storage/spider/mysql-test/spider/oracle/t/basic_sql_part.test delete mode 100644 storage/spider/mysql-test/spider/oracle/t/connect_child2_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/t/connect_child2_2.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/t/connect_child2_3.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/t/connect_child3_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/t/connect_child3_2.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/t/connect_child3_3.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/t/connect_master_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/t/connect_slave1_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/t/direct_aggregate.test delete mode 100644 storage/spider/mysql-test/spider/oracle/t/direct_aggregate_part.test delete mode 100644 storage/spider/mysql-test/spider/oracle/t/direct_update.test delete mode 100644 storage/spider/mysql-test/spider/oracle/t/direct_update_part.test delete mode 100644 storage/spider/mysql-test/spider/oracle/t/function.test delete mode 100644 storage/spider/mysql-test/spider/oracle/t/ha.test delete mode 100644 storage/spider/mysql-test/spider/oracle/t/ha_part.test delete mode 100644 storage/spider/mysql-test/spider/oracle/t/ha_test_deinit.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/t/ha_test_init.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/t/have_engine.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/t/have_func.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/t/have_partition.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/t/have_trigger.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/t/hs_test_deinit.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/t/hs_test_init.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/t/slave_test_deinit.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/t/slave_test_init.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/t/spider3_fixes.test delete mode 100644 storage/spider/mysql-test/spider/oracle/t/spider3_fixes_part.test delete mode 100644 storage/spider/mysql-test/spider/oracle/t/spider_fixes.test delete mode 100644 storage/spider/mysql-test/spider/oracle/t/spider_fixes_part.test delete mode 100644 storage/spider/mysql-test/spider/oracle/t/test_deinit.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/t/test_init.inc delete mode 100644 storage/spider/mysql-test/spider/oracle/t/vp_fixes.test delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/deinit_child2_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/deinit_child2_2.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/deinit_child2_3.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/deinit_child3_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/deinit_child3_2.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/deinit_child3_3.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/deinit_master_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/deinit_slave1_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child2_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child2_2.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child2_3.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_2.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_3.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/ha_deinit_master_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_2.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_3.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_2.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_3.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/ha_init_master_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/hs_deinit_child2_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/hs_deinit_child2_2.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/hs_deinit_child2_3.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/hs_deinit_master_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_2.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_3.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/hs_init_master_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/init_child2_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/init_child2_2.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/init_child2_3.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/init_child3_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/init_child3_2.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/init_child3_3.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/init_master_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/init_slave1_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/include/init_spider.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/my.cnf delete mode 100644 storage/spider/mysql-test/spider/oracle2/r/basic_sql.result delete mode 100644 storage/spider/mysql-test/spider/oracle2/r/basic_sql_part.result delete mode 100644 storage/spider/mysql-test/spider/oracle2/r/direct_aggregate.result delete mode 100644 storage/spider/mysql-test/spider/oracle2/r/direct_aggregate_part.result delete mode 100644 storage/spider/mysql-test/spider/oracle2/r/direct_update.result delete mode 100644 storage/spider/mysql-test/spider/oracle2/r/direct_update_part.result delete mode 100644 storage/spider/mysql-test/spider/oracle2/r/function.result delete mode 100644 storage/spider/mysql-test/spider/oracle2/r/ha.result delete mode 100644 storage/spider/mysql-test/spider/oracle2/r/ha_part.result delete mode 100644 storage/spider/mysql-test/spider/oracle2/r/spider3_fixes.result delete mode 100644 storage/spider/mysql-test/spider/oracle2/r/spider3_fixes_part.result delete mode 100644 storage/spider/mysql-test/spider/oracle2/r/spider_fixes.result delete mode 100644 storage/spider/mysql-test/spider/oracle2/r/spider_fixes_part.result delete mode 100644 storage/spider/mysql-test/spider/oracle2/r/vp_fixes.result delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/basic_sql.test delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/basic_sql_part.test delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/connect_child2_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/connect_child2_2.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/connect_child2_3.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/connect_child3_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/connect_child3_2.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/connect_child3_3.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/connect_master_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/connect_slave1_1.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/direct_aggregate.test delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/direct_aggregate_part.test delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/direct_update.test delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/direct_update_part.test delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/function.test delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/ha.test delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/ha_part.test delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/ha_test_deinit.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/ha_test_init.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/have_engine.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/have_func.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/have_partition.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/have_trigger.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/hs_test_deinit.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/hs_test_init.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/slave_test_deinit.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/slave_test_init.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/spider3_fixes.test delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/spider3_fixes_part.test delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/spider_fixes.test delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/spider_fixes_part.test delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/test_deinit.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/test_init.inc delete mode 100644 storage/spider/mysql-test/spider/oracle2/t/vp_fixes.test delete mode 100644 storage/spider/spd_db_oracle.cc delete mode 100644 storage/spider/spd_db_oracle.h diff --git a/storage/spider/CMakeLists.txt b/storage/spider/CMakeLists.txt index cde6de6142b..fc53295f5f7 100644 --- a/storage/spider/CMakeLists.txt +++ b/storage/spider/CMakeLists.txt @@ -14,17 +14,9 @@ SET(SPIDER_SOURCES spd_param.cc spd_sys_table.cc spd_trx.cc spd_db_conn.cc spd_conn.cc spd_table.cc spd_direct_sql.cc spd_udf.cc spd_ping_table.cc spd_copy_tables.cc spd_i_s.cc spd_malloc.cc ha_spider.cc spd_udf.def - spd_db_mysql.cc spd_db_oracle.cc spd_group_by_handler.cc spd_db_include.cc + spd_db_mysql.cc spd_group_by_handler.cc spd_db_include.cc ) -IF(DEFINED ENV{ORACLE_HOME}) - SET(ORACLE_HOME $ENV{ORACLE_HOME}) - FIND_PATH(ORACLE_INCLUDE_DIR oci.h PATHS ${ORACLE_HOME}/rdbms/public) - SET(ORACLE_OCI_LIB_NAME clntsh) - SET(ORACLE_LIB_DIR ${ORACLE_HOME}/lib) - FIND_LIBRARY(ORACLE_OCI_LIBRARY NAMES ${ORACLE_OCI_LIB_NAME} PATHS ${ORACLE_LIB_DIR}) -ENDIF() - IF(EXISTS ${PROJECT_SOURCE_DIR}/storage/mysql_storage_engine.cmake) SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_SYMDIR /Zi") @@ -55,16 +47,6 @@ ELSE() ENDIF() ENDIF() -IF(ORACLE_INCLUDE_DIR AND ORACLE_OCI_LIBRARY) - SET(SPIDER_WITH_ORACLE_OCI OFF CACHE BOOL "Spider is compiled with Oracle OCI library.") - IF(SPIDER_WITH_ORACLE_OCI) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_ORACLE_OCI -DLINUX -D_GNU_SOURCE -D_REENTRANT") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_ORACLE_OCI -DLINUX -D_GNU_SOURCE -D_REENTRANT") - INCLUDE_DIRECTORIES(${ORACLE_INCLUDE_DIR}) - TARGET_LINK_LIBRARIES (spider ${ORACLE_OCI_LIBRARY}) - ENDIF() -ENDIF() - IF(MSVC) IF (CMAKE_BUILD_TYPE STREQUAL "Debug") ADD_CUSTOM_COMMAND(TARGET spider diff --git a/storage/spider/mysql-test/spider/oracle/include/deinit_child2_1.inc b/storage/spider/mysql-test/spider/oracle/include/deinit_child2_1.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/oracle/include/deinit_child2_2.inc b/storage/spider/mysql-test/spider/oracle/include/deinit_child2_2.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/oracle/include/deinit_child2_3.inc b/storage/spider/mysql-test/spider/oracle/include/deinit_child2_3.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/oracle/include/deinit_child3_1.inc b/storage/spider/mysql-test/spider/oracle/include/deinit_child3_1.inc deleted file mode 100644 index 74c8efa90aa..00000000000 --- a/storage/spider/mysql-test/spider/oracle/include/deinit_child3_1.inc +++ /dev/null @@ -1,3 +0,0 @@ ---let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE ---let $INIT_TEST_ENGINE= $INIT_CHILD3_1_ENGINE ---source ../../include/deinit_engine.inc diff --git a/storage/spider/mysql-test/spider/oracle/include/deinit_child3_2.inc b/storage/spider/mysql-test/spider/oracle/include/deinit_child3_2.inc deleted file mode 100644 index f42a980ad23..00000000000 --- a/storage/spider/mysql-test/spider/oracle/include/deinit_child3_2.inc +++ /dev/null @@ -1,3 +0,0 @@ ---let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE ---let $INIT_TEST_ENGINE= $INIT_CHILD3_2_ENGINE ---source ../../include/deinit_engine.inc diff --git a/storage/spider/mysql-test/spider/oracle/include/deinit_child3_3.inc b/storage/spider/mysql-test/spider/oracle/include/deinit_child3_3.inc deleted file mode 100644 index 0696fb991cf..00000000000 --- a/storage/spider/mysql-test/spider/oracle/include/deinit_child3_3.inc +++ /dev/null @@ -1,3 +0,0 @@ ---let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE ---let $INIT_TEST_ENGINE= $INIT_CHILD3_3_ENGINE ---source ../../include/deinit_engine.inc diff --git a/storage/spider/mysql-test/spider/oracle/include/deinit_master_1.inc b/storage/spider/mysql-test/spider/oracle/include/deinit_master_1.inc deleted file mode 100644 index c19e376d10a..00000000000 --- a/storage/spider/mysql-test/spider/oracle/include/deinit_master_1.inc +++ /dev/null @@ -1 +0,0 @@ ---source ../../include/deinit_spider.inc diff --git a/storage/spider/mysql-test/spider/oracle/include/deinit_slave1_1.inc b/storage/spider/mysql-test/spider/oracle/include/deinit_slave1_1.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child2_1.inc b/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child2_1.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child2_2.inc b/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child2_2.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child2_3.inc b/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child2_3.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_1.inc b/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_1.inc deleted file mode 100644 index c19e376d10a..00000000000 --- a/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_1.inc +++ /dev/null @@ -1 +0,0 @@ ---source ../../include/deinit_spider.inc diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_2.inc b/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_2.inc deleted file mode 100644 index c19e376d10a..00000000000 --- a/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_2.inc +++ /dev/null @@ -1 +0,0 @@ ---source ../../include/deinit_spider.inc diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_3.inc b/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_3.inc deleted file mode 100644 index c19e376d10a..00000000000 --- a/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_3.inc +++ /dev/null @@ -1 +0,0 @@ ---source ../../include/deinit_spider.inc diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_deinit_master_1.inc b/storage/spider/mysql-test/spider/oracle/include/ha_deinit_master_1.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_init_child2_1.inc b/storage/spider/mysql-test/spider/oracle/include/ha_init_child2_1.inc deleted file mode 100644 index 2684829408d..00000000000 --- a/storage/spider/mysql-test/spider/oracle/include/ha_init_child2_1.inc +++ /dev/null @@ -1,8 +0,0 @@ -let $CHILD2_1_HA_AS_DROP_TABLES= - $CHILD2_1_DROP_TABLES; -let $CHILD2_1_HA_AS_CREATE_TABLES= - $CHILD2_1_CREATE_TABLES; -let $CHILD2_1_HA_AS_DROP_TABLES2= - $CHILD2_1_DROP_TABLES2; -let $CHILD2_1_HA_AS_CREATE_TABLES2= - $CHILD2_1_CREATE_TABLES2; diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_init_child2_2.inc b/storage/spider/mysql-test/spider/oracle/include/ha_init_child2_2.inc deleted file mode 100644 index 205eaa6fe35..00000000000 --- a/storage/spider/mysql-test/spider/oracle/include/ha_init_child2_2.inc +++ /dev/null @@ -1,4 +0,0 @@ -let $CHILD2_2_HA_DROP_TABLES= - $CHILD2_2_DROP_TABLES; -let $CHILD2_2_HA_CREATE_TABLES= - $CHILD2_2_CREATE_TABLES; diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_init_child2_3.inc b/storage/spider/mysql-test/spider/oracle/include/ha_init_child2_3.inc deleted file mode 100644 index 55cb858372c..00000000000 --- a/storage/spider/mysql-test/spider/oracle/include/ha_init_child2_3.inc +++ /dev/null @@ -1,4 +0,0 @@ -let $CHILD2_3_HA_DROP_TABLES= - $CHILD2_3_DROP_TABLES; -let $CHILD2_3_HA_CREATE_TABLES= - $CHILD2_3_CREATE_TABLES; diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_init_child3_1.inc b/storage/spider/mysql-test/spider/oracle/include/ha_init_child3_1.inc deleted file mode 100644 index 8357f0bdbc2..00000000000 --- a/storage/spider/mysql-test/spider/oracle/include/ha_init_child3_1.inc +++ /dev/null @@ -1,140 +0,0 @@ ---let $CHILD3_1_ENGINE_TYPE=Spider ---let $CHILD3_1_ENGINE=ENGINE=Spider ---source ../include/init_spider.inc -eval INSERT INTO mysql.spider_link_mon_servers -(db_name, table_name, link_id, sid, server, scheme, host, port, socket, - username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key, - ssl_verify_server_cert, default_file, default_group) VALUES -('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), -('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), -('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL); -let $CHILD3_1_CHECK_LINK_STATUS= - SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables - ORDER BY db_name, table_name, link_id; -let $CHILD3_1_CHECK_LINK_FAILED_LOG= - SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; -let $CHILD3_1_SET_RECOVERY_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2", lst "0 2"'; -let $CHILD3_1_SET_OK_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2", lst "0 1"'; -let $CHILD3_1_SET_OK_STATUS_AS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2", lst "1 0"'; - -let $CHILD3_1_DROP_TABLES_HA_2_1= - DROP TABLE IF EXISTS ta_l; -if ($VERSION_COMPILE_OS_WIN) -{ - let $CHILD3_1_CREATE_TABLES_HA_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2"'; - let $CHILD3_1_CREATE_TABLES_HA_AS_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2"'; -} -if (!$VERSION_COMPILE_OS_WIN) -{ - let $CHILD3_1_CREATE_TABLES_HA_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2"'; - let $CHILD3_1_CREATE_TABLES_HA_AS_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2"'; -} -let $CHILD3_1_DROP_TABLES_HA_P_2_1= - DROP TABLE IF EXISTS ta_l2; -let $CHILD3_1_CREATE_TABLES_HA_P_2_1= - CREATE TABLE ta_l2 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $CHILD3_1_CREATE_TABLES_HA_AS_P_2_1= - CREATE TABLE ta_l2 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $CHILD3_1_SET_RECOVERY_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 2"' - ); -let $CHILD3_1_SET_OK_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 1"' - ); -let $CHILD3_1_SET_OK_STATUS_AS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "1 0"' - ); diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_init_child3_2.inc b/storage/spider/mysql-test/spider/oracle/include/ha_init_child3_2.inc deleted file mode 100644 index 3ffcec24f51..00000000000 --- a/storage/spider/mysql-test/spider/oracle/include/ha_init_child3_2.inc +++ /dev/null @@ -1,140 +0,0 @@ ---let $CHILD3_2_ENGINE_TYPE=Spider ---let $CHILD3_2_ENGINE=ENGINE=Spider ---source ../include/init_spider.inc -eval INSERT INTO mysql.spider_link_mon_servers -(db_name, table_name, link_id, sid, server, scheme, host, port, socket, - username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key, - ssl_verify_server_cert, default_file, default_group) VALUES -('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), -('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), -('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL); -let $CHILD3_2_CHECK_LINK_STATUS= - SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables - ORDER BY db_name, table_name, link_id; -let $CHILD3_2_CHECK_LINK_FAILED_LOG= - SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; -let $CHILD3_2_SET_RECOVERY_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2", lst "0 2"'; -let $CHILD3_2_SET_OK_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2", lst "0 1"'; -let $CHILD3_2_SET_OK_STATUS_AS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2", lst "1 0"'; - -let $CHILD3_2_DROP_TABLES_HA_2_1= - DROP TABLE IF EXISTS ta_l; -if ($VERSION_COMPILE_OS_WIN) -{ - let $CHILD3_2_CREATE_TABLES_HA_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2"'; - let $CHILD3_2_CREATE_TABLES_HA_AS_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2"'; -} -if (!$VERSION_COMPILE_OS_WIN) -{ - let $CHILD3_2_CREATE_TABLES_HA_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2"'; - let $CHILD3_2_CREATE_TABLES_HA_AS_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2"'; -} -let $CHILD3_2_DROP_TABLES_HA_P_2_1= - DROP TABLE IF EXISTS ta_l2; -let $CHILD3_2_CREATE_TABLES_HA_P_2_1= - CREATE TABLE ta_l2 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $CHILD3_2_CREATE_TABLES_HA_AS_P_2_1= - CREATE TABLE ta_l2 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $CHILD3_2_SET_RECOVERY_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 2"' - ); -let $CHILD3_2_SET_OK_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 1"' - ); -let $CHILD3_2_SET_OK_STATUS_AS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "1 0"' - ); diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_init_child3_3.inc b/storage/spider/mysql-test/spider/oracle/include/ha_init_child3_3.inc deleted file mode 100644 index 67bd00109f5..00000000000 --- a/storage/spider/mysql-test/spider/oracle/include/ha_init_child3_3.inc +++ /dev/null @@ -1,140 +0,0 @@ ---let $CHILD3_3_ENGINE_TYPE=Spider ---let $CHILD3_3_ENGINE=ENGINE=Spider ---source ../include/init_spider.inc -eval INSERT INTO mysql.spider_link_mon_servers -(db_name, table_name, link_id, sid, server, scheme, host, port, socket, - username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key, - ssl_verify_server_cert, default_file, default_group) VALUES -('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), -('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), -('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL); -let $CHILD3_3_CHECK_LINK_STATUS= - SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables - ORDER BY db_name, table_name, link_id; -let $CHILD3_3_CHECK_LINK_FAILED_LOG= - SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; -let $CHILD3_3_SET_RECOVERY_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2", lst "0 2"'; -let $CHILD3_3_SET_OK_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2", lst "0 1"'; -let $CHILD3_3_SET_OK_STATUS_AS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2", lst "1 0"'; - -let $CHILD3_3_DROP_TABLES_HA_2_1= - DROP TABLE IF EXISTS ta_l; -if ($VERSION_COMPILE_OS_WIN) -{ - let $CHILD3_3_CREATE_TABLES_HA_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2"'; - let $CHILD3_3_CREATE_TABLES_HA_AS_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2"'; -} -if (!$VERSION_COMPILE_OS_WIN) -{ - let $CHILD3_3_CREATE_TABLES_HA_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2"'; - let $CHILD3_3_CREATE_TABLES_HA_AS_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2"'; -} -let $CHILD3_3_DROP_TABLES_HA_P_2_1= - DROP TABLE IF EXISTS ta_l2; -let $CHILD3_3_CREATE_TABLES_HA_P_2_1= - CREATE TABLE ta_l2 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $CHILD3_3_CREATE_TABLES_HA_AS_P_2_1= - CREATE TABLE ta_l2 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $CHILD3_3_SET_RECOVERY_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 2"' - ); -let $CHILD3_3_SET_OK_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 1"' - ); -let $CHILD3_3_SET_OK_STATUS_AS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "1 0"' - ); diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_init_master_1.inc b/storage/spider/mysql-test/spider/oracle/include/ha_init_master_1.inc deleted file mode 100644 index 8ace39ab641..00000000000 --- a/storage/spider/mysql-test/spider/oracle/include/ha_init_master_1.inc +++ /dev/null @@ -1,109 +0,0 @@ -eval INSERT INTO mysql.spider_link_mon_servers -(db_name, table_name, link_id, sid, server, scheme, host, port, socket, - username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key, - ssl_verify_server_cert, default_file, default_group) VALUES -('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), -('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), -('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL); -let $MASTER_1_CHECK_LINK_STATUS= - SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables - ORDER BY db_name, table_name, link_id; -let $MASTER_1_CHECK_LINK_FAILED_LOG= - SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; -let $MASTER_1_SET_RECOVERY_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "$ORACLE_HOST", user "$ORACLE_USER", - password "$ORACLE_PASSWORD", msi "$CHILD3_1_SERVER_ID", mkd "2", - database "$ORACLE_DATABASE", lst "0 2"'; -let $MASTER_1_SET_OK_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "$ORACLE_HOST", user "$ORACLE_USER", - password "$ORACLE_PASSWORD", msi "$CHILD3_1_SERVER_ID", mkd "2", - database "$ORACLE_DATABASE", lst "0 1"'; -let $MASTER_1_SET_OK_STATUS_AS_2_1= - ALTER TABLE ta_l - CONNECTION='host "$ORACLE_HOST", user "$ORACLE_USER", - password "$ORACLE_PASSWORD", msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "$ORACLE_DATABASE", lst "1 0"'; -let $MASTER_1_COPY_TABLES_2_1= - SELECT spider_copy_tables('ta_l', '0', '1'); - -if ($VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT_HA_2_1= - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3", - wrapper "oracle"' - CONNECTION='host "$ORACLE_HOST", user "$ORACLE_USER", - password "$ORACLE_PASSWORD", msi "$CHILD3_1_SERVER_ID", mkd "2", - database "$ORACLE_DATABASE"'; - let $MASTER_1_COMMENT_HA_AS_2_1= - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3", - wrapper "oracle"' - CONNECTION='host "$ORACLE_HOST", user "$ORACLE_USER", - password "$ORACLE_PASSWORD", msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "$ORACLE_DATABASE"'; -} -if (!$VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT_HA_2_1= - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3", - wrapper "oracle"' - CONNECTION='host "$ORACLE_HOST", user "$ORACLE_USER", - password "$ORACLE_PASSWORD", msi "$CHILD3_1_SERVER_ID", mkd "2", - database "$ORACLE_DATABASE"'; - let $MASTER_1_COMMENT_HA_AS_2_1= - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3", - wrapper "oracle"' - CONNECTION='host "$ORACLE_HOST", user "$ORACLE_USER", - password "$ORACLE_PASSWORD", msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "$ORACLE_DATABASE"'; -} -let $MASTER_1_COMMENT_HA_P_2_1= - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $MASTER_1_COMMENT_HA_AS_P_2_1= - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $MASTER_1_SET_RECOVERY_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 2"' - ); -let $MASTER_1_SET_OK_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 1"' - ); -let $MASTER_1_SET_OK_STATUS_AS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "1 0"' - ); -let $MASTER_1_COPY_TABLES_P_2_1= - SELECT spider_copy_tables('ta_l2#P#pt2', '0', '1'); -let $MASTER_1_CHECK_HA_STATUS= - SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; -let $MASTER_1_CHANGE_HA_MON= - SELECT spider_flush_table_mon_cache(); diff --git a/storage/spider/mysql-test/spider/oracle/include/hs_deinit_child2_1.inc b/storage/spider/mysql-test/spider/oracle/include/hs_deinit_child2_1.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/oracle/include/hs_deinit_child2_2.inc b/storage/spider/mysql-test/spider/oracle/include/hs_deinit_child2_2.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/oracle/include/hs_deinit_child2_3.inc b/storage/spider/mysql-test/spider/oracle/include/hs_deinit_child2_3.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/oracle/include/hs_deinit_master_1.inc b/storage/spider/mysql-test/spider/oracle/include/hs_deinit_master_1.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/oracle/include/hs_init_child2_1.inc b/storage/spider/mysql-test/spider/oracle/include/hs_init_child2_1.inc deleted file mode 100644 index f3f92a61e6f..00000000000 --- a/storage/spider/mysql-test/spider/oracle/include/hs_init_child2_1.inc +++ /dev/null @@ -1,24 +0,0 @@ -let $CHILD2_1_HS_DROP_TABLES= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "hs_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_HS_CREATE_TABLES= - SELECT spider_direct_sql('CREATE TABLE "hs_r" ( - "a" INT DEFAULT 10, - "b" CHAR(1) DEFAULT \'c\', - "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), - "d" INT DEFAULT 11, - CONSTRAINT "pk_s_2_1_hs_r" PRIMARY KEY("a") - )', '', 'srv "s_2_1"'); -let $CHILD2_1_HS_SELECT_TABLES= - SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\'), "d" FROM "hs_r" ORDER BY "a"', '', 'srv "s_2_1"'); -let $CHILD2_1_HS_DROP_TABLES2= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "hs_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_HS_CREATE_TABLES2= - SELECT spider_direct_sql('CREATE TABLE "hs_r2" ( - "a" INT DEFAULT 10, - "b" CHAR(1) DEFAULT \'c\', - "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), - "d" INT DEFAULT 11, - CONSTRAINT "pk_s_2_1_hs_r2" PRIMARY KEY("a") - )', '', 'srv "s_2_1"'); -let $CHILD2_1_HS_SELECT_TABLES2= - SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\'), "d" FROM "hs_r2" ORDER BY "a"', '', 'srv "s_2_1"'); diff --git a/storage/spider/mysql-test/spider/oracle/include/hs_init_child2_2.inc b/storage/spider/mysql-test/spider/oracle/include/hs_init_child2_2.inc deleted file mode 100644 index 4bd8d49c17c..00000000000 --- a/storage/spider/mysql-test/spider/oracle/include/hs_init_child2_2.inc +++ /dev/null @@ -1,12 +0,0 @@ -let $CHILD2_2_HS_DROP_TABLES= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "hs_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"'); -let $CHILD2_2_HS_CREATE_TABLES= - SELECT spider_direct_sql('CREATE TABLE "hs_r3" ( - "a" INT DEFAULT 10, - "b" CHAR(1) DEFAULT \'c\', - "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), - "d" INT DEFAULT 11, - CONSTRAINT "pk_s_2_2_hs_r3" PRIMARY KEY("a") - )', '', 'srv "s_2_2"'); -let $CHILD2_2_HS_SELECT_TABLES= - SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\'), "d" FROM "hs_r3" ORDER BY "a"', '', 'srv "s_2_2"'); diff --git a/storage/spider/mysql-test/spider/oracle/include/hs_init_child2_3.inc b/storage/spider/mysql-test/spider/oracle/include/hs_init_child2_3.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/oracle/include/hs_init_master_1.inc b/storage/spider/mysql-test/spider/oracle/include/hs_init_master_1.inc deleted file mode 100644 index 0ff5e2a10d9..00000000000 --- a/storage/spider/mysql-test/spider/oracle/include/hs_init_master_1.inc +++ /dev/null @@ -1,12 +0,0 @@ -let $MASTER_1_HS_COMMENT_TMP= - COMMENT=''; -let $MASTER_1_HS_COMMENT_2_1= - COMMENT='srv "s_2_1", table "hs_r", uhr "1", uhw "1", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT"'; -let $MASTER_1_HS_COMMENT_P_2_1= - COMMENT='uhr "1", uhw "1"' - PARTITION BY RANGE(a) ( - PARTITION pt1 VALUES LESS THAN (4) - COMMENT='srv "s_2_1", table "hs_r2", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT"', - PARTITION pt2 VALUES LESS THAN MAXVALUE - COMMENT='srv "s_2_2", table "hs_r3", hrp "$CHILD2_2_HSRPORT", hwp "$CHILD2_2_HSWPORT"' - ); diff --git a/storage/spider/mysql-test/spider/oracle/include/init_child2_1.inc b/storage/spider/mysql-test/spider/oracle/include/init_child2_1.inc deleted file mode 100644 index c24736eefca..00000000000 --- a/storage/spider/mysql-test/spider/oracle/include/init_child2_1.inc +++ /dev/null @@ -1,192 +0,0 @@ ---connection master_1 -SELECT spider_direct_sql('ALTER SESSION SET NLS_DATE_FORMAT=\'YYYY-MM-DD HH24:MI:SS\'', '', 'srv "s_2_1"'); -SELECT spider_direct_sql('ALTER SESSION SET NLS_TIME_FORMAT=\'HH24:MI:SSXFF\'', '', 'srv "s_2_1"'); -SELECT spider_direct_sql('ALTER SESSION SET NLS_TIMESTAMP_FORMAT=\'YYYY-MM-DD HH24:MI:SSXFF\'', '', 'srv "s_2_1"'); -let $CHILD2_1_DROP_TABLES= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_CREATE_TABLES= - SELECT spider_direct_sql('CREATE TABLE "ta_r" ( - "a" INT DEFAULT 10, - "b" CHAR(1) DEFAULT \'c\', - "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), - CONSTRAINT "pk_s_2_1_ta_r" PRIMARY KEY("a") - )', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE INDEX "idx1" ON "ta_r"("b")', '', 'srv "s_2_1"'); -let $CHILD2_1_SELECT_TABLES= - SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r" ORDER BY "a"', '', 'srv "s_2_1"'); -let $CHILD2_1_DROP_TABLES2= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_CREATE_TABLES2= - SELECT spider_direct_sql('CREATE TABLE "ta_r2" ( - "a" INT DEFAULT 10, - "b" CHAR(1) DEFAULT \'c\', - "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), - CONSTRAINT "pk_s_2_1_ta_r2" PRIMARY KEY("a") - )', '', 'srv "s_2_1"'); -let $CHILD2_1_SELECT_TABLES2= - SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r2" ORDER BY "a"', '', 'srv "s_2_1"'); -let $CHILD2_1_DROP_TABLES3= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r_no_idx"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_CREATE_TABLES3= - SELECT spider_direct_sql('CREATE TABLE "ta_r_no_idx" ( - "a" INT DEFAULT 10, - "b" CHAR(1) DEFAULT \'c\', - "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\') - )', '', 'srv "s_2_1"'); -let $CHILD2_1_SELECT_TABLES3= - SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r_no_idx" ORDER BY "a"', '', 'srv "s_2_1"'); -let $CHILD2_1_DROP_TABLES4= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r_auto_inc"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_CREATE_TABLES4= - SELECT spider_direct_sql('CREATE TABLE "ta_r_auto_inc" ( - "a" INT DEFAULT 10, - "b" CHAR(1) DEFAULT \'c\', - "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), - CONSTRAINT "pk_s_2_1_ta_r_auto_inc" PRIMARY KEY("a") - )', '', 'srv "s_2_1"'); -let $CHILD2_1_SELECT_TABLES4= - SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r_auto_inc" - ORDER BY "a"', '', 'srv "s_2_1"'); -let $CHILD2_1_DROP_TABLES5= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "s_2_1_ta_r_int"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_CREATE_TABLES5= - SELECT spider_direct_sql('CREATE TABLE "s_2_1_ta_r_int" ( - "a" INT DEFAULT 3, - "b" INT DEFAULT 10, - "c" INT DEFAULT 11, - CONSTRAINT "pk_s_2_1_ta_r_int" PRIMARY KEY("a") - )', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE INDEX "idx1_s_2_1_ta_r_int" ON "s_2_1_ta_r_int"("b")', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE INDEX "idx2_s_2_1_ta_r_int" ON "s_2_1_ta_r_int"("c")', '', 'srv "s_2_1"'); -let $CHILD2_1_SELECT_TABLES5= - SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "s_2_1_ta_r_int" ORDER BY "a"', '', 'srv "s_2_1"'); -let $CHILD2_1_DROP_TABLES6= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r_3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_CREATE_TABLES6= - SELECT spider_direct_sql('CREATE TABLE "ta_r_3" ( - "a" INT DEFAULT 10, - "b" CHAR(1) DEFAULT \'c\', - "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\') - )', '', 'srv "s_2_1"'); -let $CHILD2_1_SELECT_TABLES6= - SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r_3" ORDER BY "a"', '', 'srv "s_2_1"'); -let $CHILD2_1_DROP_FT_TABLES= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ft_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_CREATE_FT_TABLES= - SELECT spider_direct_sql('CREATE TABLE "ft_r" ( - "a" INT DEFAULT 0, - "b" TEXT, - "c" TEXT, - "d" TEXT, - CONSTRAINT "pk_s_2_1_ft_r" PRIMARY KEY("a"), - FULLTEXT INDEX "ft_idx1"("b"), - FULLTEXT INDEX "ft_idx2"("c") - )', '', 'srv "s_2_1"'); -let $CHILD2_1_SELECT_FT_TABLES= - SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "ft_r" ORDER BY "a"', '', 'srv "s_2_1"'); -let $CHILD2_1_DROP_FT_TABLES2= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ft_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_CREATE_FT_TABLES2= - SELECT spider_direct_sql('CREATE TABLE "ft_r2" ( - "a" INT DEFAULT 0, - "b" TEXT, - "c" TEXT, - "d" TEXT, - CONSTRAINT "pk_s_2_1_ft_r2" PRIMARY KEY("a"), - FULLTEXT INDEX "ft_idx1"("b"), - FULLTEXT INDEX "ft_idx2"("c") - )', '', 'srv "s_2_1"'); -let $CHILD2_1_SELECT_FT_TABLES2= - SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "ft_r2" ORDER BY "a"', '', 'srv "s_2_1"'); -let $CHILD2_1_DROP_GM_TABLES= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "gm_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_CREATE_GM_TABLES= - SELECT spider_direct_sql('CREATE TABLE "gm_r" ( - "a" INT DEFAULT 0, - "b" GEOMETRY NOT NULL, - "c" GEOMETRY NOT NULL, - CONSTRAINT "pk_s_2_1_gm_r" PRIMARY KEY("a"), - SPATIAL INDEX "sp_idx1"("b"), - SPATIAL INDEX "sp_idx2"("c") - )', '', 'srv "s_2_1"'); -let $CHILD2_1_SELECT_GM_TABLES= - SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "gm_r" ORDER BY "a"', '', 'srv "s_2_1"'); -let $CHILD2_1_DROP_GM_TABLES2= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "gm_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_CREATE_GM_TABLES2= - SELECT spider_direct_sql('CREATE TABLE "gm_r2" ( - "a" INT DEFAULT 0, - "b" GEOMETRY NOT NULL, - "c" GEOMETRY NOT NULL, - CONSTRAINT "pk_s_2_1_gm_r2" PRIMARY KEY("a"), - SPATIAL INDEX "sp_idx1"("b"), - SPATIAL INDEX "sp_idx2"("c") - )', '', 'srv "s_2_1"'); -let $CHILD2_1_SELECT_GM_TABLES2= - SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "gm_r2" ORDER BY "a"', '', 'srv "s_2_1"'); -let $CHILD2_1_DROP_LOCK_TABLES1= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_CREATE_LOCK_TABLES1= - SELECT spider_direct_sql('CREATE TABLE "t1_1" ( - "id" INT NOT NULL, - CONSTRAINT "pk_s_2_1_t1_1" PRIMARY KEY ("id") - )', '', 'srv "s_2_1"'); -let $CHILD2_1_DROP_LOCK_TABLES2= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t2_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_CREATE_LOCK_TABLES2= - SELECT spider_direct_sql('CREATE TABLE "t2_2" ( - "id" INT NOT NULL, - CONSTRAINT "pk_s_2_1_t2_2" PRIMARY KEY ("id") - )', '', 'srv "s_2_1"'); -let $CHILD2_1_DROP_INCREMENT_TABLES1= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_CREATE_INCREMENT_TABLES1= - SELECT spider_direct_sql('CREATE TABLE "t1_1" ( - "id" INT NOT NULL, - CONSTRAINT "pk_s_2_1_t1_1" PRIMARY KEY ("id") - )', '', 'srv "s_2_1"'); -let $CHILD2_1_SELECT_INCREMENT_TABLES1= - SELECT spider_direct_sql('SELECT "id" FROM "t1_1" ORDER BY "id"', '', 'srv "s_2_1"'); -let $CHILD2_1_DROP_TEXT_PK_TABLES1= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_CREATE_TEXT_PK_TABLES1= - SELECT spider_direct_sql('CREATE TABLE "t1" ( - "a" VARCHAR(255), - CONSTRAINT "pk_s_2_1_t1" PRIMARY KEY ("a") - )', '', 'srv "s_2_1"'); -let $CHILD2_1_SELECT_TEXT_PK_TABLES1= - SELECT spider_direct_sql('SELECT "a" FROM "t1" ORDER BY "a"', '', 'srv "s_2_1"'); -let $CHILD2_1_DROP_TEXT_KEY_TABLES1= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_CREATE_TEXT_KEY_TABLES1= - SELECT spider_direct_sql('CREATE TABLE "t1" ( - "a" VARCHAR(255), - "b" VARCHAR(255), - "c" VARCHAR(255), - CONSTRAINT "pk_s_2_1_t1" PRIMARY KEY ("c") - )', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE INDEX "idx1_t1" ON "t1"("a","b")', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE INDEX "idx2_t1" ON "t1"("b")', '', 'srv "s_2_1"'); -let $CHILD2_1_SELECT_TEXT_KEY_TABLES1= - SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "t1" ORDER BY "c"', '', 'srv "s_2_1"'); -let $CHILD2_1_AUTO_INCREMENT_INCREMENT1= - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_1"'); -let $CHILD2_1_AUTO_INCREMENT_INCREMENT2= - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"'); -let $CHILD2_1_AUTO_INCREMENT_OFFSET1= - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_1"'); -let $CHILD2_1_AUTO_INCREMENT_OFFSET2= - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"'); diff --git a/storage/spider/mysql-test/spider/oracle/include/init_child2_2.inc b/storage/spider/mysql-test/spider/oracle/include/init_child2_2.inc deleted file mode 100644 index fd4497c0b59..00000000000 --- a/storage/spider/mysql-test/spider/oracle/include/init_child2_2.inc +++ /dev/null @@ -1,94 +0,0 @@ ---connection master_1 -SELECT spider_direct_sql('ALTER SESSION SET NLS_DATE_FORMAT=\'YYYY-MM-DD HH24:MI:SS\'', '', 'srv "s_2_2"'); -SELECT spider_direct_sql('ALTER SESSION SET NLS_TIME_FORMAT=\'HH24:MI:SSXFF\'', '', 'srv "s_2_2"'); -SELECT spider_direct_sql('ALTER SESSION SET NLS_TIMESTAMP_FORMAT=\'YYYY-MM-DD HH24:MI:SSXFF\'', '', 'srv "s_2_2"'); -let $CHILD2_2_DROP_TABLES= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"'); -let $CHILD2_2_CREATE_TABLES= - SELECT spider_direct_sql('CREATE TABLE "ta_r3" ( - "a" INT DEFAULT 10, - "b" CHAR(1) DEFAULT \'c\', - "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), - CONSTRAINT "pk_s_2_2_ta_r3" PRIMARY KEY("a") - )', '', 'srv "s_2_2"'); -let $CHILD2_2_DROP_TABLES5= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "s_2_2_ta_r_int"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"'); -let $CHILD2_2_CREATE_TABLES5= - SELECT spider_direct_sql('CREATE TABLE "s_2_2_ta_r_int" ( - "a" INT DEFAULT 3, - "b" INT DEFAULT 10, - "c" INT DEFAULT 11, - CONSTRAINT "pk_s_2_2_ta_r_int" PRIMARY KEY("a") - )', '', 'srv "s_2_2"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE INDEX "idx1_s_2_2_ta_r_int" ON "s_2_2_ta_r_int"("b")', '', 'srv "s_2_2"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE INDEX "idx2_s_2_2_ta_r_int" ON "s_2_2_ta_r_int"("c")', '', 'srv "s_2_2"'); -let $CHILD2_2_SELECT_TABLES= - SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r3" ORDER BY "a"', '', 'srv "s_2_2"'); -let $CHILD2_2_DROP_FT_TABLES= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ft_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"'); -let $CHILD2_2_CREATE_FT_TABLES= - SELECT spider_direct_sql('CREATE TABLE "ft_r3" ( - "a" INT DEFAULT 0, - "b" TEXT, - "c" TEXT, - "d" TEXT, - CONSTRAINT "pk_s_2_2_ft_r3" PRIMARY KEY("a"), - FULLTEXT INDEX "ft_idx1"("b"), - FULLTEXT INDEX "ft_idx2"("c") - )', '', 'srv "s_2_2"'); -let $CHILD2_2_SELECT_FT_TABLES= - SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "ft_r3" ORDER BY "a"', '', 'srv "s_2_2"'); -let $CHILD2_2_DROP_GM_TABLES= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "gm_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"'); -let $CHILD2_2_CREATE_GM_TABLES= - SELECT spider_direct_sql('CREATE TABLE "gm_r3" ( - "a" INT DEFAULT 0, - "b" GEOMETRY NOT NULL, - "c" GEOMETRY NOT NULL, - CONSTRAINT "pk_s_2_2_gm_r3" PRIMARY KEY("a"), - SPATIAL INDEX "sp_idx1"("b"), - SPATIAL INDEX "sp_idx2"("c") - )', '', 'srv "s_2_2"'); -let $CHILD2_2_SELECT_GM_TABLES= - SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "gm_r3" ORDER BY "a"', '', 'srv "s_2_2"'); -let $CHILD2_2_DROP_LOCK_TABLES1= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"'); -let $CHILD2_2_CREATE_LOCK_TABLES1= - SELECT spider_direct_sql('CREATE TABLE "t1_2" ( - "id" INT NOT NULL, - CONSTRAINT "pk_s_2_2_t1_2" PRIMARY KEY ("id") - )', '', 'srv "s_2_2"'); -let $CHILD2_2_DROP_LOCK_TABLES2= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t2_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"'); -let $CHILD2_2_CREATE_LOCK_TABLES2= - SELECT spider_direct_sql('CREATE TABLE "t2_1" ( - "id" INT NOT NULL, - CONSTRAINT "pk_s_2_2_t2_1" PRIMARY KEY ("id") - )', '', 'srv "s_2_2"'); -let $CHILD2_2_DROP_INCREMENT_TABLES1= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"'); -let $CHILD2_2_CREATE_INCREMENT_TABLES1= - SELECT spider_direct_sql('CREATE TABLE "t1_2" ( - "id" INT NOT NULL, - CONSTRAINT "pk_s_2_2_t1_2" PRIMARY KEY ("id") - )', '', 'srv "s_2_2"'); -let $CHILD2_2_SELECT_INCREMENT_TABLES1= - SELECT spider_direct_sql('SELECT "id" FROM "t1_2" ORDER BY "id"', '', 'srv "s_2_2"'); -let $CHILD2_2_AUTO_INCREMENT_INCREMENT1= - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_2"'); -let $CHILD2_2_AUTO_INCREMENT_INCREMENT2= - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"'); -let $CHILD2_2_AUTO_INCREMENT_OFFSET1= - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_2"'); -let $CHILD2_2_AUTO_INCREMENT_OFFSET2= - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"'); diff --git a/storage/spider/mysql-test/spider/oracle/include/init_child2_3.inc b/storage/spider/mysql-test/spider/oracle/include/init_child2_3.inc deleted file mode 100644 index e16dfeffd81..00000000000 --- a/storage/spider/mysql-test/spider/oracle/include/init_child2_3.inc +++ /dev/null @@ -1,15 +0,0 @@ ---connection master_1 -SELECT spider_direct_sql('ALTER SESSION SET NLS_DATE_FORMAT=\'YYYY-MM-DD HH24:MI:SS\'', '', 'srv "s_2_3"'); -SELECT spider_direct_sql('ALTER SESSION SET NLS_TIME_FORMAT=\'HH24:MI:SSXFF\'', '', 'srv "s_2_3"'); -SELECT spider_direct_sql('ALTER SESSION SET NLS_TIMESTAMP_FORMAT=\'YYYY-MM-DD HH24:MI:SSXFF\'', '', 'srv "s_2_3"'); -let $CHILD2_3_DROP_TABLES= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r4"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_3"'); -let $CHILD2_3_CREATE_TABLES= - SELECT spider_direct_sql('CREATE TABLE "ta_r4" ( - "a" INT DEFAULT 10, - "b" CHAR(1) DEFAULT \'c\', - "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), - CONSTRAINT "pk_s_2_3_ta_r4" PRIMARY KEY("a") - )', '', 'srv "s_2_3"'); -let $CHILD2_3_SELECT_TABLES= - SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r4" ORDER BY "a"', '', 'srv "s_2_3"'); diff --git a/storage/spider/mysql-test/spider/oracle/include/init_child3_1.inc b/storage/spider/mysql-test/spider/oracle/include/init_child3_1.inc deleted file mode 100644 index d2d308cbefe..00000000000 --- a/storage/spider/mysql-test/spider/oracle/include/init_child3_1.inc +++ /dev/null @@ -1,3 +0,0 @@ ---let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE ---source ../../include/init_engine.inc ---let $INIT_CHILD3_1_ENGINE= $INIT_TEST_ENGINE diff --git a/storage/spider/mysql-test/spider/oracle/include/init_child3_2.inc b/storage/spider/mysql-test/spider/oracle/include/init_child3_2.inc deleted file mode 100644 index 3fbe1bd55bb..00000000000 --- a/storage/spider/mysql-test/spider/oracle/include/init_child3_2.inc +++ /dev/null @@ -1,3 +0,0 @@ ---let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE ---source ../../include/init_engine.inc ---let $INIT_CHILD3_2_ENGINE= $INIT_TEST_ENGINE diff --git a/storage/spider/mysql-test/spider/oracle/include/init_child3_3.inc b/storage/spider/mysql-test/spider/oracle/include/init_child3_3.inc deleted file mode 100644 index 3c7aaa8af84..00000000000 --- a/storage/spider/mysql-test/spider/oracle/include/init_child3_3.inc +++ /dev/null @@ -1,3 +0,0 @@ ---let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE ---source ../../include/init_engine.inc ---let $INIT_CHILD3_3_ENGINE= $INIT_TEST_ENGINE diff --git a/storage/spider/mysql-test/spider/oracle/include/init_master_1.inc b/storage/spider/mysql-test/spider/oracle/include/init_master_1.inc deleted file mode 100644 index 8e79b984364..00000000000 --- a/storage/spider/mysql-test/spider/oracle/include/init_master_1.inc +++ /dev/null @@ -1,149 +0,0 @@ ---source ../include/init_spider.inc -SET spider_direct_order_limit= 10000; -SET spider_init_sql_alloc_size= 1; -SET spider_conn_recycle_mode= 2; -let $MASTER_1_COMMENT_2_1= - COMMENT='database "$ORACLE_DATABASE", table "ta_r", wrapper "oracle", - pk_name "pk_s_2_1_ta_r"' - CONNECTION='host "$ORACLE_HOST", port "$ORACLE_PORT", user "$ORACLE_USER", - password "$ORACLE_PASSWORD"'; -let $MASTER_1_COMMENT2_2_1= - COMMENT='database "$ORACLE_DATABASE", table "ta_r_no_idx", wrapper "oracle", - pk_name "pk_s_2_1_ta_r_no_idx"' - CONNECTION='host "$ORACLE_HOST", port "$ORACLE_PORT", user "$ORACLE_USER", - password "$ORACLE_PASSWORD", prt "2000000"'; -let $MASTER_1_COMMENT_P_2_1= - COMMENT='table "ta_r3"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1", table "ta_r2", - priority "1000", pk_name "pk_s_2_1_ta_r2"', - PARTITION pt2 COMMENT='srv "s_2_2", priority "1000001", - pk_name "pk_s_2_2_ta_r3"' - ); -let $MASTER_1_COMMENT2_P_2_1= - COMMENT='table "ta_r3"' - PARTITION BY RANGE(a) ( - PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1", - table "ta_r2", priority "1000", pk_name "pk_s_2_1_ta_r2"', - PARTITION pt2 VALUES LESS THAN MAXVALUE - COMMENT='srv "s_2_2", priority "1000001", pk_name "pk_s_2_2_ta_r3"' - ); -let $MASTER_1_COMMENT3_2_1= - COMMENT='database "$ORACLE_DATABASE", table "ta_r_auto_inc", - wrapper "oracle"' - CONNECTION='host "$ORACLE_HOST", port "$ORACLE_PORT", user "$ORACLE_USER", - password "$ORACLE_PASSWORD", pk_name "pk_s_2_1_ta_r_auto_inc"'; -let $MASTER_1_COMMENT3_P_2_1= - COMMENT='table "s_2_1_ta_r_int"' - PARTITION BY LIST(MOD(a, 2)) ( - PARTITION pt1 VALUES IN (0) - COMMENT='srv "s_2_1", priority "1000", pk_name "pk_s_2_1_ta_r_int"', - PARTITION pt2 VALUES IN (1) - COMMENT='srv "s_2_2", priority "1000001", pk_name "pk_s_2_2_ta_r_int", - table "s_2_2_ta_r_int"' - ); -let $MASTER_1_COMMENT4_2_1= - COMMENT='database "$ORACLE_DATABASE", table "s_2_1_ta_r_int", - wrapper "oracle"' - CONNECTION='host "$ORACLE_HOST", port "$ORACLE_PORT", user "$ORACLE_USER", - password "$ORACLE_PASSWORD", pk_name "pk_s_2_1_ta_r_int"'; -let $MASTER_1_COMMENT5_2_1= - COMMENT='database "$ORACLE_DATABASE", table "ta_r_3", wrapper "oracle"' - CONNECTION='host "$ORACLE_HOST", port "$ORACLE_PORT", user "$ORACLE_USER", - password "$ORACLE_PASSWORD", pk_name "pk_s_2_1_ta_r_3"'; -let $MASTER_1_COMMENT_FT_2_1= - COMMENT='database "$ORACLE_DATABASE", table "ft_r", wrapper "oracle"' - CONNECTION='host "$ORACLE_HOST", port "$ORACLE_PORT", user "$ORACLE_USER", - password "$ORACLE_PASSWORD", pk_name "pk_s_2_1_ft_r"'; -let $MASTER_1_COMMENT2_FT_P_2_1= - COMMENT='table "ft_r3"' - PARTITION BY RANGE(a) ( - PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1", - table "ft_r2", priority "1000", pk_name "pk_s_2_1_ft_r2"', - PARTITION pt2 VALUES LESS THAN MAXVALUE - COMMENT='srv "s_2_2", priority "1000001", pk_name "pk_s_2_2_ft_r3"' - ); -let $MASTER_1_COMMENT_GM_2_1= - COMMENT='srv "s_2_1", table "gm_r", pk_name "pk_s_2_1_gm_r"'; -let $MASTER_1_COMMENT2_GM_P_2_1= - COMMENT='table "gm_r3"' - PARTITION BY RANGE(a) ( - PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1", - table "gm_r2", priority "1000", pk_name "pk_s_2_1_gm_r2"', - PARTITION pt2 VALUES LESS THAN MAXVALUE - COMMENT='srv "s_2_2", priority "1000001", pk_name "pk_s_2_2_gm_r3"' - ); -let $MASTER_1_COMMENT_LOCK1= - COMMENT 'tbl "t1_1 t1_2", srv "s_2_1 s_2_2", - pk_name "pk_s_2_1_t1_1 pk_s_2_2_t1_2"'; -let $MASTER_1_COMMENT_LOCK2= - COMMENT 'tbl "t2_1 t2_2", srv "s_2_2 s_2_1", - pk_name "pk_s_2_2_t2_1 pk_s_2_1_t2_2"'; -let $MASTER_1_COMMENT_INCREMENT1_1= - COMMENT 'aim "0", tbl "t1_1", srv "s_2_1", pk_name "pk_s_2_1_t1_1"'; -let $MASTER_1_COMMENT_INCREMENT1_P_1= - COMMENT 'aim "0"' - PARTITION BY LIST(MOD(id, 2)) ( - PARTITION pt1 VALUES IN (0) - COMMENT='tbl "t1_1", srv "s_2_1", pk_name "pk_s_2_1_t1_1"', - PARTITION pt2 VALUES IN (1) - COMMENT='tbl "t1_2", srv "s_2_2", pk_name "pk_s_2_2_t1_2"' - ); -let $MASTER_1_COMMENT_READONLY1_1= - COMMENT 'read_only_mode "1", tbl "t1_1", srv "s_2_1", - pk_name "pk_s_2_1_t1_1"'; -let $MASTER_1_COMMENT_ERROR_MODE1_1= - COMMENT 'erm "1", ewm "1", tbl "ter1_1", srv "s_2_1", - pk_name "pk_s_2_1_ter1_1"'; -let $MASTER_1_COMMENT_TEXT_PK1_1= - COMMENT 'tbl "t1", srv "s_2_1", pk_name "pk_s_2_1_t1"'; -let $MASTER_1_COMMENT_TEXT_KEY1_1= - COMMENT 'tbl "t1", srv "s_2_1", pk_name "pk_s_2_1_t1"'; -let $MASTER_1_CHECK_DIRECT_UPDATE_STATUS= - SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; -let $MASTER_1_CHECK_DIRECT_DELETE_STATUS= - SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%'; -let $MASTER_1_CHECK_DIRECT_ORDER_LIMIT_STATUS= - SHOW GLOBAL STATUS LIKE 'Spider_direct_order_limit%'; -let $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS= - SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; -let $MASTER_1_AUTO_INCREMENT_INCREMENT1= - SET SESSION AUTO_INCREMENT_INCREMENT = 1 $STR_SEMICOLON - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_2"'); -let $MASTER_1_AUTO_INCREMENT_INCREMENT2= - SET SESSION AUTO_INCREMENT_INCREMENT = 777 $STR_SEMICOLON - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"'); -let $MASTER_1_AUTO_INCREMENT_OFFSET1= - SET SESSION AUTO_INCREMENT_OFFSET = 1 $STR_SEMICOLON - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_2"'); -let $MASTER_1_AUTO_INCREMENT_OFFSET2= - SET SESSION AUTO_INCREMENT_OFFSET = 777 $STR_SEMICOLON - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"'); -let $MASTER_1_AUTO_INCREMENT_OFFSET3= - SET SESSION AUTO_INCREMENT_OFFSET = 1; -let $MASTER_1_AUTO_INCREMENT_OFFSET4= - SET SESSION AUTO_INCREMENT_OFFSET = 777; diff --git a/storage/spider/mysql-test/spider/oracle/include/init_slave1_1.inc b/storage/spider/mysql-test/spider/oracle/include/init_slave1_1.inc deleted file mode 100644 index 73c3c6b9ef2..00000000000 --- a/storage/spider/mysql-test/spider/oracle/include/init_slave1_1.inc +++ /dev/null @@ -1,10 +0,0 @@ -let $SLAVE1_1_COMMENT_INCREMENT1_1= - COMMENT ''; -let $SLAVE1_1_COMMENT_INCREMENT1_P_1= - COMMENT '' - PARTITION BY LIST(MOD(id, 2)) ( - PARTITION pt1 VALUES IN (0) - COMMENT='', - PARTITION pt2 VALUES IN (1) - COMMENT='' - ); diff --git a/storage/spider/mysql-test/spider/oracle/include/init_spider.inc b/storage/spider/mysql-test/spider/oracle/include/init_spider.inc deleted file mode 100644 index ff9ac9aee29..00000000000 --- a/storage/spider/mysql-test/spider/oracle/include/init_spider.inc +++ /dev/null @@ -1,105 +0,0 @@ ---source ../../include/init_spider.inc -let $VERSION_COMPILE_OS_WIN= - `SELECT IF(@@version_compile_os like 'Win%', 1, 0)`; -if ($VERSION_COMPILE_OS_WIN) -{ - eval DROP SERVER s_2_1; - eval CREATE SERVER s_2_1 FOREIGN DATA WRAPPER oracle OPTIONS ( - HOST '$ORACLE_HOST', - DATABASE '$ORACLE_DATABASE', - USER '$ORACLE_USER', - PASSWORD '$ORACLE_PASSWORD', - PORT $ORACLE_PORT - ); - eval DROP SERVER s_2_2; - eval CREATE SERVER s_2_2 FOREIGN DATA WRAPPER oracle OPTIONS ( - HOST '$ORACLE_HOST', - DATABASE '$ORACLE_DATABASE', - USER '$ORACLE_USER', - PASSWORD '$ORACLE_PASSWORD', - PORT $ORACLE_PORT - ); - eval DROP SERVER s_2_3; - eval CREATE SERVER s_2_3 FOREIGN DATA WRAPPER oracle OPTIONS ( - HOST '$ORACLE_HOST', - DATABASE '$ORACLE_DATABASE', - USER '$ORACLE_USER', - PASSWORD '$ORACLE_PASSWORD', - PORT $ORACLE_PORT - ); - eval DROP SERVER s_3_1; - eval CREATE SERVER s_3_1 FOREIGN DATA WRAPPER mysql OPTIONS ( - HOST 'localhost', - DATABASE 'auto_test_local', - USER 'root', - PASSWORD '', - PORT $CHILD3_1_MYPORT - ); - eval DROP SERVER s_3_2; - eval CREATE SERVER s_3_2 FOREIGN DATA WRAPPER mysql OPTIONS ( - HOST 'localhost', - DATABASE 'auto_test_local', - USER 'root', - PASSWORD '', - PORT $CHILD3_2_MYPORT - ); - eval DROP SERVER s_3_3; - eval CREATE SERVER s_3_3 FOREIGN DATA WRAPPER mysql OPTIONS ( - HOST 'localhost', - DATABASE 'auto_test_local', - USER 'root', - PASSWORD '', - PORT $CHILD2_3_MYPORT - ); -} -if (!$VERSION_COMPILE_OS_WIN) -{ - eval DROP SERVER s_2_1; - eval CREATE SERVER s_2_1 FOREIGN DATA WRAPPER oracle OPTIONS ( - HOST '$ORACLE_HOST', - DATABASE '$ORACLE_DATABASE', - USER '$ORACLE_USER', - PASSWORD '$ORACLE_PASSWORD', - PORT $ORACLE_PORT - ); - eval DROP SERVER s_2_2; - eval CREATE SERVER s_2_2 FOREIGN DATA WRAPPER oracle OPTIONS ( - HOST '$ORACLE_HOST', - DATABASE '$ORACLE_DATABASE', - USER '$ORACLE_USER', - PASSWORD '$ORACLE_PASSWORD', - PORT $ORACLE_PORT - ); - eval DROP SERVER s_2_3; - eval CREATE SERVER s_2_3 FOREIGN DATA WRAPPER oracle OPTIONS ( - HOST '$ORACLE_HOST', - DATABASE '$ORACLE_DATABASE', - USER '$ORACLE_USER', - PASSWORD '$ORACLE_PASSWORD', - PORT $ORACLE_PORT - ); - eval DROP SERVER s_3_1; - eval CREATE SERVER s_3_1 FOREIGN DATA WRAPPER mysql OPTIONS ( - HOST 'localhost', - DATABASE 'auto_test_local', - USER 'root', - PASSWORD '', - SOCKET '$CHILD3_1_MYSOCK' - ); - eval DROP SERVER s_3_2; - eval CREATE SERVER s_3_2 FOREIGN DATA WRAPPER mysql OPTIONS ( - HOST 'localhost', - DATABASE 'auto_test_local', - USER 'root', - PASSWORD '', - SOCKET '$CHILD3_2_MYSOCK' - ); - eval DROP SERVER s_3_3; - eval CREATE SERVER s_3_3 FOREIGN DATA WRAPPER mysql OPTIONS ( - HOST 'localhost', - DATABASE 'auto_test_local', - USER 'root', - PASSWORD '', - SOCKET '$CHILD3_3_MYSOCK' - ); -} diff --git a/storage/spider/mysql-test/spider/oracle/my.cnf b/storage/spider/mysql-test/spider/oracle/my.cnf deleted file mode 100644 index efa05c8e8b0..00000000000 --- a/storage/spider/mysql-test/spider/oracle/my.cnf +++ /dev/null @@ -1,146 +0,0 @@ -# Use default setting for mysqld processes -!include include/default_mysqld.cnf - -[mysqld.1.1] -log-bin= master-bin -loose_handlersocket_port= 20000 -loose_handlersocket_port_wr= 20001 -loose_handlersocket_threads= 2 -loose_handlersocket_threads_wr= 1 -loose_handlersocket_support_merge_table= 0 -loose_handlersocket_direct_update_mode= 2 -loose_handlersocket_unlimited_boundary= 65536 -loose_handlersocket_bulk_insert= 0 -loose_handlersocket_bulk_insert_timeout= 0 -loose_handlersocket_general_log= 1 -loose_handlersocket_timeout= 30 -loose_handlersocket_close_table_interval=2 -open_files_limit= 4096 -loose_partition= 1 - -[mysqld.3.1] -loose_partition= 1 - -[mysqld.3.2] -loose_partition= 1 - -[mysqld.3.3] -loose_partition= 1 - -[mysqld.4.1] -loose_partition= 1 - - -[ENV] -USE_GEOMETRY_TEST= 0 -USE_FULLTEXT_TEST= 0 -USE_HA_TEST= 1 -USE_GENERAL_LOG= 1 -USE_REPLICATION= 0 -MASTER_1_MYPORT= @mysqld.1.1.port -MASTER_1_HSRPORT= 20000 -MASTER_1_HSWPORT= 20001 -MASTER_1_MYSOCK= @mysqld.1.1.socket -MASTER_1_ENGINE_TYPE= Spider -#MASTER_1_ENGINE_TYPE= MyISAM -MASTER_1_ENGINE= ENGINE=Spider -MASTER_1_CHARSET= DEFAULT CHARSET=utf8 -MASTER_1_ENGINE2= ENGINE=MyISAM -MASTER_1_CHARSET2= DEFAULT CHARSET=utf8 -MASTER_1_CHARSET3= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci -SLAVE1_1_MYPORT= @mysqld.4.1.port -SLAVE1_1_MYSOCK= @mysqld.4.1.socket -SLAVE1_1_ENGINE_TYPE= MyISAM -SLAVE1_1_ENGINE= ENGINE=MyISAM -SLAVE1_1_CHARSET= DEFAULT CHARSET=utf8 -USE_CHILD_GROUP2= 1 -OUTPUT_CHILD_GROUP2= 0 -CHILD2_1_MYPORT= @mysqld.1.1.port -CHILD2_1_MYSOCK= @mysqld.1.1.socket -CHILD2_1_ENGINE_TYPE= InnoDB -CHILD2_1_ENGINE= ENGINE=InnoDB -CHILD2_1_CHARSET= DEFAULT CHARSET=utf8 -CHILD2_1_CHARSET2= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci -CHILD2_2_MYPORT= @mysqld.1.1.port -CHILD2_2_MYSOCK= @mysqld.1.1.socket -CHILD2_2_ENGINE_TYPE= InnoDB -CHILD2_2_ENGINE= ENGINE=InnoDB -CHILD2_2_CHARSET= DEFAULT CHARSET=utf8 -CHILD2_3_MYPORT= @mysqld.1.1.port -CHILD2_3_MYSOCK= @mysqld.1.1.socket -CHILD2_3_ENGINE_TYPE= InnoDB -CHILD2_3_ENGINE= ENGINE=InnoDB -CHILD2_3_CHARSET= DEFAULT CHARSET=utf8 -CHILD2_1_FT_MYPORT= @mysqld.1.1.port -CHILD2_1_FT_MYSOCK= @mysqld.1.1.socket -CHILD2_1_FT_ENGINE_TYPE= MyISAM -CHILD2_1_FT_ENGINE= ENGINE=MyISAM -CHILD2_1_FT_CHARSET= DEFAULT CHARSET=utf8 -CHILD2_2_FT_MYPORT= @mysqld.1.1.port -CHILD2_2_FT_MYSOCK= @mysqld.1.1.socket -CHILD2_2_FT_ENGINE_TYPE= MyISAM -CHILD2_2_FT_ENGINE= ENGINE=MyISAM -CHILD2_2_FT_CHARSET= DEFAULT CHARSET=utf8 -CHILD2_1_GM_MYPORT= @mysqld.1.1.port -CHILD2_1_GM_MYSOCK= @mysqld.1.1.socket -CHILD2_1_GM_ENGINE_TYPE= MyISAM -CHILD2_1_GM_ENGINE= ENGINE=MyISAM -CHILD2_1_GM_CHARSET= DEFAULT CHARSET=utf8 -CHILD2_2_GM_MYPORT= @mysqld.1.1.port -CHILD2_2_GM_MYSOCK= @mysqld.1.1.socket -CHILD2_2_GM_ENGINE_TYPE= MyISAM -CHILD2_2_GM_ENGINE= ENGINE=MyISAM -CHILD2_2_GM_CHARSET= DEFAULT CHARSET=utf8 -USE_CHILD_GROUP3= 1 -OUTPUT_CHILD_GROUP3= 0 -CHILD3_1_MYPORT= @mysqld.3.1.port -CHILD3_1_MYSOCK= @mysqld.3.1.socket -CHILD3_1_ENGINE_TYPE= InnoDB -CHILD3_1_ENGINE= ENGINE=InnoDB -CHILD3_1_CHARSET= DEFAULT CHARSET=utf8 -CHILD3_2_MYPORT= @mysqld.3.2.port -CHILD3_2_MYSOCK= @mysqld.3.2.socket -CHILD3_2_ENGINE_TYPE= InnoDB -CHILD3_2_ENGINE= ENGINE=InnoDB -CHILD3_2_CHARSET= DEFAULT CHARSET=utf8 -CHILD3_3_MYPORT= @mysqld.3.3.port -CHILD3_3_MYSOCK= @mysqld.3.3.socket -CHILD3_3_ENGINE_TYPE= InnoDB -CHILD3_3_ENGINE= ENGINE=InnoDB -CHILD3_3_CHARSET= DEFAULT CHARSET=utf8 -ORACLE_HOST= xe -ORACLE_PORT= 1521 -ORACLE_USER= system -ORACLE_PASSWORD= oracle -ORACLE_DATABASE= SYSTEM - -STR_SEMICOLON= ; - -#The followings are set in include/init_xxx.inc files -# MASTER_1_COMMENT_2_1 -# MASTER_1_COMMENT2_2_1 -# MASTER_1_COMMENT3_2_1 -# MASTER_1_COMMENT4_2_1 -# MASTER_1_COMMENT5_2_1 -# MASTER_1_COMMENT_P_2_1 -# CHILD2_1_DROP_TABLES -# CHILD2_1_CREATE_TABLES -# CHILD2_1_SELECT_TABLES -# CHILD2_1_DROP_TABLES2 -# CHILD2_1_CREATE_TABLES2 -# CHILD2_1_SELECT_TABLES2 -# CHILD2_1_DROP_TABLES3 -# CHILD2_1_CREATE_TABLES3 -# CHILD2_1_SELECT_TABLES3 -# CHILD2_1_DROP_TABLES4 -# CHILD2_1_CREATE_TABLES4 -# CHILD2_1_SELECT_TABLES4 -# CHILD2_1_DROP_TABLES5 -# CHILD2_1_CREATE_TABLES5 -# CHILD2_1_SELECT_TABLES5 -# CHILD2_1_DROP_TABLES6 -# CHILD2_1_CREATE_TABLES6 -# CHILD2_1_SELECT_TABLES6 -# CHILD2_2_DROP_TABLES -# CHILD2_2_CREATE_TABLES -# CHILD2_2_SELECT_TABLES diff --git a/storage/spider/mysql-test/spider/oracle/r/basic_sql.result b/storage/spider/mysql-test/spider/oracle/r/basic_sql.result deleted file mode 100644 index 1e9fe78acea..00000000000 --- a/storage/spider/mysql-test/spider/oracle/r/basic_sql.result +++ /dev/null @@ -1,634 +0,0 @@ -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -drop and create databases -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -CREATE DATABASE auto_test_remote; -USE auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -CREATE DATABASE auto_test_remote2; -USE auto_test_remote2; - -test select 1 -SELECT 1; -1 -1 - -create table select test -DROP TABLE IF EXISTS tb_l; -CREATE TABLE tb_l ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE2 MASTER_1_CHARSET2 -INSERT INTO tb_l (a, b, c) VALUES -(1, 'a', '2008-08-01 10:21:39'), -(2, 'b', '2000-01-01 00:00:00'), -(3, 'e', '2007-06-04 20:03:11'), -(4, 'd', '2003-11-30 05:01:03'), -(5, 'c', '2001-12-31 23:59:59'); -DROP TABLE IF EXISTS ta_l; -CREATE TABLE ta_l ( -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 -SELECT a, b, c FROM tb_l -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 - -create table ignore select test -DROP TABLE IF EXISTS ta_l; -DROP TABLE IF EXISTS tb_l; -CREATE TABLE tb_l ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE2 MASTER_1_CHARSET2 -INSERT INTO tb_l (a, b, c) VALUES -(1, 'f', '2008-07-01 10:21:39'), -(2, 'g', '2000-02-01 00:00:00'), -(3, 'j', '2007-05-04 20:03:11'), -(4, 'i', '2003-10-30 05:01:03'), -(5, 'h', '2001-10-31 23:59:59'); -CREATE TABLE ta_l ( -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 -IGNORE SELECT a, b, c FROM tb_l -Warnings: -Warning 1062 Duplicate entry '1' for key 'PRIMARY' -Warning 1062 Duplicate entry '2' for key 'PRIMARY' -Warning 1062 Duplicate entry '3' for key 'PRIMARY' -Warning 1062 Duplicate entry '4' for key 'PRIMARY' -Warning 1062 Duplicate entry '5' for key 'PRIMARY' -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 - -create table ignore select test -DROP TABLE IF EXISTS ta_l; -CREATE TABLE ta_l ( -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 -REPLACE SELECT a, b, c FROM tb_l -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -create no index table -DROP TABLE IF EXISTS ta_l_no_idx; -CREATE TABLE ta_l_no_idx -MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1 -SELECT a, b, c FROM tb_l -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l_no_idx ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -select table -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -select table shared mode -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a -LOCK IN SHARE MODE; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -select table for update -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a -FOR UPDATE; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -select table join -SELECT a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a, tb_l b -WHERE a.a = b.a ORDER BY a.a; -a b date_format(b.c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -select table straight_join -SELECT STRAIGHT_JOIN a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s') -FROM ta_l a, tb_l b WHERE a.a = b.a ORDER BY a.a; -a b date_format(b.c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -select sql_small_result -SELECT SQL_SMALL_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -select sql_big_result -SELECT SQL_BIG_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -select sql_buffer_result -SELECT SQL_BUFFER_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -select sql_cache -SELECT SQL_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -select sql_no_cache -SELECT SQL_NO_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -select sql_calc_found_rows -SELECT SQL_CALC_FOUND_ROWS a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a LIMIT 4; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -SELECT found_rows(); -found_rows() -5 - -select high_priority -SELECT HIGH_PRIORITY a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -select distinct -SELECT DISTINCT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -select count -SELECT count(*) FROM ta_l ORDER BY a; -count(*) -5 - -select table join not use index -SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM tb_l a WHERE -EXISTS (SELECT * FROM ta_l b WHERE b.b = a.b) ORDER BY a.a; -a b date_format(a.c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -select using pushdown -SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE -a.b = 'g' ORDER BY a.a; -a b date_format(a.c, '%Y-%m-%d %H:%i:%s') -2 g 2000-02-01 00:00:00 - -select using index and pushdown -SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE -a.a > 0 AND a.b = 'g' ORDER BY a.a; -a b date_format(a.c, '%Y-%m-%d %H:%i:%s') -2 g 2000-02-01 00:00:00 - -insert -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -2 e 2008-01-01 23:59:59 - -insert select -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -insert select a -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1), -'e', '2008-01-01 23:59:59'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 e 2008-01-01 23:59:59 - -insert low_priority -TRUNCATE TABLE ta_l; -INSERT LOW_PRIORITY INTO ta_l (a, b, c) values (2, 'e', '2008-01-01 23:59:59'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -2 e 2008-01-01 23:59:59 - -insert high_priority -TRUNCATE TABLE ta_l; -INSERT HIGH_PRIORITY INTO ta_l (a, b, c) VALUES (2, 'e', -'2008-01-01 23:59:59'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -2 e 2008-01-01 23:59:59 - -insert ignore -INSERT IGNORE INTO ta_l (a, b, c) VALUES (2, 'd', '2009-02-02 01:01:01'); -Warnings: -Warning 1062 Duplicate entry '2' for key 'PRIMARY' -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -2 e 2008-01-01 23:59:59 - -insert update (insert) -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE -KEY UPDATE b = 'f', c = '2005-08-08 11:11:11'; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -2 e 2008-01-01 23:59:59 - -insert update (update) -INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE -KEY UPDATE b = 'f', c = '2005-08-08 11:11:11'; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -2 f 2005-08-08 11:11:11 - -replace -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59'); -REPLACE INTO ta_l (a, b, c) VALUES (2, 'f', '2008-02-02 02:02:02'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -2 f 2008-02-02 02:02:02 - -replace select -REPLACE INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -replace select a -REPLACE INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1), -'e', '2008-01-01 23:59:59'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 e 2008-01-01 23:59:59 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -replace low_priority -REPLACE LOW_PRIORITY INTO ta_l (a, b, c) VALUES (3, 'g', -'2009-03-03 03:03:03'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 e 2008-01-01 23:59:59 -2 g 2000-02-01 00:00:00 -3 g 2009-03-03 03:03:03 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -update -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'); -UPDATE ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 e 2008-01-01 23:59:59 -2 f 2008-02-02 02:02:02 - -update select -UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a IN (SELECT a FROM -tb_l); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 g 2009-03-03 03:03:03 -2 g 2009-03-03 03:03:03 - -update select a -UPDATE ta_l SET b = 'h', c = '2010-04-04 04:04:04' WHERE a = (SELECT a FROM -tb_l ORDER BY a LIMIT 1); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 h 2010-04-04 04:04:04 -2 g 2009-03-03 03:03:03 - -update join -UPDATE ta_l a, tb_l b SET a.b = b.b, a.c = b.c WHERE a.a = b.a; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 - -update join a -UPDATE ta_l a, tb_l b SET a.b = 'g', a.c = '2009-03-03 03:03:03' WHERE -a.a = b.a; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 g 2009-03-03 03:03:03 -2 g 2009-03-03 03:03:03 - -update low_priority -UPDATE LOW_PRIORITY ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 g 2009-03-03 03:03:03 -2 f 2008-02-02 02:02:02 - -update ignore -UPDATE IGNORE ta_l SET a = 1, b = 'g', c = '2009-03-03 03:03:03' WHERE a = 2; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 g 2009-03-03 03:03:03 -2 f 2008-02-02 02:02:02 - -update pushdown -update ta_l set b = 'j', c = '2009-03-03 03:03:03' where b = 'f'; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 g 2009-03-03 03:03:03 -2 j 2009-03-03 03:03:03 - -update index pushdown -UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'j'; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 g 2009-03-03 03:03:03 -2 g 2009-03-03 03:03:03 - -delete -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -DELETE FROM ta_l WHERE a = 2; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 e 2008-01-01 23:59:59 -3 e 2008-01-01 23:59:59 -4 e 2008-01-01 23:59:59 -5 e 2008-01-01 23:59:59 -6 e 2008-01-01 23:59:59 -7 e 2008-01-01 23:59:59 -8 e 2008-01-01 23:59:59 -9 e 2008-01-01 23:59:59 -10 j 2008-01-01 23:59:59 - -delete all -DELETE FROM ta_l; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') - -delete select -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -DELETE FROM ta_l WHERE a IN (SELECT a FROM tb_l); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -6 e 2008-01-01 23:59:59 -7 e 2008-01-01 23:59:59 -8 e 2008-01-01 23:59:59 -9 e 2008-01-01 23:59:59 -10 j 2008-01-01 23:59:59 - -delete select a -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -DELETE FROM ta_l WHERE a = (SELECT a FROM tb_l ORDER BY a LIMIT 1); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -2 e 2008-01-01 23:59:59 -3 e 2008-01-01 23:59:59 -4 e 2008-01-01 23:59:59 -5 e 2008-01-01 23:59:59 -6 e 2008-01-01 23:59:59 -7 e 2008-01-01 23:59:59 -8 e 2008-01-01 23:59:59 -9 e 2008-01-01 23:59:59 -10 j 2008-01-01 23:59:59 - -delete join -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -DELETE a FROM ta_l a, (SELECT a FROM tb_l ORDER BY a) b WHERE a.a = b.a; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -6 e 2008-01-01 23:59:59 -7 e 2008-01-01 23:59:59 -8 e 2008-01-01 23:59:59 -9 e 2008-01-01 23:59:59 -10 j 2008-01-01 23:59:59 - -delete low_priority -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -DELETE LOW_PRIORITY FROM ta_l WHERE a = 2; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 e 2008-01-01 23:59:59 -3 e 2008-01-01 23:59:59 -4 e 2008-01-01 23:59:59 -5 e 2008-01-01 23:59:59 -6 e 2008-01-01 23:59:59 -7 e 2008-01-01 23:59:59 -8 e 2008-01-01 23:59:59 -9 e 2008-01-01 23:59:59 -10 j 2008-01-01 23:59:59 - -delete ignore -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -DELETE IGNORE FROM ta_l WHERE a = 2; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 e 2008-01-01 23:59:59 -3 e 2008-01-01 23:59:59 -4 e 2008-01-01 23:59:59 -5 e 2008-01-01 23:59:59 -6 e 2008-01-01 23:59:59 -7 e 2008-01-01 23:59:59 -8 e 2008-01-01 23:59:59 -9 e 2008-01-01 23:59:59 -10 j 2008-01-01 23:59:59 - -delete quick -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -DELETE QUICK FROM ta_l WHERE a = 2; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 e 2008-01-01 23:59:59 -3 e 2008-01-01 23:59:59 -4 e 2008-01-01 23:59:59 -5 e 2008-01-01 23:59:59 -6 e 2008-01-01 23:59:59 -7 e 2008-01-01 23:59:59 -8 e 2008-01-01 23:59:59 -9 e 2008-01-01 23:59:59 -10 j 2008-01-01 23:59:59 - -delete pushdown -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -DELETE FROM ta_l WHERE b = 'e'; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -10 j 2008-01-01 23:59:59 - -delete index pushdown -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -DELETE FROM ta_l WHERE a > 0 AND b = 'e'; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -10 j 2008-01-01 23:59:59 - -truncate -TRUNCATE TABLE ta_l; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') - -deinit -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -end of test diff --git a/storage/spider/mysql-test/spider/oracle/r/basic_sql_part.result b/storage/spider/mysql-test/spider/oracle/r/basic_sql_part.result deleted file mode 100644 index 9e1201c17c9..00000000000 --- a/storage/spider/mysql-test/spider/oracle/r/basic_sql_part.result +++ /dev/null @@ -1,121 +0,0 @@ -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -drop and create databases -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -CREATE DATABASE auto_test_remote; -USE auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -CREATE DATABASE auto_test_remote2; -USE auto_test_remote2; - -test select 1 -SELECT 1; -1 -1 -DROP TABLE IF EXISTS tb_l; -CREATE TABLE tb_l ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE2 MASTER_1_CHARSET2 -INSERT INTO tb_l (a, b, c) VALUES -(1, 'f', '2008-07-01 10:21:39'), -(2, 'g', '2000-02-01 00:00:00'), -(3, 'j', '2007-05-04 20:03:11'), -(4, 'i', '2003-10-30 05:01:03'), -(5, 'h', '2001-10-31 23:59:59'); - -create table with partition and select test -CREATE TABLE ta_l2 ( -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_COMMENT_P_2_1 -SELECT a, b, c FROM tb_l -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -select partition using pushdown -SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE -a.b = 'g' ORDER BY a.a; -a b date_format(a.c, '%Y-%m-%d %H:%i:%s') -2 g 2000-02-01 00:00:00 - -select partition using index pushdown -SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE -a.a > 0 AND a.b = 'g' ORDER BY a.a; -a b date_format(a.c, '%Y-%m-%d %H:%i:%s') -2 g 2000-02-01 00:00:00 - -update partition pushdown -UPDATE ta_l2 SET b = 'e', c = '2009-03-03 03:03:03' WHERE b = 'j'; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 e 2009-03-03 03:03:03 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -update partition index pushdown -UPDATE ta_l2 SET b = 'j', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'e'; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2009-03-03 03:03:03 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -delete partition pushdown -TRUNCATE TABLE ta_l2; -INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; -DELETE FROM ta_l2 WHERE b = 'g'; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -delete partition index pushdown -TRUNCATE TABLE ta_l2; -INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; -DELETE FROM ta_l2 WHERE a > 0 AND b = 'g'; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -deinit -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -end of test diff --git a/storage/spider/mysql-test/spider/oracle/r/direct_aggregate.result b/storage/spider/mysql-test/spider/oracle/r/direct_aggregate.result deleted file mode 100644 index fe5752cff65..00000000000 --- a/storage/spider/mysql-test/spider/oracle/r/direct_aggregate.result +++ /dev/null @@ -1,91 +0,0 @@ -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -drop and create databases -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -CREATE DATABASE auto_test_remote; -USE auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -CREATE DATABASE auto_test_remote2; -USE auto_test_remote2; - -test select 1 -SELECT 1; -1 -1 - -create table select test -DROP TABLE IF EXISTS ta_l; -CREATE TABLE ta_l ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 -INSERT INTO ta_l (a, b, c) VALUES -(1, 'a', '2008-08-01 10:21:39'), -(2, 'b', '2000-01-01 00:00:00'), -(3, 'e', '2007-06-04 20:03:11'), -(4, 'd', '2003-11-30 05:01:03'), -(5, 'c', '2001-12-31 23:59:59'); - -direct_aggregating test -SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; -Variable_name Value -Spider_direct_aggregate 0 -SELECT COUNT(*) FROM ta_l; -COUNT(*) -5 -SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; -Variable_name Value -Spider_direct_aggregate 1 -SELECT MAX(a) FROM ta_l; -MAX(a) -5 -SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; -Variable_name Value -Spider_direct_aggregate 1 -SELECT MIN(a) FROM ta_l; -MIN(a) -1 -SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; -Variable_name Value -Spider_direct_aggregate 1 -SELECT MAX(a) FROM ta_l WHERE a < 5; -MAX(a) -4 -SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; -Variable_name Value -Spider_direct_aggregate 1 -SELECT MIN(a) FROM ta_l WHERE a > 1; -MIN(a) -2 -SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; -Variable_name Value -Spider_direct_aggregate 1 - -deinit -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -end of test diff --git a/storage/spider/mysql-test/spider/oracle/r/direct_aggregate_part.result b/storage/spider/mysql-test/spider/oracle/r/direct_aggregate_part.result deleted file mode 100644 index 9bde4a1746a..00000000000 --- a/storage/spider/mysql-test/spider/oracle/r/direct_aggregate_part.result +++ /dev/null @@ -1,82 +0,0 @@ -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -drop and create databases -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -CREATE DATABASE auto_test_remote; -USE auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -CREATE DATABASE auto_test_remote2; -USE auto_test_remote2; - -test select 1 -SELECT 1; -1 -1 - -with partition test -CREATE TABLE ta_l2 ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1 -SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; -Variable_name Value -Spider_direct_aggregate 0 -SELECT COUNT(*) FROM ta_l2; -COUNT(*) -5 -SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; -Variable_name Value -Spider_direct_aggregate 2 -SELECT MAX(a) FROM ta_l2; -MAX(a) -5 -SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; -Variable_name Value -Spider_direct_aggregate 2 -SELECT MIN(a) FROM ta_l2; -MIN(a) -1 -SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; -Variable_name Value -Spider_direct_aggregate 2 -SELECT MAX(a) FROM ta_l2 WHERE a < 5; -MAX(a) -4 -SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; -Variable_name Value -Spider_direct_aggregate 2 -SELECT MIN(a) FROM ta_l2 WHERE a > 1; -MIN(a) -2 -SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; -Variable_name Value -Spider_direct_aggregate 2 - -deinit -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -end of test diff --git a/storage/spider/mysql-test/spider/oracle/r/direct_update.result b/storage/spider/mysql-test/spider/oracle/r/direct_update.result deleted file mode 100644 index 3dc39d5f630..00000000000 --- a/storage/spider/mysql-test/spider/oracle/r/direct_update.result +++ /dev/null @@ -1,138 +0,0 @@ -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -drop and create databases -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -CREATE DATABASE auto_test_remote; -USE auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -CREATE DATABASE auto_test_remote2; -USE auto_test_remote2; - -test select 1 -SELECT 1; -1 -1 - -create table select test -DROP TABLE IF EXISTS ta_l; -CREATE TABLE ta_l ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 -INSERT INTO ta_l (a, b, c) VALUES -(1, 'a', '2008-08-01 10:21:39'), -(2, 'b', '2000-01-01 00:00:00'), -(3, 'e', '2007-06-04 20:03:11'), -(4, 'd', '2003-11-30 05:01:03'), -(5, 'c', '2001-12-31 23:59:59'); - -direct_updating test -SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 -update all rows with function -UPDATE ta_l SET c = ADDDATE(c, 1); -SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -2 b 2000-01-02 00:00:00 -3 e 2007-06-05 20:03:11 -4 d 2003-12-01 05:01:03 -5 c 2002-01-01 23:59:59 -update by primary key -UPDATE ta_l SET b = 'x' WHERE a = 3; -SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -2 b 2000-01-02 00:00:00 -3 x 2007-06-05 20:03:11 -4 d 2003-12-01 05:01:03 -5 c 2002-01-01 23:59:59 -update by a column without index -UPDATE ta_l SET c = '2011-10-17' WHERE b = 'x'; -SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -2 b 2000-01-02 00:00:00 -3 x 2011-10-17 00:00:00 -4 d 2003-12-01 05:01:03 -5 c 2002-01-01 23:59:59 -update by primary key with order and limit -UPDATE ta_l SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1; -SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -2 b 2000-01-02 00:00:00 -3 x 2011-10-18 00:00:00 -4 d 2003-12-01 05:01:03 -5 c 2002-01-01 23:59:59 -delete by primary key with order and limit -DELETE FROM ta_l WHERE a < 4 ORDER BY c LIMIT 1; -SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -3 x 2011-10-18 00:00:00 -4 d 2003-12-01 05:01:03 -5 c 2002-01-01 23:59:59 -delete by a column without index -DELETE FROM ta_l WHERE b = 'c'; -SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -3 x 2011-10-18 00:00:00 -4 d 2003-12-01 05:01:03 -delete by primary key -DELETE FROM ta_l WHERE a = 3; -SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -4 d 2003-12-01 05:01:03 - -deinit -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -end of test diff --git a/storage/spider/mysql-test/spider/oracle/r/direct_update_part.result b/storage/spider/mysql-test/spider/oracle/r/direct_update_part.result deleted file mode 100644 index 8a22c40a0da..00000000000 --- a/storage/spider/mysql-test/spider/oracle/r/direct_update_part.result +++ /dev/null @@ -1,129 +0,0 @@ -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -drop and create databases -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -CREATE DATABASE auto_test_remote; -USE auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -CREATE DATABASE auto_test_remote2; -USE auto_test_remote2; - -test select 1 -SELECT 1; -1 -1 - -with partition test -CREATE TABLE ta_l2 ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1 -SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 -update all rows with function -UPDATE ta_l2 SET c = ADDDATE(c, 1); -SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -2 b 2000-01-02 00:00:00 -3 e 2007-06-05 20:03:11 -4 d 2003-12-01 05:01:03 -5 c 2002-01-01 23:59:59 -update by primary key -UPDATE ta_l2 SET b = 'x' WHERE a = 3; -SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -2 b 2000-01-02 00:00:00 -3 x 2007-06-05 20:03:11 -4 d 2003-12-01 05:01:03 -5 c 2002-01-01 23:59:59 -update by a column without index -UPDATE ta_l2 SET c = '2011-10-17' WHERE b = 'x'; -SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -2 b 2000-01-02 00:00:00 -3 x 2011-10-17 00:00:00 -4 d 2003-12-01 05:01:03 -5 c 2002-01-01 23:59:59 -update by primary key with order and limit -UPDATE ta_l2 SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1; -SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -2 b 2000-01-02 00:00:00 -3 x 2011-10-18 00:00:00 -4 d 2003-12-01 05:01:03 -5 c 2002-01-01 23:59:59 -delete by primary key with order and limit -DELETE FROM ta_l2 WHERE a < 4 ORDER BY c LIMIT 1; -SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -3 x 2011-10-18 00:00:00 -4 d 2003-12-01 05:01:03 -5 c 2002-01-01 23:59:59 -delete by a column without index -DELETE FROM ta_l2 WHERE b = 'c'; -SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -3 x 2011-10-18 00:00:00 -4 d 2003-12-01 05:01:03 -delete by primary key -DELETE FROM ta_l2 WHERE a = 3; -SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -4 d 2003-12-01 05:01:03 - -deinit -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -end of test diff --git a/storage/spider/mysql-test/spider/oracle/r/function.result b/storage/spider/mysql-test/spider/oracle/r/function.result deleted file mode 100644 index 764c774514b..00000000000 --- a/storage/spider/mysql-test/spider/oracle/r/function.result +++ /dev/null @@ -1,149 +0,0 @@ -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -drop and create databases -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -CREATE DATABASE auto_test_remote; -USE auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -CREATE DATABASE auto_test_remote2; -USE auto_test_remote2; - -test select 1 -SELECT 1; -1 -1 - -in() -CREATE TABLE t1 ( -a VARCHAR(255), -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET3 MASTER_1_COMMENT_TEXT_PK1_1 -insert into t1 values ('1'); -insert into t1 select a + 1 from t1; -insert into t1 select a + 2 from t1; -insert into t1 select a + 4 from t1; -insert into t1 select a + 8 from t1; -insert into t1 select a + 16 from t1; -insert into t1 select a + 32 from t1; -insert into t1 select a + 64 from t1; -insert into t1 select a + 128 from t1; -insert into t1 select a + 256 from t1; -insert into t1 select a + 512 from t1; -flush tables; -select a from t1 where a in ('15', '120'); -a -120 -15 - -date_sub() -DROP TABLE IF EXISTS ta_l; -CREATE TABLE ta_l ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 -INSERT INTO ta_l (a, b, c) VALUES -(1, 'a', '2008-08-01 10:21:39'), -(2, 'b', '2000-01-01 00:00:00'), -(3, 'e', '2007-06-04 20:03:11'), -(4, 'd', '2003-11-30 05:01:03'), -(5, 'c', '2001-12-31 23:59:59'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 -UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 YEAR); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2007-08-01 10:21:39 -2 b 1999-01-01 00:00:00 -3 e 2006-06-04 20:03:11 -4 d 2002-11-30 05:01:03 -5 c 2000-12-31 23:59:59 -UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 QUARTER); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2007-11-01 10:21:39 -2 b 1999-04-01 00:00:00 -3 e 2006-09-04 20:03:11 -4 d 2003-02-28 05:01:03 -5 c 2001-03-31 23:59:59 -UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 MONTH); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2007-10-01 10:21:39 -2 b 1999-03-01 00:00:00 -3 e 2006-08-04 20:03:11 -4 d 2003-01-28 05:01:03 -5 c 2001-02-28 23:59:59 -UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 WEEK); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2007-10-08 10:21:39 -2 b 1999-03-08 00:00:00 -3 e 2006-08-11 20:03:11 -4 d 2003-02-04 05:01:03 -5 c 2001-03-07 23:59:59 -UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 DAY); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2007-10-07 10:21:39 -2 b 1999-03-07 00:00:00 -3 e 2006-08-10 20:03:11 -4 d 2003-02-03 05:01:03 -5 c 2001-03-06 23:59:59 -UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 HOUR); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2007-10-07 11:21:39 -2 b 1999-03-07 01:00:00 -3 e 2006-08-10 21:03:11 -4 d 2003-02-03 06:01:03 -5 c 2001-03-07 00:59:59 -UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 MINUTE); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2007-10-07 11:20:39 -2 b 1999-03-07 00:59:00 -3 e 2006-08-10 21:02:11 -4 d 2003-02-03 06:00:03 -5 c 2001-03-07 00:58:59 -UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 SECOND); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2007-10-07 11:20:40 -2 b 1999-03-07 00:59:01 -3 e 2006-08-10 21:02:12 -4 d 2003-02-03 06:00:04 -5 c 2001-03-07 00:59:00 - -deinit -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -end of test diff --git a/storage/spider/mysql-test/spider/oracle/r/ha.result b/storage/spider/mysql-test/spider/oracle/r/ha.result deleted file mode 100644 index 8ca64dec6df..00000000000 --- a/storage/spider/mysql-test/spider/oracle/r/ha.result +++ /dev/null @@ -1,240 +0,0 @@ -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -drop and create databases -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -CREATE DATABASE auto_test_remote; -USE auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -CREATE DATABASE auto_test_remote2; -USE auto_test_remote2; -DROP DATABASE IF EXISTS auto_test_remote3; -CREATE DATABASE auto_test_remote3; -USE auto_test_remote3; -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; - -test select 1 -SELECT 1; -1 -1 - -create table test -DROP TABLE IF EXISTS ta_l; -CREATE TABLE ta_l ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_2_1 -INSERT INTO ta_l (a, b, c) VALUES -(1, 'a', '2008-08-01 10:21:39'), -(2, 'b', '2000-01-01 00:00:00'), -(3, 'e', '2007-06-04 20:03:11'), -(4, 'd', '2003-11-30 05:01:03'), -(5, 'c', '2001-12-31 23:59:59'); - -select test -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 - -fail-over test -SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; -Variable_name Value -Spider_mon_table_cache_version 0 -Spider_mon_table_cache_version_req 1 -INSERT INTO ta_l (a, b, c) VALUES -(6, 'e', '2011-05-05 20:04:05'); -ERROR HY000: Table 'SYSTEM.ta_r3' get a problem -SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables -ORDER BY db_name, table_name, link_id; -db_name table_name link_id link_status -auto_test_local ta_l 0 1 -auto_test_local ta_l 1 3 -SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; -db_name table_name link_id -auto_test_local ta_l 1 -SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; -Variable_name Value -Spider_mon_table_cache_version 1 -Spider_mon_table_cache_version_req 1 -INSERT INTO ta_l (a, b, c) VALUES -(6, 'e', '2011-05-05 20:04:05'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 -6 e 2011-05-05 20:04:05 - -recovery test -ALTER TABLE ta_l -CONNECTION='host "xe", user "system", - password "oracle", msi "2", mkd "2", - database "SYSTEM", lst "0 2"'; -SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables -ORDER BY db_name, table_name, link_id; -db_name table_name link_id link_status -auto_test_local ta_l 0 1 -auto_test_local ta_l 1 2 -SELECT spider_copy_tables('ta_l', '0', '1'); -spider_copy_tables('ta_l', '0', '1') -1 -ALTER TABLE ta_l -CONNECTION='host "xe", user "system", - password "oracle", msi "2", mkd "2", - database "SYSTEM", lst "0 1"'; -SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables -ORDER BY db_name, table_name, link_id; -db_name table_name link_id link_status -auto_test_local ta_l 0 1 -auto_test_local ta_l 1 1 -INSERT INTO ta_l (a, b, c) VALUES -(8, 'g', '2011-05-05 21:33:30'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 -6 e 2011-05-05 20:04:05 -8 g 2011-05-05 21:33:30 -DROP TABLE ta_l; -SELECT spider_flush_table_mon_cache(); -spider_flush_table_mon_cache() -1 - -active standby test -create table test -DROP TABLE IF EXISTS ta_l; -CREATE TABLE ta_l ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_2_1 -INSERT INTO ta_l (a, b, c) VALUES -(1, 'a', '2008-08-01 10:21:39'), -(2, 'b', '2000-01-01 00:00:00'), -(3, 'e', '2007-06-04 20:03:11'), -(4, 'd', '2003-11-30 05:01:03'), -(5, 'c', '2001-12-31 23:59:59'); - -select test -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 - -fail-over test -SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; -Variable_name Value -Spider_mon_table_cache_version 1 -Spider_mon_table_cache_version_req 2 -INSERT INTO ta_l (a, b, c) VALUES -(6, 'e', '2011-05-05 20:04:05'); -ERROR HY000: Table 'SYSTEM.ta_r' get a problem -SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables -ORDER BY db_name, table_name, link_id; -db_name table_name link_id link_status -auto_test_local ta_l 0 3 -auto_test_local ta_l 1 1 -SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; -db_name table_name link_id -auto_test_local ta_l 1 -auto_test_local ta_l 0 -SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; -Variable_name Value -Spider_mon_table_cache_version 2 -Spider_mon_table_cache_version_req 2 -INSERT INTO ta_l (a, b, c) VALUES -(6, 'e', '2011-05-05 20:04:05'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -6 e 2011-05-05 20:04:05 - -recovery test -ALTER TABLE ta_l -CONNECTION='host "xe", user "system", - password "oracle", msi "2", mkd "2", alc "1", - database "SYSTEM", lst "1 0"'; -SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables -ORDER BY db_name, table_name, link_id; -db_name table_name link_id link_status -auto_test_local ta_l 0 1 -auto_test_local ta_l 1 1 -INSERT INTO ta_l (a, b, c) VALUES -(8, 'g', '2011-05-05 21:33:30'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -8 g 2011-05-05 21:33:30 -DROP TABLE ta_l; -SELECT spider_flush_table_mon_cache(); -spider_flush_table_mon_cache() -1 - -deinit -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -DROP DATABASE IF EXISTS auto_test_remote3; -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_local; -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -end of test diff --git a/storage/spider/mysql-test/spider/oracle/r/ha_part.result b/storage/spider/mysql-test/spider/oracle/r/ha_part.result deleted file mode 100644 index e11b6f695e0..00000000000 --- a/storage/spider/mysql-test/spider/oracle/r/ha_part.result +++ /dev/null @@ -1,262 +0,0 @@ -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -drop and create databases -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -CREATE DATABASE auto_test_remote; -USE auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -CREATE DATABASE auto_test_remote2; -USE auto_test_remote2; -DROP DATABASE IF EXISTS auto_test_remote3; -CREATE DATABASE auto_test_remote3; -USE auto_test_remote3; -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; - -test select 1 -SELECT 1; -1 -1 - -create table with partition test -DROP TABLE IF EXISTS ta_l2; -CREATE TABLE ta_l2 ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_P_2_1 -INSERT INTO ta_l2 (a, b, c) VALUES -(1, 'a', '2008-08-01 10:21:39'), -(2, 'b', '2000-01-01 00:00:00'), -(3, 'e', '2007-06-04 20:03:11'), -(4, 'd', '2003-11-30 05:01:03'), -(5, 'c', '2001-12-31 23:59:59'); - -select test -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 - -fail-over test -SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; -Variable_name Value -Spider_mon_table_cache_version 0 -Spider_mon_table_cache_version_req 1 -INSERT INTO ta_l2 (a, b, c) VALUES -(6, 'e', '2011-05-05 20:04:05'); -ERROR HY000: Table 'SYSTEM.ta_r4' get a problem -SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables -ORDER BY db_name, table_name, link_id; -db_name table_name link_id link_status -auto_test_local ta_l2#P#pt1 0 1 -auto_test_local ta_l2#P#pt1 1 1 -auto_test_local ta_l2#P#pt2 0 1 -auto_test_local ta_l2#P#pt2 1 3 -SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; -db_name table_name link_id -auto_test_local ta_l2#P#pt2 1 -SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; -Variable_name Value -Spider_mon_table_cache_version 1 -Spider_mon_table_cache_version_req 1 -INSERT INTO ta_l2 (a, b, c) VALUES -(6, 'e', '2011-05-05 20:04:05'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 -6 e 2011-05-05 20:04:05 - -recovery test -ALTER TABLE ta_l2 -PARTITION BY KEY(a) ( -PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', -PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 2"' - ); -SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables -ORDER BY db_name, table_name, link_id; -db_name table_name link_id link_status -auto_test_local ta_l2#P#pt1 0 1 -auto_test_local ta_l2#P#pt1 1 1 -auto_test_local ta_l2#P#pt2 0 1 -auto_test_local ta_l2#P#pt2 1 2 -SELECT spider_copy_tables('ta_l2#P#pt2', '0', '1'); -spider_copy_tables('ta_l2#P#pt2', '0', '1') -1 -ALTER TABLE ta_l2 -PARTITION BY KEY(a) ( -PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', -PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 1"' - ); -SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables -ORDER BY db_name, table_name, link_id; -db_name table_name link_id link_status -auto_test_local ta_l2#P#pt1 0 1 -auto_test_local ta_l2#P#pt1 1 1 -auto_test_local ta_l2#P#pt2 0 1 -auto_test_local ta_l2#P#pt2 1 1 -INSERT INTO ta_l2 (a, b, c) VALUES -(8, 'g', '2011-05-05 21:33:30'), -(9, 'h', '2011-05-05 22:32:10'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 -6 e 2011-05-05 20:04:05 -8 g 2011-05-05 21:33:30 -9 h 2011-05-05 22:32:10 -DROP TABLE ta_l2; - -create table with partition test -DROP TABLE IF EXISTS ta_l2; -CREATE TABLE ta_l2 ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_P_2_1 -INSERT INTO ta_l2 (a, b, c) VALUES -(1, 'a', '2008-08-01 10:21:39'), -(2, 'b', '2000-01-01 00:00:00'), -(3, 'e', '2007-06-04 20:03:11'), -(4, 'd', '2003-11-30 05:01:03'), -(5, 'c', '2001-12-31 23:59:59'); - -select test -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 - -fail-over test -SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; -Variable_name Value -Spider_mon_table_cache_version 1 -Spider_mon_table_cache_version_req 1 -INSERT INTO ta_l2 (a, b, c) VALUES -(6, 'e', '2011-05-05 20:04:05'); -ERROR HY000: Table 'SYSTEM.ta_r2' get a problem -SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables -ORDER BY db_name, table_name, link_id; -db_name table_name link_id link_status -auto_test_local ta_l2#P#pt1 0 1 -auto_test_local ta_l2#P#pt1 1 1 -auto_test_local ta_l2#P#pt2 0 3 -auto_test_local ta_l2#P#pt2 1 1 -SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; -db_name table_name link_id -auto_test_local ta_l2#P#pt2 1 -auto_test_local ta_l2#P#pt2 0 -SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; -Variable_name Value -Spider_mon_table_cache_version 1 -Spider_mon_table_cache_version_req 1 -INSERT INTO ta_l2 (a, b, c) VALUES -(6, 'e', '2011-05-05 20:04:05'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -3 e 2007-06-04 20:03:11 -5 c 2001-12-31 23:59:59 -6 e 2011-05-05 20:04:05 - -recovery test -ALTER TABLE ta_l2 -PARTITION BY KEY(a) ( -PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', -PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "1 0"' - ); -SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables -ORDER BY db_name, table_name, link_id; -db_name table_name link_id link_status -auto_test_local ta_l2#P#pt1 0 1 -auto_test_local ta_l2#P#pt1 1 1 -auto_test_local ta_l2#P#pt2 0 1 -auto_test_local ta_l2#P#pt2 1 1 -INSERT INTO ta_l2 (a, b, c) VALUES -(8, 'g', '2011-05-05 21:33:30'), -(9, 'h', '2011-05-05 22:32:10'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -3 e 2007-06-04 20:03:11 -5 c 2001-12-31 23:59:59 -8 g 2011-05-05 21:33:30 -9 h 2011-05-05 22:32:10 -DROP TABLE ta_l2; - -deinit -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -DROP DATABASE IF EXISTS auto_test_remote3; -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_local; -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -end of test diff --git a/storage/spider/mysql-test/spider/oracle/r/spider3_fixes.result b/storage/spider/mysql-test/spider/oracle/r/spider3_fixes.result deleted file mode 100644 index 418f8bb31a8..00000000000 --- a/storage/spider/mysql-test/spider/oracle/r/spider3_fixes.result +++ /dev/null @@ -1,194 +0,0 @@ -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 -for slave1_1 - -drop and create databases -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -CREATE DATABASE auto_test_remote; -USE auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -CREATE DATABASE auto_test_remote2; -USE auto_test_remote2; - -test select 1 -SELECT 1; -1 -1 - -3.1 -auto_increment -DROP TABLE IF EXISTS t1, t2; -CREATE TABLE t1 ( -id int(11) NOT NULL AUTO_INCREMENT, -PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1 -CREATE TABLE t2 ( -id int(11) NOT NULL AUTO_INCREMENT, -PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1 -MASTER_1_AUTO_INCREMENT_INCREMENT2 -MASTER_1_AUTO_INCREMENT_OFFSET2 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') -1 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') -1 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') -1 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') -1 -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -777 -SELECT MAX(id) FROM t1; -MAX(id) -777 -INSERT INTO t2 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -1554 -SELECT MAX(id) FROM t2; -MAX(id) -1554 -MASTER_1_AUTO_INCREMENT_OFFSET3 -INSERT INTO t1 (id) VALUES (null); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -1555 -SELECT MAX(id) FROM t1; -MAX(id) -1555 -MASTER_1_AUTO_INCREMENT_OFFSET4 -INSERT INTO t2 (id) VALUES (null); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -2331 -SELECT MAX(id) FROM t2; -MAX(id) -2331 -MASTER_1_AUTO_INCREMENT_OFFSET3 -INSERT INTO t1 () VALUES (),(),(),(); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -2332 -SELECT id FROM t1 ORDER BY id; -id -777 -1554 -1555 -2331 -2332 -3109 -3886 -4663 -MASTER_1_AUTO_INCREMENT_OFFSET4 -INSERT INTO t2 () VALUES (),(),(),(); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -5439 -SELECT id FROM t2 ORDER BY id; -id -777 -1554 -1555 -2331 -2332 -3109 -3886 -4663 -5439 -6216 -6993 -7770 -TRUNCATE TABLE t1; -TRUNCATE TABLE t2; -INSERT INTO t1 () VALUES (),(),(),(); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -777 -SELECT id FROM t1 ORDER BY id; -id -777 -1554 -2331 -3108 -INSERT INTO t2 () VALUES (),(),(),(); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -3885 -SELECT id FROM t2 ORDER BY id; -id -777 -1554 -2331 -3108 -3885 -4662 -5439 -6216 -SET INSERT_ID=5000; -MASTER_1_AUTO_INCREMENT_OFFSET3 -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -5000 -SELECT MAX(id) FROM t1; -MAX(id) -6216 -MASTER_1_AUTO_INCREMENT_OFFSET4 -INSERT INTO t2 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -6993 -SELECT MAX(id) FROM t2; -MAX(id) -6993 -INSERT INTO t1 (id) VALUES (10000); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -6993 -SELECT MAX(id) FROM t1; -MAX(id) -10000 -INSERT INTO t2 (id) VALUES (1000); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -6993 -SELECT MAX(id) FROM t2; -MAX(id) -10000 - -deinit -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -for slave1_1 -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -end of test diff --git a/storage/spider/mysql-test/spider/oracle/r/spider3_fixes_part.result b/storage/spider/mysql-test/spider/oracle/r/spider3_fixes_part.result deleted file mode 100644 index accb4607027..00000000000 --- a/storage/spider/mysql-test/spider/oracle/r/spider3_fixes_part.result +++ /dev/null @@ -1,192 +0,0 @@ -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 -for slave1_1 - -drop and create databases -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -CREATE DATABASE auto_test_remote; -USE auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -CREATE DATABASE auto_test_remote2; -USE auto_test_remote2; - -test select 1 -SELECT 1; -1 -1 -auto_increment with partition -DROP TABLE IF EXISTS t1, t2; -CREATE TABLE t1 ( -id int(11) NOT NULL AUTO_INCREMENT, -PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1 -CREATE TABLE t2 ( -id int(11) NOT NULL AUTO_INCREMENT, -PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1 -MASTER_1_AUTO_INCREMENT_INCREMENT2 -MASTER_1_AUTO_INCREMENT_OFFSET2 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') -1 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') -1 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') -1 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') -1 -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -777 -SELECT MAX(id) FROM t1; -MAX(id) -777 -INSERT INTO t2 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -1554 -SELECT MAX(id) FROM t2; -MAX(id) -1554 -MASTER_1_AUTO_INCREMENT_OFFSET3 -INSERT INTO t1 (id) VALUES (null); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -778 -SELECT MAX(id) FROM t1; -MAX(id) -1554 -MASTER_1_AUTO_INCREMENT_OFFSET4 -INSERT INTO t2 (id) VALUES (null); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -2331 -SELECT MAX(id) FROM t2; -MAX(id) -2331 -MASTER_1_AUTO_INCREMENT_OFFSET3 -INSERT INTO t1 () VALUES (),(),(),(); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -1555 -SELECT id FROM t1 ORDER BY id; -id -777 -778 -1554 -1555 -2331 -2332 -3109 -3886 -MASTER_1_AUTO_INCREMENT_OFFSET4 -INSERT INTO t2 () VALUES (),(),(),(); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -3108 -SELECT id FROM t2 ORDER BY id; -id -777 -778 -1554 -1555 -2331 -2332 -3108 -3109 -3885 -3886 -4662 -5439 -TRUNCATE TABLE t1; -TRUNCATE TABLE t2; -INSERT INTO t1 () VALUES (),(),(),(); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -777 -SELECT id FROM t1 ORDER BY id; -id -777 -1554 -2331 -3108 -INSERT INTO t2 () VALUES (),(),(),(); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -3885 -SELECT id FROM t2 ORDER BY id; -id -777 -1554 -2331 -3108 -3885 -4662 -5439 -6216 -SET INSERT_ID=5000; -MASTER_1_AUTO_INCREMENT_OFFSET3 -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -5000 -SELECT MAX(id) FROM t1; -MAX(id) -6216 -MASTER_1_AUTO_INCREMENT_OFFSET4 -INSERT INTO t2 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -6993 -SELECT MAX(id) FROM t2; -MAX(id) -6993 -INSERT INTO t1 (id) VALUES (10000); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -6993 -SELECT MAX(id) FROM t1; -MAX(id) -10000 -INSERT INTO t2 (id) VALUES (1000); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -6993 -SELECT MAX(id) FROM t2; -MAX(id) -10000 - -deinit -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -for slave1_1 -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -end of test diff --git a/storage/spider/mysql-test/spider/oracle/r/spider_fixes.result b/storage/spider/mysql-test/spider/oracle/r/spider_fixes.result deleted file mode 100644 index 85efde74061..00000000000 --- a/storage/spider/mysql-test/spider/oracle/r/spider_fixes.result +++ /dev/null @@ -1,552 +0,0 @@ -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 -for slave1_1 - -drop and create databases -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -CREATE DATABASE auto_test_remote; -USE auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -CREATE DATABASE auto_test_remote2; -USE auto_test_remote2; - -test select 1 -SELECT 1; -1 -1 - -create table and insert -DROP TABLE IF EXISTS tb_l; -CREATE TABLE tb_l ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE2 MASTER_1_CHARSET2 -INSERT INTO tb_l (a, b, c) VALUES -(1, 'a', '2008-08-01 10:21:39'), -(2, 'b', '2000-01-01 00:00:00'), -(3, 'e', '2007-06-04 20:03:11'), -(4, 'd', '2003-11-30 05:01:03'), -(5, 'c', '2001-12-31 23:59:59'); -DROP TABLE IF EXISTS ta_l; -CREATE TABLE ta_l ( -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 -INSERT INTO ta_l SELECT a, b, c FROM tb_l; - -2.13 -select table with "order by desc" and "<" -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -WHERE a < 5 ORDER BY a DESC LIMIT 3; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -4 d 2003-11-30 05:01:03 -3 e 2007-06-04 20:03:11 -2 b 2000-01-01 00:00:00 - -select table with "order by desc" and "<=" -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -WHERE a <= 5 ORDER BY a DESC LIMIT 3; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -5 c 2001-12-31 23:59:59 -4 d 2003-11-30 05:01:03 -3 e 2007-06-04 20:03:11 - -2.14 -update table with range scan and split_read -UPDATE ta_l SET c = '2000-02-02 00:00:00' WHERE a > 1; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-02-02 00:00:00 -3 e 2000-02-02 00:00:00 -4 d 2000-02-02 00:00:00 -5 c 2000-02-02 00:00:00 - -2.15 -select table with range scan -TRUNCATE TABLE ta_l; -DROP TABLE IF EXISTS ta_l; -CREATE TABLE ta_l ( -a int(11) NOT NULL DEFAULT '0', -b char(1) DEFAULT NULL, -c datetime DEFAULT NULL, -PRIMARY KEY (a, b, c) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1 -INSERT INTO ta_l SELECT a, b, c FROM tb_l; -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b' -AND c = '2003-11-30 05:01:03'; -a b c -4 d 2003-11-30 05:01:03 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b' -AND c = '2003-11-30 05:01:03'; -a b c -4 d 2003-11-30 05:01:03 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a >= 4 AND b = 'd' -AND c = '2003-11-30 05:01:03'; -a b c -4 d 2003-11-30 05:01:03 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a > 4 AND b = 'c' -AND c = '2001-12-31 23:59:59'; -a b c -5 c 2001-12-31 23:59:59 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b <= 'd' -AND c = '2003-11-30 05:01:03'; -a b c -4 d 2003-11-30 05:01:03 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b < 'e' -AND c = '2003-11-30 05:01:03'; -a b c -4 d 2003-11-30 05:01:03 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND b = 'b' -AND c = '2000-01-01 00:00:00'; -a b c -2 b 2000-01-01 00:00:00 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND b = 'b' -AND c = '2000-01-01 00:00:00'; -a b c -2 b 2000-01-01 00:00:00 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b' -AND b <= 'd' AND c = '2003-11-30 05:01:03'; -a b c -4 d 2003-11-30 05:01:03 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b' -AND b < 'e' AND c = '2003-11-30 05:01:03'; -a b c -4 d 2003-11-30 05:01:03 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND a >= 1 -AND b >= 'b' AND c = '2003-11-30 05:01:03'; -a b c -4 d 2003-11-30 05:01:03 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND a > 1 -AND b >= 'b' AND c = '2000-01-01 00:00:00'; -a b c -2 b 2000-01-01 00:00:00 - -2.16 -auto_increment insert with trigger -CREATE TABLE ta_l_auto_inc ( -a INT AUTO_INCREMENT, -b CHAR(1) DEFAULT 'c', -c DATETIME DEFAULT '1999-10-10 10:10:10', -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1 -CREATE TABLE tc_l ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE2 MASTER_1_CHARSET2 -CREATE TRIGGER ins_ta_l_auto_inc AFTER INSERT ON ta_l_auto_inc FOR EACH ROW BEGIN INSERT INTO tc_l (a, b, c) VALUES (NEW.a, NEW.b, NEW.c); END;; -INSERT INTO ta_l_auto_inc (a, b, c) VALUES -(NULL, 's', '2008-12-31 20:59:59'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM tc_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 s 2008-12-31 20:59:59 - -2.17 -engine-condition-pushdown with "or" and joining -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l WHERE a = 1 OR a IN (SELECT a FROM tb_l); -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 - -2.23 -index merge -CREATE TABLE ta_l_int ( -a INT AUTO_INCREMENT, -b INT DEFAULT 10, -c INT DEFAULT 11, -PRIMARY KEY(a), -KEY idx1(b), -KEY idx2(c) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1 -INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3); -INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int; -INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int; -INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int; -INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int; -SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2) -WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a; -a b c -3 4 5 -4 5 6 -5 6 7 - -2.24 -index scan update without PK -DROP TABLE IF EXISTS ta_l_int; -CREATE TABLE ta_l_int ( -a INT NOT NULL, -b INT DEFAULT 10, -c INT DEFAULT 11, -KEY idx1(b), -KEY idx2(c) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1 -SELECT a, b, c FROM ta_l_int ORDER BY a; -a b c -1 2 3 -2 3 4 -3 4 5 -4 5 6 -5 6 7 -6 7 8 -7 8 9 -8 9 10 -9 10 11 -10 11 12 -11 12 13 -12 13 14 -13 14 15 -14 15 16 -15 16 17 -16 17 18 -INSERT INTO ta_l_int (a, b, c) VALUES (0, 2, 3); -INSERT INTO ta_l_int (a, b, c) VALUES (18, 2, 3); -UPDATE ta_l_int SET c = 4 WHERE b = 2; -SELECT a, b, c FROM ta_l_int ORDER BY a; -a b c -0 2 4 -1 2 4 -2 3 4 -3 4 5 -4 5 6 -5 6 7 -6 7 8 -7 8 9 -8 9 10 -9 10 11 -10 11 12 -11 12 13 -12 13 14 -13 14 15 -14 15 16 -15 16 17 -16 17 18 -18 2 4 - -2.25 -direct order limit -SHOW GLOBAL STATUS LIKE 'Spider_direct_order_limit%'; -Variable_name Value -Spider_direct_order_limit 0 -SELECT a, b, c FROM ta_l_int ORDER BY a LIMIT 3; -a b c -1 2 4 -2 3 4 -3 4 5 -SHOW GLOBAL STATUS LIKE 'Spider_direct_order_limit%'; -Variable_name Value -Spider_direct_order_limit 0 - -2.26 -lock tables -DROP TABLE IF EXISTS t1; -DROP TABLE IF EXISTS t2; -CREATE TABLE t1 ( -id int(11) NOT NULL, -PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK1 -CREATE TABLE t2 ( -id int(11) NOT NULL, -PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK2 -LOCK TABLES t1 READ, t2 READ; -UNLOCK TABLES; - -auto_increment -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 ( -id int(11) NOT NULL AUTO_INCREMENT, -PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1 -MASTER_1_AUTO_INCREMENT_INCREMENT2 -MASTER_1_AUTO_INCREMENT_OFFSET2 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') -1 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') -1 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') -1 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') -1 -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -777 -SELECT MAX(id) FROM t1; -MAX(id) -777 -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -1554 -SELECT MAX(id) FROM t1; -MAX(id) -1554 -INSERT INTO t1 (id) VALUES (null); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -2331 -SELECT MAX(id) FROM t1; -MAX(id) -2331 -INSERT INTO t1 (id) VALUES (null); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -3108 -SELECT MAX(id) FROM t1; -MAX(id) -3108 -INSERT INTO t1 () VALUES (),(),(),(); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -3885 -SELECT id FROM t1 ORDER BY id; -id -777 -1554 -2331 -3108 -3885 -4662 -5439 -6216 -SET INSERT_ID=5000; -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -5000 -SELECT MAX(id) FROM t1; -MAX(id) -6216 -INSERT INTO t1 (id) VALUES (10000); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -5000 -SELECT MAX(id) FROM t1; -MAX(id) -10000 -INSERT INTO t1 (id) VALUES (1000); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -5000 -SELECT MAX(id) FROM t1; -MAX(id) -10000 - -read only -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 ( -id int(11) NOT NULL, -PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_READONLY1_1 -SELECT id FROM t1 ORDER BY id; -id -777 -1000 -1554 -2331 -3108 -3885 -4662 -5000 -5439 -6216 -10000 -INSERT INTO t1 (id) VALUES (1); -ERROR HY000: Table 'auto_test_local.t1' is read only -UPDATE t1 SET id = 4 WHERE id = 777; -ERROR HY000: Table 'auto_test_local.t1' is read only -DELETE FROM t1 WHERE id = 777; -ERROR HY000: Table 'auto_test_local.t1' is read only -DELETE FROM t1; -ERROR HY000: Table 'auto_test_local.t1' is read only -TRUNCATE t1; -ERROR HY000: Table 'auto_test_local.t1' is read only - -2.27 -error mode -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 ( -id int(11) NOT NULL, -PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_ERROR_MODE1_1 -SELECT id FROM t1 ORDER BY id; -id -Warnings: -Error 12712 Error from Oracle -1 942 ORA-00942: ??????????????? - -Error 12712 Oracle error -Error 12712 Error from Oracle -1 942 ORA-00942: ??????????????? - -Error 12712 Oracle error -INSERT INTO t1 (id) VALUES (1); -Warnings: -Error 12712 Error from Oracle -1 942 ORA-00942: ??????????????? - -Error 12712 Oracle error -DELETE FROM t1; -Warnings: -Error 12712 Error from Oracle -1 942 ORA-00942: ??????????????? - -Error 12712 Oracle error -TRUNCATE t1; -Warnings: -Error 12712 Error from Oracle -1 942 ORA-00942: ??????????????? - -Error 12712 Oracle error - -3.0 -is null -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 ( -a VARCHAR(255), -b VARCHAR(255), -c VARCHAR(255), -KEY idx1(a,b), -KEY idx2(b), -PRIMARY KEY(c) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_TEXT_KEY1_1 -insert into t1 values (null, null, '2048'); -insert into t1 values ('1', '1', '1'); -insert into t1 select a + 1, b + 1, c + 1 from t1; -insert into t1 select a + 2, b + 2, c + 2 from t1; -insert into t1 select a + 4, b + 4, c + 4 from t1; -insert into t1 select a + 8, b + 8, c + 8 from t1; -insert into t1 select a + 16, b + 16, c + 16 from t1; -insert into t1 select a + 32, b + 32, c + 32 from t1; -insert into t1 select a + 64, b + 64, c + 64 from t1; -insert into t1 select a + 128, b + 128, c + 128 from t1; -insert into t1 select a + 256, b + 256, c + 256 from t1; -insert into t1 select a + 512, b + 512, c + 512 from t1; -flush tables; -select a from t1 where a is null order by a limit 30; -a -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -select b from t1 where b is null order by b limit 30; -b -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL - -direct_order_limit -TRUNCATE TABLE t1; -insert into t1 values ('1', '1', '1'); -insert into t1 select a + 1, b + 1, c + 1 from t1; -insert into t1 select a + 2, b + 2, c + 2 from t1; -insert into t1 select a + 4, b + 4, c + 4 from t1; -insert into t1 select a + 8, b + 8, c + 8 from t1; -insert into t1 select a + 16, b + 16, c + 16 from t1; -insert into t1 select a, b + 32, c + 32 from t1; -insert into t1 select a, b + 64, c + 64 from t1; -insert into t1 select a, b + 128, c + 128 from t1; -flush tables; -select a, b, c from t1 where a = '10' and b <> '100' order by c desc limit 5; -a b c -10 74 74 -10 42 42 -10 234 234 -10 202 202 -10 170 170 -select a, c from t1 where a = '10' order by b desc limit 5; -a c -10 74 -10 42 -10 234 -10 202 -10 170 - -deinit -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -for slave1_1 -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -end of test diff --git a/storage/spider/mysql-test/spider/oracle/r/spider_fixes_part.result b/storage/spider/mysql-test/spider/oracle/r/spider_fixes_part.result deleted file mode 100644 index 9abe8558416..00000000000 --- a/storage/spider/mysql-test/spider/oracle/r/spider_fixes_part.result +++ /dev/null @@ -1,199 +0,0 @@ -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 -for slave1_1 - -drop and create databases -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -CREATE DATABASE auto_test_remote; -USE auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -CREATE DATABASE auto_test_remote2; -USE auto_test_remote2; - -test select 1 -SELECT 1; -1 -1 -DROP TABLE IF EXISTS tb_l; -CREATE TABLE tb_l ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE2 MASTER_1_CHARSET2 -INSERT INTO tb_l (a, b, c) VALUES -(1, 'a', '2008-08-01 10:21:39'), -(2, 'b', '2000-01-01 00:00:00'), -(3, 'e', '2007-06-04 20:03:11'), -(4, 'd', '2003-11-30 05:01:03'), -(5, 'c', '2001-12-31 23:59:59'); - -2.17 -partition with sort -CREATE TABLE ta_l2 ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1 -INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 WHERE a > 1 -ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 - -2.23 -partition update with moving partition -DROP TABLE IF EXISTS ta_l2; -CREATE TABLE ta_l2 ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1 -INSERT INTO ta_l2 (a, b, c) VALUES (3, 'B', '2010-09-26 00:00:00'); -UPDATE ta_l2 SET a = 4 WHERE a = 3; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -4 B 2010-09-26 00:00:00 -index merge with partition -DROP TABLE IF EXISTS ta_l_int; -CREATE TABLE ta_l_int ( -a INT AUTO_INCREMENT, -b INT DEFAULT 10, -c INT DEFAULT 11, -PRIMARY KEY(a), -KEY idx1(b), -KEY idx2(c) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_P_2_1 -INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3); -INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int; -INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int; -INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int; -INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int; -SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2) -WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a; -a b c -3 4 5 -4 5 6 -5 6 7 - -2.26 -auto_increment with partition -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 ( -id int(11) NOT NULL AUTO_INCREMENT, -PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1 -MASTER_1_AUTO_INCREMENT_INCREMENT2 -MASTER_1_AUTO_INCREMENT_OFFSET2 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') -1 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') -1 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') -1 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') -1 -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -777 -SELECT MAX(id) FROM t1; -MAX(id) -777 -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -1554 -SELECT MAX(id) FROM t1; -MAX(id) -1554 -INSERT INTO t1 (id) VALUES (null); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -2331 -SELECT MAX(id) FROM t1; -MAX(id) -2331 -INSERT INTO t1 (id) VALUES (null); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -3108 -SELECT MAX(id) FROM t1; -MAX(id) -3108 -INSERT INTO t1 () VALUES (),(),(),(); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -3885 -SELECT id FROM t1 ORDER BY id; -id -777 -1554 -2331 -3108 -3885 -4662 -5439 -6216 -SET INSERT_ID=5000; -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -5000 -SELECT MAX(id) FROM t1; -MAX(id) -6216 -INSERT INTO t1 (id) VALUES (10000); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -5000 -SELECT MAX(id) FROM t1; -MAX(id) -10000 -INSERT INTO t1 (id) VALUES (1000); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -5000 -SELECT MAX(id) FROM t1; -MAX(id) -10000 - -deinit -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -for slave1_1 -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -end of test diff --git a/storage/spider/mysql-test/spider/oracle/r/vp_fixes.result b/storage/spider/mysql-test/spider/oracle/r/vp_fixes.result deleted file mode 100644 index 15dd29aa4d3..00000000000 --- a/storage/spider/mysql-test/spider/oracle/r/vp_fixes.result +++ /dev/null @@ -1,80 +0,0 @@ -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -drop and create databases -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -CREATE DATABASE auto_test_remote; -USE auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -CREATE DATABASE auto_test_remote2; -USE auto_test_remote2; - -test select 1 -SELECT 1; -1 -1 - -create table and insert -DROP TABLE IF EXISTS tb_l; -CREATE TABLE tb_l ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE2 MASTER_1_CHARSET2 -INSERT INTO tb_l (a, b, c) VALUES -(1, 'a', '2008-08-01 10:21:39'), -(2, 'b', '2000-01-01 00:00:00'), -(3, 'e', '2007-06-04 20:03:11'), -(4, 'd', '2003-11-30 05:01:03'), -(5, 'c', '2001-12-31 23:59:59'); -DROP TABLE IF EXISTS ta_l; -CREATE TABLE ta_l ( -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 -INSERT INTO ta_l SELECT a, b, c FROM tb_l; - -0.9 -create different primary key table -CREATE TABLE ta_l_int ( -a INT DEFAULT 10, -b INT AUTO_INCREMENT, -c INT DEFAULT 11, -PRIMARY KEY(b) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1 -INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); -create un-correspond primary key table -DROP TABLE IF EXISTS ta_l_int; -CREATE TABLE ta_l_int ( -a INT DEFAULT 10, -b INT DEFAULT 12, -c INT DEFAULT 11, -PRIMARY KEY(c) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1 -INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); - -deinit -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -end of test diff --git a/storage/spider/mysql-test/spider/oracle/t/basic_sql.test b/storage/spider/mysql-test/spider/oracle/t/basic_sql.test deleted file mode 100644 index 6421198fa95..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/basic_sql.test +++ /dev/null @@ -1,2701 +0,0 @@ -# This test tests by executing basic SQL ---disable_warnings ---disable_query_log ---disable_result_log ---source test_init.inc ---enable_result_log ---enable_query_log - ---echo ---echo drop and create databases ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - CREATE DATABASE auto_test_remote; - USE auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - CREATE DATABASE auto_test_remote2; - USE auto_test_remote2; -} ---enable_warnings - ---echo ---echo test select 1 ---connection master_1 -SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - SELECT 1; - --connection child2_2 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo create table select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS tb_l; ---enable_warnings ---disable_query_log -echo CREATE TABLE tb_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) MASTER_1_ENGINE2 MASTER_1_CHARSET2; -eval CREATE TABLE tb_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; ---enable_query_log -INSERT INTO tb_l (a, b, c) VALUES - (1, 'a', '2008-08-01 10:21:39'), - (2, 'b', '2000-01-01 00:00:00'), - (3, 'e', '2007-06-04 20:03:11'), - (4, 'd', '2003-11-30 05:01:03'), - (5, 'c', '2001-12-31 23:59:59'); ---disable_warnings -DROP TABLE IF EXISTS ta_l; ---enable_warnings ---disable_query_log -echo CREATE TABLE ta_l ( - PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 -SELECT a, b, c FROM tb_l; -if ($MASTER_1_MERGE) -{ - --error ER_WRONG_OBJECT - eval CREATE TABLE ta_l ( - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1 - SELECT a, b, c FROM tb_l; - eval CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; - INSERT INTO ta_l SELECT a, b, c FROM tb_l; -} -if (!$MASTER_1_MERGE) -{ - eval CREATE TABLE ta_l ( - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1 - SELECT a, b, c FROM tb_l; -} ---enable_query_log -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo create table ignore select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS ta_l; -DROP TABLE IF EXISTS tb_l; ---enable_warnings ---disable_query_log -echo CREATE TABLE tb_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) MASTER_1_ENGINE2 MASTER_1_CHARSET2; -eval CREATE TABLE tb_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; ---enable_query_log -INSERT INTO tb_l (a, b, c) VALUES - (1, 'f', '2008-07-01 10:21:39'), - (2, 'g', '2000-02-01 00:00:00'), - (3, 'j', '2007-05-04 20:03:11'), - (4, 'i', '2003-10-30 05:01:03'), - (5, 'h', '2001-10-31 23:59:59'); ---disable_query_log -echo CREATE TABLE ta_l ( - PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 -IGNORE SELECT a, b, c FROM tb_l; -if ($MASTER_1_MERGE) -{ - --error ER_WRONG_OBJECT - eval CREATE TABLE ta_l ( - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1 - IGNORE SELECT a, b, c FROM tb_l; - eval CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; - INSERT IGNORE INTO ta_l SELECT a, b, c FROM tb_l; -} -if (!$MASTER_1_MERGE) -{ - eval CREATE TABLE ta_l ( - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1 - IGNORE SELECT a, b, c FROM tb_l; -} ---enable_query_log -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo create table ignore select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS ta_l; ---enable_warnings ---disable_query_log -echo CREATE TABLE ta_l ( - PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 -REPLACE SELECT a, b, c FROM tb_l; -if ($MASTER_1_MERGE) -{ - --error ER_WRONG_OBJECT - eval CREATE TABLE ta_l ( - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1 - REPLACE SELECT a, b, c FROM tb_l; - eval CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; - REPLACE INTO ta_l SELECT a, b, c FROM tb_l; -} -if (!$MASTER_1_MERGE) -{ - eval CREATE TABLE ta_l ( - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1 - REPLACE SELECT a, b, c FROM tb_l; -} ---enable_query_log -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%replace %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo create no index table -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES3; - echo CHILD2_1_CREATE_TABLES3; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES3; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES3; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS ta_l_no_idx; ---enable_warnings ---disable_query_log -echo CREATE TABLE ta_l_no_idx -MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1 -SELECT a, b, c FROM tb_l; -if ($MASTER_1_NEEDPK) -{ - --error ER_REQUIRES_PRIMARY_KEY - eval CREATE TABLE ta_l_no_idx - $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1 - SELECT a, b, c FROM tb_l; - eval CREATE TABLE ta_l_no_idx ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1; - INSERT INTO ta_l_no_idx SELECT a, b, c FROM tb_l; -} -if (!$MASTER_1_NEEDPK) -{ - if ($MASTER_1_MERGE) - { - --error ER_WRONG_OBJECT - eval CREATE TABLE ta_l_no_idx - $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1 - SELECT a, b, c FROM tb_l; - eval CREATE TABLE ta_l_no_idx ( - a INT, - b CHAR(1), - c DATETIME - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1; - INSERT INTO ta_l_no_idx SELECT a, b, c FROM tb_l; - } - if (!$MASTER_1_MERGE) - { - eval CREATE TABLE ta_l_no_idx - $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1 - SELECT a, b, c FROM tb_l; - } -} ---enable_query_log -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_TABLES3; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l_no_idx ORDER BY a; - ---echo ---echo select table -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select table shared mode -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a -LOCK IN SHARE MODE; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select table for update -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a -FOR UPDATE; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select table join -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a, tb_l b -WHERE a.a = b.a ORDER BY a.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select table straight_join -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT STRAIGHT_JOIN a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s') -FROM ta_l a, tb_l b WHERE a.a = b.a ORDER BY a.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select sql_small_result -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT SQL_SMALL_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select sql_big_result -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT SQL_BIG_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select sql_buffer_result -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT SQL_BUFFER_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select sql_cache -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT SQL_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select sql_no_cache -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT SQL_NO_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select sql_calc_found_rows -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT SQL_CALC_FOUND_ROWS a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a LIMIT 4; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_ps2_protocol -SELECT found_rows(); ---enable_ps2_protocol - ---echo ---echo select high_priority -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT HIGH_PRIORITY a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select distinct -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT DISTINCT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select count -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT count(*) FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select table join not use index -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM tb_l a WHERE -EXISTS (SELECT * FROM ta_l b WHERE b.b = a.b) ORDER BY a.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select using pushdown -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE -a.b = 'g' ORDER BY a.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select using index and pushdown -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE -a.a > 0 AND a.b = 'g' ORDER BY a.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo insert ---connection master_1 -TRUNCATE TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE 'insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo insert select ---connection master_1 -TRUNCATE TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -INSERT INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE 'insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo insert select a ---connection master_1 -TRUNCATE TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -INSERT INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1), -'e', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE 'insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo insert low_priority ---connection master_1 -TRUNCATE TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -INSERT LOW_PRIORITY INTO ta_l (a, b, c) values (2, 'e', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE 'insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo insert high_priority ---connection master_1 -TRUNCATE TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -INSERT HIGH_PRIORITY INTO ta_l (a, b, c) VALUES (2, 'e', -'2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE 'insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo insert ignore -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -INSERT IGNORE INTO ta_l (a, b, c) VALUES (2, 'd', '2009-02-02 01:01:01'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE 'insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo insert update (insert) ---connection master_1 -TRUNCATE TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE -KEY UPDATE b = 'f', c = '2005-08-08 11:11:11'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'insert %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE '%update %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE '%delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo insert update (update) -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE -KEY UPDATE b = 'f', c = '2005-08-08 11:11:11'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'insert %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE '%update %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE '%delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo replace ---connection master_1 -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -REPLACE INTO ta_l (a, b, c) VALUES (2, 'f', '2008-02-02 02:02:02'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'replace %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'insert %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo replace select -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -REPLACE INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'replace %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'insert %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo replace select a -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -REPLACE INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1), -'e', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'replace %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'insert %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo replace low_priority -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -REPLACE LOW_PRIORITY INTO ta_l (a, b, c) VALUES (3, 'g', -'2009-03-03 03:03:03'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'replace %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'insert %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo update -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -UPDATE ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo update select -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a IN (SELECT a FROM -tb_l); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo update select a -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -UPDATE ta_l SET b = 'h', c = '2010-04-04 04:04:04' WHERE a = (SELECT a FROM -tb_l ORDER BY a LIMIT 1); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo update join -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -UPDATE ta_l a, tb_l b SET a.b = b.b, a.c = b.c WHERE a.a = b.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo update join a -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -UPDATE ta_l a, tb_l b SET a.b = 'g', a.c = '2009-03-03 03:03:03' WHERE -a.a = b.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo update low_priority -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -UPDATE LOW_PRIORITY ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo update ignore -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -UPDATE IGNORE ta_l SET a = 1, b = 'g', c = '2009-03-03 03:03:03' WHERE a = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo update pushdown -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -update ta_l set b = 'j', c = '2009-03-03 03:03:03' where b = 'f'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo update index pushdown -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'j'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo delete -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -DELETE FROM ta_l WHERE a = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo delete all -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -DELETE FROM ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo delete select -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -DELETE FROM ta_l WHERE a IN (SELECT a FROM tb_l); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo delete select a -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -DELETE FROM ta_l WHERE a = (SELECT a FROM tb_l ORDER BY a LIMIT 1); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo delete join -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -DELETE a FROM ta_l a, (SELECT a FROM tb_l ORDER BY a) b WHERE a.a = b.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo delete low_priority -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -DELETE LOW_PRIORITY FROM ta_l WHERE a = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo delete ignore -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -DELETE IGNORE FROM ta_l WHERE a = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo delete quick -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -DELETE QUICK FROM ta_l WHERE a = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo delete pushdown -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -DELETE FROM ta_l WHERE b = 'e'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo delete index pushdown -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -DELETE FROM ta_l WHERE a > 0 AND b = 'e'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo truncate -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -TRUNCATE TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE 'truncate %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo deinit ---disable_warnings ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; -} ---disable_query_log ---disable_result_log ---source test_deinit.inc ---enable_result_log ---enable_query_log ---enable_warnings ---echo ---echo end of test diff --git a/storage/spider/mysql-test/spider/oracle/t/basic_sql_part.test b/storage/spider/mysql-test/spider/oracle/t/basic_sql_part.test deleted file mode 100644 index e1638642ab7..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/basic_sql_part.test +++ /dev/null @@ -1,571 +0,0 @@ -# This test tests by executing basic SQL ---disable_warnings ---disable_query_log ---disable_result_log ---source test_init.inc ---enable_result_log ---enable_query_log -if (!$HAVE_PARTITION) -{ - --disable_query_log - --disable_result_log - --source test_deinit.inc - --enable_result_log - --enable_query_log - --enable_warnings - skip Test requires partitioning; -} - ---echo ---echo drop and create databases ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - CREATE DATABASE auto_test_remote; - USE auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - CREATE DATABASE auto_test_remote2; - USE auto_test_remote2; -} ---enable_warnings - ---echo ---echo test select 1 ---connection master_1 -SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - SELECT 1; - --connection child2_2 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS tb_l; ---enable_warnings ---disable_query_log -echo CREATE TABLE tb_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) MASTER_1_ENGINE2 MASTER_1_CHARSET2; -eval CREATE TABLE tb_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; ---enable_query_log -INSERT INTO tb_l (a, b, c) VALUES - (1, 'f', '2008-07-01 10:21:39'), - (2, 'g', '2000-02-01 00:00:00'), - (3, 'j', '2007-05-04 20:03:11'), - (4, 'i', '2003-10-30 05:01:03'), - (5, 'h', '2001-10-31 23:59:59'); - ---echo ---echo create table with partition and select test -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_2_DROP_TABLES; - --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES2; - echo CHILD2_1_CREATE_TABLES2; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES2; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - --disable_query_log - echo CREATE TABLE ta_l2 ( - PRIMARY KEY(a) - ) MASTER_1_ENGINE MASTER_1_COMMENT_P_2_1 - SELECT a, b, c FROM tb_l; - if ($MASTER_1_MERGE) - { - --error ER_WRONG_OBJECT - eval CREATE TABLE ta_l2 ( - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1 - SELECT a, b, c FROM tb_l; - eval CREATE TABLE ta_l2 ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1; - INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; - } - if (!$MASTER_1_MERGE) - { - eval CREATE TABLE ta_l2 ( - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1 - SELECT a, b, c FROM tb_l; - } - --enable_query_log - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - } - eval $CHILD2_2_SELECT_TABLES; - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -} - ---echo ---echo select partition using pushdown -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE - a.b = 'g' ORDER BY a.a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } -} - ---echo ---echo select partition using index pushdown -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE - a.a > 0 AND a.b = 'g' ORDER BY a.a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } -} - ---echo ---echo update partition pushdown -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - UPDATE ta_l2 SET b = 'e', c = '2009-03-03 03:03:03' WHERE b = 'j'; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_2_SELECT_TABLES; - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -} - ---echo ---echo update partition index pushdown -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - UPDATE ta_l2 SET b = 'j', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'e'; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_2_SELECT_TABLES; - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -} - ---echo ---echo delete partition pushdown -if ($HAVE_PARTITION) -{ - TRUNCATE TABLE ta_l2; - INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - DELETE FROM ta_l2 WHERE b = 'g'; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'delete %'; - } - eval $CHILD2_2_SELECT_TABLES; - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -} - ---echo ---echo delete partition index pushdown -if ($HAVE_PARTITION) -{ - TRUNCATE TABLE ta_l2; - INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - DELETE FROM ta_l2 WHERE a > 0 AND b = 'g'; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'delete %'; - } - eval $CHILD2_2_SELECT_TABLES; - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -} - ---echo ---echo deinit ---disable_warnings ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; -} ---disable_query_log ---disable_result_log ---source test_deinit.inc ---enable_result_log ---enable_query_log ---enable_warnings ---echo ---echo end of test diff --git a/storage/spider/mysql-test/spider/oracle/t/connect_child2_1.inc b/storage/spider/mysql-test/spider/oracle/t/connect_child2_1.inc deleted file mode 100644 index cd9b0c9ca9b..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/connect_child2_1.inc +++ /dev/null @@ -1 +0,0 @@ ---connect (child2_1, localhost, root, , , $CHILD2_1_MYPORT, $CHILD2_1_MYSOCK) diff --git a/storage/spider/mysql-test/spider/oracle/t/connect_child2_2.inc b/storage/spider/mysql-test/spider/oracle/t/connect_child2_2.inc deleted file mode 100644 index e145f66b630..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/connect_child2_2.inc +++ /dev/null @@ -1 +0,0 @@ ---connect (child2_2, localhost, root, , , $CHILD2_2_MYPORT, $CHILD2_2_MYSOCK) diff --git a/storage/spider/mysql-test/spider/oracle/t/connect_child2_3.inc b/storage/spider/mysql-test/spider/oracle/t/connect_child2_3.inc deleted file mode 100644 index d356348d8ea..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/connect_child2_3.inc +++ /dev/null @@ -1 +0,0 @@ ---connect (child2_3, localhost, root, , , $CHILD2_3_MYPORT, $CHILD2_3_MYSOCK) diff --git a/storage/spider/mysql-test/spider/oracle/t/connect_child3_1.inc b/storage/spider/mysql-test/spider/oracle/t/connect_child3_1.inc deleted file mode 100644 index 03e5c188c89..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/connect_child3_1.inc +++ /dev/null @@ -1 +0,0 @@ ---connect (child3_1, localhost, root, , , $CHILD3_1_MYPORT, $CHILD3_1_MYSOCK) diff --git a/storage/spider/mysql-test/spider/oracle/t/connect_child3_2.inc b/storage/spider/mysql-test/spider/oracle/t/connect_child3_2.inc deleted file mode 100644 index d62a7ada824..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/connect_child3_2.inc +++ /dev/null @@ -1 +0,0 @@ ---connect (child3_2, localhost, root, , , $CHILD3_2_MYPORT, $CHILD3_2_MYSOCK) diff --git a/storage/spider/mysql-test/spider/oracle/t/connect_child3_3.inc b/storage/spider/mysql-test/spider/oracle/t/connect_child3_3.inc deleted file mode 100644 index fb49f5bfdac..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/connect_child3_3.inc +++ /dev/null @@ -1 +0,0 @@ ---connect (child3_3, localhost, root, , , $CHILD3_3_MYPORT, $CHILD3_3_MYSOCK) diff --git a/storage/spider/mysql-test/spider/oracle/t/connect_master_1.inc b/storage/spider/mysql-test/spider/oracle/t/connect_master_1.inc deleted file mode 100644 index 0c129ce5775..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/connect_master_1.inc +++ /dev/null @@ -1 +0,0 @@ ---connect (master_1, localhost, root, , , $MASTER_1_MYPORT, $MASTER_1_MYSOCK) diff --git a/storage/spider/mysql-test/spider/oracle/t/connect_slave1_1.inc b/storage/spider/mysql-test/spider/oracle/t/connect_slave1_1.inc deleted file mode 100644 index 45a822743e0..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/connect_slave1_1.inc +++ /dev/null @@ -1 +0,0 @@ ---connect (slave1_1, localhost, root, , , $SLAVE1_1_MYPORT, $SLAVE1_1_MYSOCK) diff --git a/storage/spider/mysql-test/spider/oracle/t/direct_aggregate.test b/storage/spider/mysql-test/spider/oracle/t/direct_aggregate.test deleted file mode 100644 index ca96d4bd41f..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/direct_aggregate.test +++ /dev/null @@ -1,181 +0,0 @@ ---disable_warnings ---disable_query_log ---disable_result_log ---source test_init.inc ---enable_result_log ---enable_query_log - ---echo ---echo drop and create databases ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - CREATE DATABASE auto_test_remote; - USE auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - CREATE DATABASE auto_test_remote2; - USE auto_test_remote2; -} ---enable_warnings - ---echo ---echo test select 1 ---connection master_1 -SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - SELECT 1; - --connection child2_2 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo create table select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS ta_l; ---enable_warnings ---disable_query_log -echo CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; ---enable_query_log -INSERT INTO ta_l (a, b, c) VALUES - (1, 'a', '2008-08-01 10:21:39'), - (2, 'b', '2000-01-01 00:00:00'), - (3, 'e', '2007-06-04 20:03:11'), - (4, 'd', '2003-11-30 05:01:03'), - (5, 'c', '2001-12-31 23:59:59'); - ---echo ---echo direct_aggregating test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_ps2_protocol -eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; -SELECT COUNT(*) FROM ta_l; -eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; -SELECT MAX(a) FROM ta_l; -eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; -SELECT MIN(a) FROM ta_l; -eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; -SELECT MAX(a) FROM ta_l WHERE a < 5; -eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; -SELECT MIN(a) FROM ta_l WHERE a > 1; -eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; ---enable_ps2_protocol -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo deinit ---disable_warnings ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; -} ---disable_query_log ---disable_result_log ---source test_deinit.inc ---enable_result_log ---enable_query_log ---enable_warnings ---echo ---echo end of test diff --git a/storage/spider/mysql-test/spider/oracle/t/direct_aggregate_part.test b/storage/spider/mysql-test/spider/oracle/t/direct_aggregate_part.test deleted file mode 100644 index d6d4623afc5..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/direct_aggregate_part.test +++ /dev/null @@ -1,194 +0,0 @@ ---disable_warnings ---disable_query_log ---disable_result_log ---source test_init.inc ---enable_result_log ---enable_query_log -if (!$HAVE_PARTITION) -{ - --disable_query_log - --disable_result_log - --source test_deinit.inc - --enable_result_log - --enable_query_log - --enable_warnings - skip Test requires partitioning; -} - ---echo ---echo drop and create databases ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - CREATE DATABASE auto_test_remote; - USE auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - CREATE DATABASE auto_test_remote2; - USE auto_test_remote2; -} ---enable_warnings - ---echo ---echo test select 1 ---connection master_1 -SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - SELECT 1; - --connection child2_2 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo with partition test -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_2_DROP_TABLES; - --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES2; - echo CHILD2_1_CREATE_TABLES2; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES2; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - --disable_query_log - echo CREATE TABLE ta_l2 ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1; - eval CREATE TABLE ta_l2 ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1; - INSERT INTO ta_l2 (a, b, c) VALUES - (1, 'a', '2008-08-01 10:21:39'), - (2, 'b', '2000-01-01 00:00:00'), - (3, 'e', '2007-06-04 20:03:11'), - (4, 'd', '2003-11-30 05:01:03'), - (5, 'c', '2001-12-31 23:59:59'); - --enable_query_log - --disable_ps2_protocol - eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; - SELECT COUNT(*) FROM ta_l2; - eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; - SELECT MAX(a) FROM ta_l2; - eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; - SELECT MIN(a) FROM ta_l2; - eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; - SELECT MAX(a) FROM ta_l2 WHERE a < 5; - eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; - SELECT MIN(a) FROM ta_l2 WHERE a > 1; - eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; - --enable_ps2_protocol - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %'; - } - eval $CHILD2_2_SELECT_TABLES; - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } -} - ---echo ---echo deinit ---disable_warnings ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; -} ---disable_query_log ---disable_result_log ---source test_deinit.inc ---enable_result_log ---enable_query_log ---enable_warnings ---echo ---echo end of test diff --git a/storage/spider/mysql-test/spider/oracle/t/direct_update.test b/storage/spider/mysql-test/spider/oracle/t/direct_update.test deleted file mode 100644 index e0901062201..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/direct_update.test +++ /dev/null @@ -1,198 +0,0 @@ ---disable_warnings ---disable_query_log ---disable_result_log ---source test_init.inc ---enable_result_log ---enable_query_log - ---echo ---echo drop and create databases ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - CREATE DATABASE auto_test_remote; - USE auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - CREATE DATABASE auto_test_remote2; - USE auto_test_remote2; -} ---enable_warnings - ---echo ---echo test select 1 ---connection master_1 -SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - SELECT 1; - --connection child2_2 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo create table select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS ta_l; ---enable_warnings ---disable_query_log -echo CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; ---enable_query_log -INSERT INTO ta_l (a, b, c) VALUES - (1, 'a', '2008-08-01 10:21:39'), - (2, 'b', '2000-01-01 00:00:00'), - (3, 'e', '2007-06-04 20:03:11'), - (4, 'd', '2003-11-30 05:01:03'), - (5, 'c', '2001-12-31 23:59:59'); - ---echo ---echo direct_updating test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; ---echo update all rows with function -UPDATE ta_l SET c = ADDDATE(c, 1); -eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; ---echo update by primary key -UPDATE ta_l SET b = 'x' WHERE a = 3; -eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; ---echo update by a column without index -UPDATE ta_l SET c = '2011-10-17' WHERE b = 'x'; -eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; ---echo update by primary key with order and limit -UPDATE ta_l SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1; -eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; ---echo delete by primary key with order and limit -DELETE FROM ta_l WHERE a < 4 ORDER BY c LIMIT 1; -eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; ---echo delete by a column without index -DELETE FROM ta_l WHERE b = 'c'; -eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; ---echo delete by primary key -DELETE FROM ta_l WHERE a = 3; -eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo deinit ---disable_warnings ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; -} ---disable_query_log ---disable_result_log ---source test_deinit.inc ---enable_result_log ---enable_query_log ---enable_warnings ---echo ---echo end of test diff --git a/storage/spider/mysql-test/spider/oracle/t/direct_update_part.test b/storage/spider/mysql-test/spider/oracle/t/direct_update_part.test deleted file mode 100644 index 95e2e2ab0d5..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/direct_update_part.test +++ /dev/null @@ -1,211 +0,0 @@ ---disable_warnings ---disable_query_log ---disable_result_log ---source test_init.inc ---enable_result_log ---enable_query_log -if (!$HAVE_PARTITION) -{ - --disable_query_log - --disable_result_log - --source test_deinit.inc - --enable_result_log - --enable_query_log - --enable_warnings - skip Test requires partitioning; -} - ---echo ---echo drop and create databases ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - CREATE DATABASE auto_test_remote; - USE auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - CREATE DATABASE auto_test_remote2; - USE auto_test_remote2; -} ---enable_warnings - ---echo ---echo test select 1 ---connection master_1 -SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - SELECT 1; - --connection child2_2 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo with partition test -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_2_DROP_TABLES; - --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES2; - echo CHILD2_1_CREATE_TABLES2; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES2; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - --disable_query_log - echo CREATE TABLE ta_l2 ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1; - eval CREATE TABLE ta_l2 ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1; - INSERT INTO ta_l2 (a, b, c) VALUES - (1, 'a', '2008-08-01 10:21:39'), - (2, 'b', '2000-01-01 00:00:00'), - (3, 'e', '2007-06-04 20:03:11'), - (4, 'd', '2003-11-30 05:01:03'), - (5, 'c', '2001-12-31 23:59:59'); - --enable_query_log - eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - --echo update all rows with function - UPDATE ta_l2 SET c = ADDDATE(c, 1); - eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - --echo update by primary key - UPDATE ta_l2 SET b = 'x' WHERE a = 3; - eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - --echo update by a column without index - UPDATE ta_l2 SET c = '2011-10-17' WHERE b = 'x'; - eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - --echo update by primary key with order and limit - UPDATE ta_l2 SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1; - eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - --echo delete by primary key with order and limit - DELETE FROM ta_l2 WHERE a < 4 ORDER BY c LIMIT 1; - eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS; - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - --echo delete by a column without index - DELETE FROM ta_l2 WHERE b = 'c'; - eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS; - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - --echo delete by primary key - DELETE FROM ta_l2 WHERE a = 3; - eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS; - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %'; - } - eval $CHILD2_2_SELECT_TABLES; - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } -} - ---echo ---echo deinit ---disable_warnings ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; -} ---disable_query_log ---disable_result_log ---source test_deinit.inc ---enable_result_log ---enable_query_log ---enable_warnings ---echo ---echo end of test diff --git a/storage/spider/mysql-test/spider/oracle/t/function.test b/storage/spider/mysql-test/spider/oracle/t/function.test deleted file mode 100644 index ec2eeab9c94..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/function.test +++ /dev/null @@ -1,253 +0,0 @@ -# This test tests for using functions ---disable_warnings ---disable_query_log ---disable_result_log ---source test_init.inc ---enable_result_log ---enable_query_log - ---echo ---echo drop and create databases ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - CREATE DATABASE auto_test_remote; - USE auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - CREATE DATABASE auto_test_remote2; - USE auto_test_remote2; -} ---enable_warnings - ---echo ---echo test select 1 ---connection master_1 -SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - SELECT 1; - --connection child2_2 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo in() -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_result_log - } - --disable_query_log - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_1_DROP_TEXT_PK_TABLES1; - echo CHILD2_1_CREATE_TEXT_PK_TABLES1; - } - --disable_warnings - eval $CHILD2_1_DROP_TEXT_PK_TABLES1; - --enable_warnings - eval $CHILD2_1_CREATE_TEXT_PK_TABLES1; - --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_result_log - } -} ---connection master_1 ---disable_query_log -echo CREATE TABLE t1 ( - a VARCHAR(255), - PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET3 MASTER_1_COMMENT_TEXT_PK1_1; -eval CREATE TABLE t1 ( - a VARCHAR(255), - PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET3 $MASTER_1_COMMENT_TEXT_PK1_1; ---enable_query_log -insert into t1 values ('1'); -insert into t1 select a + 1 from t1; -insert into t1 select a + 2 from t1; -insert into t1 select a + 4 from t1; -insert into t1 select a + 8 from t1; -insert into t1 select a + 16 from t1; -insert into t1 select a + 32 from t1; -insert into t1 select a + 64 from t1; -insert into t1 select a + 128 from t1; -insert into t1 select a + 256 from t1; -insert into t1 select a + 512 from t1; -flush tables; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -select a from t1 where a in ('15', '120'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TEXT_PK_TABLES1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo date_sub() -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS ta_l; ---enable_warnings ---disable_query_log -echo CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; ---enable_query_log -INSERT INTO ta_l (a, b, c) VALUES - (1, 'a', '2008-08-01 10:21:39'), - (2, 'b', '2000-01-01 00:00:00'), - (3, 'e', '2007-06-04 20:03:11'), - (4, 'd', '2003-11-30 05:01:03'), - (5, 'c', '2001-12-31 23:59:59'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 YEAR); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 QUARTER); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 MONTH); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 WEEK); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 DAY); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 HOUR); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 MINUTE); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 SECOND); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo deinit ---disable_warnings ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; -} ---disable_query_log ---disable_result_log ---source test_deinit.inc ---enable_result_log ---enable_query_log ---enable_warnings ---echo ---echo end of test diff --git a/storage/spider/mysql-test/spider/oracle/t/ha.test b/storage/spider/mysql-test/spider/oracle/t/ha.test deleted file mode 100644 index 00dcf776836..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/ha.test +++ /dev/null @@ -1,882 +0,0 @@ -# This test tests for ha features -if ($USE_HA_TEST) -{ ---disable_warnings ---disable_query_log ---disable_result_log ---source test_init.inc ---source ha_test_init.inc ---enable_result_log ---enable_query_log - ---echo ---echo drop and create databases ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - CREATE DATABASE auto_test_remote; - USE auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - CREATE DATABASE auto_test_remote2; - USE auto_test_remote2; - --connection child2_3 - DROP DATABASE IF EXISTS auto_test_remote3; - CREATE DATABASE auto_test_remote3; - USE auto_test_remote3; -} -if ($USE_CHILD_GROUP3) -{ - --connection child3_1 - DROP DATABASE IF EXISTS auto_test_local; - CREATE DATABASE auto_test_local; - USE auto_test_local; - --connection child3_2 - DROP DATABASE IF EXISTS auto_test_local; - CREATE DATABASE auto_test_local; - USE auto_test_local; - --connection child3_3 - DROP DATABASE IF EXISTS auto_test_local; - CREATE DATABASE auto_test_local; - USE auto_test_local; -} ---enable_warnings - ---echo ---echo test select 1 ---connection master_1 -SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - SELECT 1; - --connection child2_2 - SELECT 1; - --connection child2_3 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - SELECT 1; - --connection child3_2 - SELECT 1; - --connection child3_3 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo create table test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_2_DROP_TABLES; - --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_2_1; - --enable_warnings - eval $CHILD3_1_CREATE_TABLES_HA_2_1; - --connection child3_2 - --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_2_1; - --enable_warnings - eval $CHILD3_2_CREATE_TABLES_HA_2_1; - --connection child3_3 - --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_2_1; - --enable_warnings - eval $CHILD3_3_CREATE_TABLES_HA_2_1; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS ta_l; ---enable_warnings ---disable_query_log -echo CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_2_1; -eval CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_2_1; ---enable_query_log -INSERT INTO ta_l (a, b, c) VALUES - (1, 'a', '2008-08-01 10:21:39'), - (2, 'b', '2000-01-01 00:00:00'), - (3, 'e', '2007-06-04 20:03:11'), - (4, 'd', '2003-11-30 05:01:03'), - (5, 'c', '2001-12-31 23:59:59'); - ---echo ---echo select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo fail-over test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_HA_DROP_TABLES; - } - --disable_warnings - eval $CHILD2_2_HA_DROP_TABLES; - --enable_warnings - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -eval $MASTER_1_CHECK_HA_STATUS; ---error 12511 -INSERT INTO ta_l (a, b, c) VALUES - (6, 'e', '2011-05-05 20:04:05'); -eval $MASTER_1_CHECK_LINK_STATUS; -eval $MASTER_1_CHECK_LINK_FAILED_LOG; -eval $MASTER_1_CHECK_HA_STATUS; -INSERT INTO ta_l (a, b, c) VALUES - (6, 'e', '2011-05-05 20:04:05'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - eval $CHILD3_1_CHECK_LINK_STATUS; - eval $CHILD3_1_CHECK_LINK_FAILED_LOG; - --connection child3_2 - eval $CHILD3_2_CHECK_LINK_STATUS; - eval $CHILD3_2_CHECK_LINK_FAILED_LOG; - --connection child3_3 - eval $CHILD3_3_CHECK_LINK_STATUS; - eval $CHILD3_3_CHECK_LINK_FAILED_LOG; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo recovery test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_HA_CREATE_TABLES; - } - eval $CHILD2_2_HA_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - eval $CHILD3_1_SET_RECOVERY_STATUS_2_1; - eval $CHILD3_1_CHECK_LINK_STATUS; - --connection child3_2 - eval $CHILD3_2_SET_RECOVERY_STATUS_2_1; - eval $CHILD3_2_CHECK_LINK_STATUS; - --connection child3_3 - eval $CHILD3_3_SET_RECOVERY_STATUS_2_1; - eval $CHILD3_3_CHECK_LINK_STATUS; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -eval $MASTER_1_SET_RECOVERY_STATUS_2_1; -eval $MASTER_1_CHECK_LINK_STATUS; -eval $MASTER_1_COPY_TABLES_2_1; -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - eval $CHILD3_1_SET_OK_STATUS_2_1; - eval $CHILD3_1_CHECK_LINK_STATUS; - --connection child3_2 - eval $CHILD3_2_SET_OK_STATUS_2_1; - eval $CHILD3_2_CHECK_LINK_STATUS; - --connection child3_3 - eval $CHILD3_3_SET_OK_STATUS_2_1; - eval $CHILD3_3_CHECK_LINK_STATUS; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -eval $MASTER_1_SET_OK_STATUS_2_1; -eval $MASTER_1_CHECK_LINK_STATUS; -INSERT INTO ta_l (a, b, c) VALUES - (8, 'g', '2011-05-05 21:33:30'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -DROP TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_2_1; - --enable_warnings - --connection child3_2 - --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_2_1; - --enable_warnings - --connection child3_3 - --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_2_1; - --enable_warnings - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } -} - ---connection master_1 ---disable_ps2_protocol -eval $MASTER_1_CHANGE_HA_MON; ---enable_ps2_protocol - ---echo ---echo active standby test ---echo create table test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_2_DROP_TABLES; - --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_2_1; - --enable_warnings - eval $CHILD3_1_CREATE_TABLES_HA_AS_2_1; - --connection child3_2 - --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_2_1; - --enable_warnings - eval $CHILD3_2_CREATE_TABLES_HA_AS_2_1; - --connection child3_3 - --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_2_1; - --enable_warnings - eval $CHILD3_3_CREATE_TABLES_HA_AS_2_1; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS ta_l; ---enable_warnings ---disable_query_log -echo CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_2_1; -eval CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_AS_2_1; ---enable_query_log -INSERT INTO ta_l (a, b, c) VALUES - (1, 'a', '2008-08-01 10:21:39'), - (2, 'b', '2000-01-01 00:00:00'), - (3, 'e', '2007-06-04 20:03:11'), - (4, 'd', '2003-11-30 05:01:03'), - (5, 'c', '2001-12-31 23:59:59'); - ---echo ---echo select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo fail-over test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_HA_AS_DROP_TABLES; - } - --disable_warnings - eval $CHILD2_1_HA_AS_DROP_TABLES; - --enable_warnings - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -eval $MASTER_1_CHECK_HA_STATUS; ---error 12511 -INSERT INTO ta_l (a, b, c) VALUES - (6, 'e', '2011-05-05 20:04:05'); -eval $MASTER_1_CHECK_LINK_STATUS; -eval $MASTER_1_CHECK_LINK_FAILED_LOG; -eval $MASTER_1_CHECK_HA_STATUS; -INSERT INTO ta_l (a, b, c) VALUES - (6, 'e', '2011-05-05 20:04:05'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - eval $CHILD3_1_CHECK_LINK_STATUS; - eval $CHILD3_1_CHECK_LINK_FAILED_LOG; - --connection child3_2 - eval $CHILD3_2_CHECK_LINK_STATUS; - eval $CHILD3_2_CHECK_LINK_FAILED_LOG; - --connection child3_3 - eval $CHILD3_3_CHECK_LINK_STATUS; - eval $CHILD3_3_CHECK_LINK_FAILED_LOG; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo recovery test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_HA_AS_CREATE_TABLES; - } - eval $CHILD2_1_HA_AS_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - eval $CHILD3_1_SET_OK_STATUS_AS_2_1; - eval $CHILD3_1_CHECK_LINK_STATUS; - --connection child3_2 - eval $CHILD3_2_SET_OK_STATUS_AS_2_1; - eval $CHILD3_2_CHECK_LINK_STATUS; - --connection child3_3 - eval $CHILD3_3_SET_OK_STATUS_AS_2_1; - eval $CHILD3_3_CHECK_LINK_STATUS; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -eval $MASTER_1_SET_OK_STATUS_AS_2_1; -eval $MASTER_1_CHECK_LINK_STATUS; -INSERT INTO ta_l (a, b, c) VALUES - (8, 'g', '2011-05-05 21:33:30'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -DROP TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_2_1; - --enable_warnings - --connection child3_2 - --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_2_1; - --enable_warnings - --connection child3_3 - --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_2_1; - --enable_warnings - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } -} - ---connection master_1 ---disable_ps2_protocol -eval $MASTER_1_CHANGE_HA_MON; ---enable_ps2_protocol - ---echo ---echo deinit ---disable_warnings ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - --connection child2_3 - DROP DATABASE IF EXISTS auto_test_remote3; -} -if ($USE_CHILD_GROUP3) -{ - --connection child3_1 - DROP DATABASE IF EXISTS auto_test_local; - --connection child3_2 - DROP DATABASE IF EXISTS auto_test_local; - --connection child3_3 - DROP DATABASE IF EXISTS auto_test_local; -} ---disable_query_log ---disable_result_log ---source ha_test_deinit.inc ---source test_deinit.inc ---enable_result_log ---enable_query_log ---enable_warnings -} ---echo ---echo end of test diff --git a/storage/spider/mysql-test/spider/oracle/t/ha_part.test b/storage/spider/mysql-test/spider/oracle/t/ha_part.test deleted file mode 100644 index 72ddcfd1f10..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/ha_part.test +++ /dev/null @@ -1,1017 +0,0 @@ -# This test tests for ha features -if ($USE_HA_TEST) -{ ---disable_warnings ---disable_query_log ---disable_result_log ---source test_init.inc ---source ha_test_init.inc ---enable_result_log ---enable_query_log -if (!$HAVE_PARTITION) -{ - --disable_query_log - --disable_result_log - --source ha_test_deinit.inc - --source test_deinit.inc - --enable_result_log - --enable_query_log - --enable_warnings - skip Test requires partitioning; -} - ---echo ---echo drop and create databases ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - CREATE DATABASE auto_test_remote; - USE auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - CREATE DATABASE auto_test_remote2; - USE auto_test_remote2; - --connection child2_3 - DROP DATABASE IF EXISTS auto_test_remote3; - CREATE DATABASE auto_test_remote3; - USE auto_test_remote3; -} -if ($USE_CHILD_GROUP3) -{ - --connection child3_1 - DROP DATABASE IF EXISTS auto_test_local; - CREATE DATABASE auto_test_local; - USE auto_test_local; - --connection child3_2 - DROP DATABASE IF EXISTS auto_test_local; - CREATE DATABASE auto_test_local; - USE auto_test_local; - --connection child3_3 - DROP DATABASE IF EXISTS auto_test_local; - CREATE DATABASE auto_test_local; - USE auto_test_local; -} ---enable_warnings - ---echo ---echo test select 1 ---connection master_1 -SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - SELECT 1; - --connection child2_2 - SELECT 1; - --connection child2_3 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - SELECT 1; - --connection child3_2 - SELECT 1; - --connection child3_3 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } -} - -if ($HAVE_PARTITION) -{ - --echo - --echo create table with partition test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_DROP_TABLES2; - echo CHILD2_1_CREATE_TABLES; - echo CHILD2_1_CREATE_TABLES2; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES; - eval $CHILD2_1_DROP_TABLES2; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - eval $CHILD2_1_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_2_DROP_TABLES; - --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_3 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_3_DROP_TABLES; - echo CHILD2_3_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_3_DROP_TABLES; - --enable_warnings - eval $CHILD2_3_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_P_2_1; - --enable_warnings - eval $CHILD3_1_CREATE_TABLES_HA_P_2_1; - --connection child3_2 - --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_P_2_1; - --enable_warnings - eval $CHILD3_2_CREATE_TABLES_HA_P_2_1; - --connection child3_3 - --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_P_2_1; - --enable_warnings - eval $CHILD3_3_CREATE_TABLES_HA_P_2_1; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - --disable_warnings - DROP TABLE IF EXISTS ta_l2; - --enable_warnings - --disable_query_log - echo CREATE TABLE ta_l2 ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_P_2_1; - eval CREATE TABLE ta_l2 ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_P_2_1; - --enable_query_log - INSERT INTO ta_l2 (a, b, c) VALUES - (1, 'a', '2008-08-01 10:21:39'), - (2, 'b', '2000-01-01 00:00:00'), - (3, 'e', '2007-06-04 20:03:11'), - (4, 'd', '2003-11-30 05:01:03'), - (5, 'c', '2001-12-31 23:59:59'); - - --echo - --echo select test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_3 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - eval $CHILD2_1_SELECT_TABLES2; - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - --connection child2_3 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_3_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - - --echo - --echo fail-over test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_3 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_3_HA_DROP_TABLES; - } - --disable_warnings - eval $CHILD2_3_HA_DROP_TABLES; - --enable_warnings - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - eval $MASTER_1_CHECK_HA_STATUS; - --error 12511 - INSERT INTO ta_l2 (a, b, c) VALUES - (6, 'e', '2011-05-05 20:04:05'); - eval $MASTER_1_CHECK_LINK_STATUS; - eval $MASTER_1_CHECK_LINK_FAILED_LOG; - eval $MASTER_1_CHECK_HA_STATUS; - INSERT INTO ta_l2 (a, b, c) VALUES - (6, 'e', '2011-05-05 20:04:05'); - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - eval $CHILD2_1_SELECT_TABLES2; - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - eval $CHILD3_1_CHECK_LINK_STATUS; - eval $CHILD3_1_CHECK_LINK_FAILED_LOG; - --connection child3_2 - eval $CHILD3_2_CHECK_LINK_STATUS; - eval $CHILD3_2_CHECK_LINK_FAILED_LOG; - --connection child3_3 - eval $CHILD3_3_CHECK_LINK_STATUS; - eval $CHILD3_3_CHECK_LINK_FAILED_LOG; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } - } - - --echo - --echo recovery test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_3 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_3_HA_CREATE_TABLES; - } - eval $CHILD2_3_HA_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - eval $CHILD3_1_SET_RECOVERY_STATUS_P_2_1; - eval $CHILD3_1_CHECK_LINK_STATUS; - --connection child3_2 - eval $CHILD3_2_SET_RECOVERY_STATUS_P_2_1; - eval $CHILD3_2_CHECK_LINK_STATUS; - --connection child3_3 - eval $CHILD3_3_SET_RECOVERY_STATUS_P_2_1; - eval $CHILD3_3_CHECK_LINK_STATUS; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - eval $MASTER_1_SET_RECOVERY_STATUS_P_2_1; - eval $MASTER_1_CHECK_LINK_STATUS; - eval $MASTER_1_COPY_TABLES_P_2_1; - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - eval $CHILD3_1_SET_OK_STATUS_P_2_1; - eval $CHILD3_1_CHECK_LINK_STATUS; - --connection child3_2 - eval $CHILD3_2_SET_OK_STATUS_P_2_1; - eval $CHILD3_2_CHECK_LINK_STATUS; - --connection child3_3 - eval $CHILD3_3_SET_OK_STATUS_P_2_1; - eval $CHILD3_3_CHECK_LINK_STATUS; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - eval $MASTER_1_SET_OK_STATUS_P_2_1; - eval $MASTER_1_CHECK_LINK_STATUS; - INSERT INTO ta_l2 (a, b, c) VALUES - (8, 'g', '2011-05-05 21:33:30'), - (9, 'h', '2011-05-05 22:32:10'); - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - DROP TABLE ta_l2; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - eval $CHILD2_1_SELECT_TABLES2; - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - --connection child2_3 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_3_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_P_2_1; - --enable_warnings - --connection child3_2 - --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_P_2_1; - --enable_warnings - --connection child3_3 - --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_P_2_1; - --enable_warnings - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } - } -} - -if ($HAVE_PARTITION) -{ - --echo - --echo create table with partition test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_DROP_TABLES2; - echo CHILD2_1_CREATE_TABLES; - echo CHILD2_1_CREATE_TABLES2; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES; - eval $CHILD2_1_DROP_TABLES2; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - eval $CHILD2_1_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_2_DROP_TABLES; - --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_3 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_3_DROP_TABLES; - echo CHILD2_3_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_3_DROP_TABLES; - --enable_warnings - eval $CHILD2_3_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_P_2_1; - --enable_warnings - eval $CHILD3_1_CREATE_TABLES_HA_AS_P_2_1; - --connection child3_2 - --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_P_2_1; - --enable_warnings - eval $CHILD3_2_CREATE_TABLES_HA_AS_P_2_1; - --connection child3_3 - --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_P_2_1; - --enable_warnings - eval $CHILD3_3_CREATE_TABLES_HA_AS_P_2_1; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - --disable_warnings - DROP TABLE IF EXISTS ta_l2; - --enable_warnings - --disable_query_log - echo CREATE TABLE ta_l2 ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_P_2_1; - eval CREATE TABLE ta_l2 ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_AS_P_2_1; - --enable_query_log - INSERT INTO ta_l2 (a, b, c) VALUES - (1, 'a', '2008-08-01 10:21:39'), - (2, 'b', '2000-01-01 00:00:00'), - (3, 'e', '2007-06-04 20:03:11'), - (4, 'd', '2003-11-30 05:01:03'), - (5, 'c', '2001-12-31 23:59:59'); - - --echo - --echo select test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_3 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - eval $CHILD2_1_SELECT_TABLES2; - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - --connection child2_3 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_3_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - - --echo - --echo fail-over test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_HA_AS_DROP_TABLES2; - } - --disable_warnings - eval $CHILD2_1_HA_AS_DROP_TABLES2; - --enable_warnings - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_3 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - eval $MASTER_1_CHECK_HA_STATUS; - --error 12511 - INSERT INTO ta_l2 (a, b, c) VALUES - (6, 'e', '2011-05-05 20:04:05'); - eval $MASTER_1_CHECK_LINK_STATUS; - eval $MASTER_1_CHECK_LINK_FAILED_LOG; - eval $MASTER_1_CHECK_HA_STATUS; - INSERT INTO ta_l2 (a, b, c) VALUES - (6, 'e', '2011-05-05 20:04:05'); - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - --connection child2_3 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_3_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - eval $CHILD3_1_CHECK_LINK_STATUS; - eval $CHILD3_1_CHECK_LINK_FAILED_LOG; - --connection child3_2 - eval $CHILD3_2_CHECK_LINK_STATUS; - eval $CHILD3_2_CHECK_LINK_FAILED_LOG; - --connection child3_3 - eval $CHILD3_3_CHECK_LINK_STATUS; - eval $CHILD3_3_CHECK_LINK_FAILED_LOG; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } - } - - --echo - --echo recovery test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_HA_AS_CREATE_TABLES2; - } - eval $CHILD2_1_HA_AS_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_3 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - eval $CHILD3_1_SET_OK_STATUS_AS_P_2_1; - eval $CHILD3_1_CHECK_LINK_STATUS; - --connection child3_2 - eval $CHILD3_2_SET_OK_STATUS_AS_P_2_1; - eval $CHILD3_2_CHECK_LINK_STATUS; - --connection child3_3 - eval $CHILD3_3_SET_OK_STATUS_AS_P_2_1; - eval $CHILD3_3_CHECK_LINK_STATUS; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - eval $MASTER_1_SET_OK_STATUS_AS_P_2_1; - eval $MASTER_1_CHECK_LINK_STATUS; - INSERT INTO ta_l2 (a, b, c) VALUES - (8, 'g', '2011-05-05 21:33:30'), - (9, 'h', '2011-05-05 22:32:10'); - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - DROP TABLE ta_l2; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - eval $CHILD2_1_SELECT_TABLES2; - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - --connection child2_3 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_3_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_P_2_1; - --enable_warnings - --connection child3_2 - --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_P_2_1; - --enable_warnings - --connection child3_3 - --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_P_2_1; - --enable_warnings - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } - } -} - ---echo ---echo deinit ---disable_warnings ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - --connection child2_3 - DROP DATABASE IF EXISTS auto_test_remote3; -} -if ($USE_CHILD_GROUP3) -{ - --connection child3_1 - DROP DATABASE IF EXISTS auto_test_local; - --connection child3_2 - DROP DATABASE IF EXISTS auto_test_local; - --connection child3_3 - DROP DATABASE IF EXISTS auto_test_local; -} ---disable_query_log ---disable_result_log ---source ha_test_deinit.inc ---source test_deinit.inc ---enable_result_log ---enable_query_log ---enable_warnings -} ---echo ---echo end of test diff --git a/storage/spider/mysql-test/spider/oracle/t/ha_test_deinit.inc b/storage/spider/mysql-test/spider/oracle/t/ha_test_deinit.inc deleted file mode 100644 index 53d0409d066..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/ha_test_deinit.inc +++ /dev/null @@ -1,30 +0,0 @@ -# get connection and exist engine test ---echo for master_1 ---connection master_1 ---source ../include/ha_deinit_master_1.inc ---echo for child2 -if ($USE_CHILD_GROUP2) -{ - --echo child2_1 - --connection child2_1 - --source ../include/ha_deinit_child2_1.inc - --echo child2_2 - --connection child2_2 - --source ../include/ha_deinit_child2_2.inc - --echo child2_3 - --connection child2_3 - --source ../include/ha_deinit_child2_3.inc -} ---echo for child3 -if ($USE_CHILD_GROUP3) -{ - --echo child3_1 - --connection child3_1 - --source ../include/ha_deinit_child3_1.inc - --echo child3_2 - --connection child3_2 - --source ../include/ha_deinit_child3_2.inc - --echo child3_3 - --connection child3_3 - --source ../include/ha_deinit_child3_3.inc -} diff --git a/storage/spider/mysql-test/spider/oracle/t/ha_test_init.inc b/storage/spider/mysql-test/spider/oracle/t/ha_test_init.inc deleted file mode 100644 index 70576ab16dc..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/ha_test_init.inc +++ /dev/null @@ -1,30 +0,0 @@ -# get connection and exist engine test ---echo for master_1 ---connection master_1 ---source ../include/ha_init_master_1.inc ---echo for child2 -if ($USE_CHILD_GROUP2) -{ - --echo child2_1 - --connection child2_1 - --source ../include/ha_init_child2_1.inc - --echo child2_2 - --connection child2_2 - --source ../include/ha_init_child2_2.inc - --echo child2_3 - --connection child2_3 - --source ../include/ha_init_child2_3.inc -} ---echo for child3 -if ($USE_CHILD_GROUP3) -{ - --echo child3_1 - --connection child3_1 - --source ../include/ha_init_child3_1.inc - --echo child3_2 - --connection child3_2 - --source ../include/ha_init_child3_2.inc - --echo child3_3 - --connection child3_3 - --source ../include/ha_init_child3_3.inc -} diff --git a/storage/spider/mysql-test/spider/oracle/t/have_engine.inc b/storage/spider/mysql-test/spider/oracle/t/have_engine.inc deleted file mode 100644 index 64bef7499cb..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/have_engine.inc +++ /dev/null @@ -1,7 +0,0 @@ -if (!`SELECT count(*) FROM information_schema.engines WHERE - (support = 'YES' OR support = 'DEFAULT') AND - engine = '$TEST_ENGINE_TYPE'`) -{ - SELECT engine, support FROM information_schema.engines; - --let $SKIP_REASON= "Need $TEST_ENGINE_TYPE engine" -} diff --git a/storage/spider/mysql-test/spider/oracle/t/have_func.inc b/storage/spider/mysql-test/spider/oracle/t/have_func.inc deleted file mode 100644 index e0823e73fc8..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/have_func.inc +++ /dev/null @@ -1,5 +0,0 @@ -if (!`SELECT count(*) FROM mysql.func WHERE name = '$TEST_FUNC_NAME'`) -{ - SELECT name FROM mysql.func; - --let $SKIP_REASON= "Need $TEST_FUNC_NAME function" -} diff --git a/storage/spider/mysql-test/spider/oracle/t/have_partition.inc b/storage/spider/mysql-test/spider/oracle/t/have_partition.inc deleted file mode 100644 index b6e699475db..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/have_partition.inc +++ /dev/null @@ -1,7 +0,0 @@ -let $HAVE_PARTITION= 0; -if (`SELECT count(*) FROM information_schema.plugins WHERE - plugin_status = 'ACTIVE' AND - plugin_name = 'partition'`) -{ - let $HAVE_PARTITION= 1; -} diff --git a/storage/spider/mysql-test/spider/oracle/t/have_trigger.inc b/storage/spider/mysql-test/spider/oracle/t/have_trigger.inc deleted file mode 100644 index 32de484b388..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/have_trigger.inc +++ /dev/null @@ -1,2 +0,0 @@ -let $HAVE_TRIGGER= `SELECT COUNT(*) FROM information_schema.tables - WHERE TABLE_SCHEMA = 'information_schema' AND TABLE_NAME = 'TRIGGERS'`; diff --git a/storage/spider/mysql-test/spider/oracle/t/hs_test_deinit.inc b/storage/spider/mysql-test/spider/oracle/t/hs_test_deinit.inc deleted file mode 100644 index 7ec2e981fd2..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/hs_test_deinit.inc +++ /dev/null @@ -1,17 +0,0 @@ -# get connection and exist engine test ---echo for master_1 ---connection master_1 ---source ../include/hs_deinit_master_1.inc ---echo for child2 -if ($USE_CHILD_GROUP2) -{ - --echo child2_1 - --connection child2_1 - --source ../include/hs_deinit_child2_1.inc - --echo child2_2 - --connection child2_2 - --source ../include/hs_deinit_child2_2.inc - --echo child2_3 - --connection child2_3 - --source ../include/hs_deinit_child2_3.inc -} diff --git a/storage/spider/mysql-test/spider/oracle/t/hs_test_init.inc b/storage/spider/mysql-test/spider/oracle/t/hs_test_init.inc deleted file mode 100644 index 831bf479524..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/hs_test_init.inc +++ /dev/null @@ -1,17 +0,0 @@ -# get connection and exist engine test ---echo for master_1 ---connection master_1 ---source ../include/hs_init_master_1.inc ---echo for child2 -if ($USE_CHILD_GROUP2) -{ - --echo child2_1 - --connection child2_1 - --source ../include/hs_init_child2_1.inc - --echo child2_2 - --connection child2_2 - --source ../include/hs_init_child2_2.inc - --echo child2_3 - --connection child2_3 - --source ../include/hs_init_child2_3.inc -} diff --git a/storage/spider/mysql-test/spider/oracle/t/slave_test_deinit.inc b/storage/spider/mysql-test/spider/oracle/t/slave_test_deinit.inc deleted file mode 100644 index e9d99b7a960..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/slave_test_deinit.inc +++ /dev/null @@ -1,6 +0,0 @@ -# get connection and exist engine test ---echo for slave1_1 ---connection slave1_1 -STOP SLAVE; ---source ../include/deinit_slave1_1.inc ---disconnect slave1_1 diff --git a/storage/spider/mysql-test/spider/oracle/t/slave_test_init.inc b/storage/spider/mysql-test/spider/oracle/t/slave_test_init.inc deleted file mode 100644 index 739d88970c5..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/slave_test_init.inc +++ /dev/null @@ -1,44 +0,0 @@ -# get connection and exist engine test ---echo for slave1_1 ---source connect_slave1_1.inc ---connection slave1_1 -SET SESSION sql_log_bin= 0; ---let $SLAVE1_1_SERVER_ID=`SELECT @@global.server_id` ---let $TEST_ENGINE_TYPE= $SLAVE1_1_ENGINE_TYPE ---source have_partition.inc ---source have_trigger.inc ---source ../include/init_slave1_1.inc ---source have_engine.inc ---let $SLAVE1_1_SLAVE_STATUS=`SHOW SLAVE STATUS` -if (!$SLAVE1_1_SLAVE_STATUS) -{ - eval CHANGE MASTER TO - MASTER_HOST = '127.0.0.1', - MASTER_USER = 'root', - MASTER_PASSWORD = '', - MASTER_PORT = $MASTER_1_MYPORT - ; -} -START SLAVE; ---connection master_1 -call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); ---connection slave1_1 -call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); - --connection child2_2 - call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); - --connection child2_3 - call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); -} -if ($USE_CHILD_GROUP3) -{ - --connection child3_1 - call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); - --connection child3_2 - call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); - --connection child3_3 - call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); -} diff --git a/storage/spider/mysql-test/spider/oracle/t/spider3_fixes.test b/storage/spider/mysql-test/spider/oracle/t/spider3_fixes.test deleted file mode 100644 index 13fa6f5fa39..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/spider3_fixes.test +++ /dev/null @@ -1,292 +0,0 @@ -# This test tests for Spider 3.0's bug fixes -source include/have_log_bin.inc; ---disable_warnings ---disable_query_log ---disable_result_log ---source test_init.inc ---source slave_test_init.inc ---enable_result_log ---enable_query_log - ---echo ---echo drop and create databases ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -if ($USE_REPLICATION) -{ - --connection slave1_1 - DROP DATABASE IF EXISTS auto_test_local; - CREATE DATABASE auto_test_local; - USE auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - CREATE DATABASE auto_test_remote; - USE auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - CREATE DATABASE auto_test_remote2; - USE auto_test_remote2; -} ---enable_warnings - ---echo ---echo test select 1 ---connection master_1 -SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - SELECT 1; - --connection child2_2 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - - ---echo ---echo 3.1 ---echo auto_increment -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_INCREMENT_TABLES1; - echo CHILD2_1_CREATE_INCREMENT_TABLES1; - echo CHILD2_1_AUTO_INCREMENT_INCREMENT2; - echo CHILD2_1_AUTO_INCREMENT_OFFSET2; - } - --disable_warnings - eval $CHILD2_1_DROP_INCREMENT_TABLES1; - --enable_warnings - eval $CHILD2_1_CREATE_INCREMENT_TABLES1; - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -if ($USE_REPLICATION) -{ - save_master_pos; - --connection slave1_1 - sync_with_master; - --connection master_1 - --disable_query_log - SET SESSION sql_log_bin= 0; - --enable_query_log -} ---disable_warnings -DROP TABLE IF EXISTS t1, t2; ---enable_warnings ---disable_query_log -echo CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1; -echo CREATE TABLE t2 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1; -echo MASTER_1_AUTO_INCREMENT_INCREMENT2; -echo MASTER_1_AUTO_INCREMENT_OFFSET2; -eval CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1; -eval CREATE TABLE t2 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1; -eval $MASTER_1_AUTO_INCREMENT_INCREMENT2; -eval $MASTER_1_AUTO_INCREMENT_OFFSET2; -if ($USE_REPLICATION) -{ - SET SESSION sql_log_bin= 1; - --connection slave1_1 - --disable_warnings - DROP TABLE IF EXISTS t1, t2; - --enable_warnings - echo CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1; - echo CREATE TABLE t2 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1; - eval CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1; - eval CREATE TABLE t2 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1; - --connection master_1 -} ---enable_query_log -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -SELECT MAX(id) FROM t1; -INSERT INTO t2 () VALUES (); -SELECT LAST_INSERT_ID(); -SELECT MAX(id) FROM t2; ---disable_query_log -echo MASTER_1_AUTO_INCREMENT_OFFSET3; -eval $MASTER_1_AUTO_INCREMENT_OFFSET3; ---enable_query_log -INSERT INTO t1 (id) VALUES (null); -SELECT LAST_INSERT_ID(); -SELECT MAX(id) FROM t1; ---disable_query_log -echo MASTER_1_AUTO_INCREMENT_OFFSET4; -eval $MASTER_1_AUTO_INCREMENT_OFFSET4; ---enable_query_log -INSERT INTO t2 (id) VALUES (null); -SELECT LAST_INSERT_ID(); -SELECT MAX(id) FROM t2; ---disable_query_log -echo MASTER_1_AUTO_INCREMENT_OFFSET3; -eval $MASTER_1_AUTO_INCREMENT_OFFSET3; ---enable_query_log -INSERT INTO t1 () VALUES (),(),(),(); -SELECT LAST_INSERT_ID(); -SELECT id FROM t1 ORDER BY id; ---disable_query_log -echo MASTER_1_AUTO_INCREMENT_OFFSET4; -eval $MASTER_1_AUTO_INCREMENT_OFFSET4; ---enable_query_log -INSERT INTO t2 () VALUES (),(),(),(); -SELECT LAST_INSERT_ID(); -SELECT id FROM t2 ORDER BY id; -TRUNCATE TABLE t1; -TRUNCATE TABLE t2; -INSERT INTO t1 () VALUES (),(),(),(); -SELECT LAST_INSERT_ID(); -SELECT id FROM t1 ORDER BY id; -INSERT INTO t2 () VALUES (),(),(),(); -SELECT LAST_INSERT_ID(); -SELECT id FROM t2 ORDER BY id; -SET INSERT_ID=5000; ---disable_query_log -echo MASTER_1_AUTO_INCREMENT_OFFSET3; -eval $MASTER_1_AUTO_INCREMENT_OFFSET3; ---enable_query_log -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -SELECT MAX(id) FROM t1; ---disable_query_log -echo MASTER_1_AUTO_INCREMENT_OFFSET4; -eval $MASTER_1_AUTO_INCREMENT_OFFSET4; ---enable_query_log -INSERT INTO t2 () VALUES (); -SELECT LAST_INSERT_ID(); -SELECT MAX(id) FROM t2; -INSERT INTO t1 (id) VALUES (10000); -SELECT LAST_INSERT_ID(); -SELECT MAX(id) FROM t1; -INSERT INTO t2 (id) VALUES (1000); -SELECT LAST_INSERT_ID(); -SELECT MAX(id) FROM t2; -if ($USE_REPLICATION) -{ - save_master_pos; - --connection slave1_1 - sync_with_master; - SELECT id FROM t1 ORDER BY id; - --connection master_1 - --disable_query_log - SET SESSION sql_log_bin= 0; - --enable_query_log -} -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_INCREMENT_TABLES1; - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_AUTO_INCREMENT_INCREMENT1; - echo CHILD2_1_AUTO_INCREMENT_OFFSET1; - } - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET1; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - - ---echo ---echo deinit ---disable_warnings ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -if ($USE_REPLICATION) -{ - --connection slave1_1 - DROP DATABASE IF EXISTS auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; -} ---disable_query_log ---disable_result_log ---source slave_test_deinit.inc ---source test_deinit.inc ---enable_result_log ---enable_query_log ---enable_warnings ---echo ---echo end of test diff --git a/storage/spider/mysql-test/spider/oracle/t/spider3_fixes_part.test b/storage/spider/mysql-test/spider/oracle/t/spider3_fixes_part.test deleted file mode 100644 index 3288c490a46..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/spider3_fixes_part.test +++ /dev/null @@ -1,345 +0,0 @@ -# This test tests for Spider 3.0's bug fixes -source include/have_log_bin.inc; ---disable_warnings ---disable_query_log ---disable_result_log ---source test_init.inc ---source slave_test_init.inc ---enable_result_log ---enable_query_log -if (!$HAVE_PARTITION) -{ - --disable_query_log - --disable_result_log - --source slave_test_deinit.inc - --source test_deinit.inc - --enable_result_log - --enable_query_log - --enable_warnings - skip Test requires partitioning; -} - ---echo ---echo drop and create databases ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -if ($USE_REPLICATION) -{ - --connection slave1_1 - DROP DATABASE IF EXISTS auto_test_local; - CREATE DATABASE auto_test_local; - USE auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - CREATE DATABASE auto_test_remote; - USE auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - CREATE DATABASE auto_test_remote2; - USE auto_test_remote2; -} ---enable_warnings - ---echo ---echo test select 1 ---connection master_1 -SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - SELECT 1; - --connection child2_2 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - - ---echo auto_increment with partition -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_INCREMENT_TABLES1; - echo CHILD2_1_CREATE_INCREMENT_TABLES1; - echo CHILD2_1_AUTO_INCREMENT_INCREMENT2; - echo CHILD2_1_AUTO_INCREMENT_OFFSET2; - } - --disable_warnings - eval $CHILD2_1_DROP_INCREMENT_TABLES1; - --enable_warnings - eval $CHILD2_1_CREATE_INCREMENT_TABLES1; - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_INCREMENT_TABLES1; - echo CHILD2_2_CREATE_INCREMENT_TABLES1; - echo CHILD2_2_AUTO_INCREMENT_INCREMENT2; - echo CHILD2_2_AUTO_INCREMENT_OFFSET2; - } - --disable_warnings - eval $CHILD2_2_DROP_INCREMENT_TABLES1; - --enable_warnings - eval $CHILD2_2_CREATE_INCREMENT_TABLES1; - eval $CHILD2_2_AUTO_INCREMENT_INCREMENT2; - eval $CHILD2_2_AUTO_INCREMENT_OFFSET2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - if ($USE_REPLICATION) - { - save_master_pos; - --connection slave1_1 - sync_with_master; - --connection master_1 - --disable_query_log - SET SESSION sql_log_bin= 0; - --enable_query_log - } - --disable_warnings - DROP TABLE IF EXISTS t1, t2; - --enable_warnings - --disable_query_log - echo CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1; - echo CREATE TABLE t2 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1; - echo MASTER_1_AUTO_INCREMENT_INCREMENT2; - echo MASTER_1_AUTO_INCREMENT_OFFSET2; - eval CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1; - eval CREATE TABLE t2 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1; - eval $MASTER_1_AUTO_INCREMENT_INCREMENT2; - eval $MASTER_1_AUTO_INCREMENT_OFFSET2; - if ($USE_REPLICATION) - { - SET SESSION sql_log_bin= 1; - --connection slave1_1 - --disable_warnings - DROP TABLE IF EXISTS t1, t2; - --enable_warnings - echo CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1; - echo CREATE TABLE t2 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1; - eval CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1; - eval CREATE TABLE t2 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1; - --connection master_1 - } - --enable_query_log - INSERT INTO t1 () VALUES (); - SELECT LAST_INSERT_ID(); - SELECT MAX(id) FROM t1; - INSERT INTO t2 () VALUES (); - SELECT LAST_INSERT_ID(); - SELECT MAX(id) FROM t2; - --disable_query_log - echo MASTER_1_AUTO_INCREMENT_OFFSET3; - eval $MASTER_1_AUTO_INCREMENT_OFFSET3; - --enable_query_log - INSERT INTO t1 (id) VALUES (null); - SELECT LAST_INSERT_ID(); - SELECT MAX(id) FROM t1; - --disable_query_log - echo MASTER_1_AUTO_INCREMENT_OFFSET4; - eval $MASTER_1_AUTO_INCREMENT_OFFSET4; - --enable_query_log - INSERT INTO t2 (id) VALUES (null); - SELECT LAST_INSERT_ID(); - SELECT MAX(id) FROM t2; - --disable_query_log - echo MASTER_1_AUTO_INCREMENT_OFFSET3; - eval $MASTER_1_AUTO_INCREMENT_OFFSET3; - --enable_query_log - INSERT INTO t1 () VALUES (),(),(),(); - SELECT LAST_INSERT_ID(); - SELECT id FROM t1 ORDER BY id; - --disable_query_log - echo MASTER_1_AUTO_INCREMENT_OFFSET4; - eval $MASTER_1_AUTO_INCREMENT_OFFSET4; - --enable_query_log - INSERT INTO t2 () VALUES (),(),(),(); - SELECT LAST_INSERT_ID(); - SELECT id FROM t2 ORDER BY id; - TRUNCATE TABLE t1; - TRUNCATE TABLE t2; - INSERT INTO t1 () VALUES (),(),(),(); - SELECT LAST_INSERT_ID(); - SELECT id FROM t1 ORDER BY id; - INSERT INTO t2 () VALUES (),(),(),(); - SELECT LAST_INSERT_ID(); - SELECT id FROM t2 ORDER BY id; - SET INSERT_ID=5000; - --disable_query_log - echo MASTER_1_AUTO_INCREMENT_OFFSET3; - eval $MASTER_1_AUTO_INCREMENT_OFFSET3; - --enable_query_log - INSERT INTO t1 () VALUES (); - SELECT LAST_INSERT_ID(); - SELECT MAX(id) FROM t1; - --disable_query_log - echo MASTER_1_AUTO_INCREMENT_OFFSET4; - eval $MASTER_1_AUTO_INCREMENT_OFFSET4; - --enable_query_log - INSERT INTO t2 () VALUES (); - SELECT LAST_INSERT_ID(); - SELECT MAX(id) FROM t2; - INSERT INTO t1 (id) VALUES (10000); - SELECT LAST_INSERT_ID(); - SELECT MAX(id) FROM t1; - INSERT INTO t2 (id) VALUES (1000); - SELECT LAST_INSERT_ID(); - SELECT MAX(id) FROM t2; - if ($USE_REPLICATION) - { - save_master_pos; - --connection slave1_1 - sync_with_master; - SELECT id FROM t1 ORDER BY id; - --connection master_1 - --disable_query_log - SET SESSION sql_log_bin= 0; - --enable_query_log - } - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_INCREMENT_TABLES1; - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_AUTO_INCREMENT_INCREMENT1; - echo CHILD2_1_AUTO_INCREMENT_OFFSET1; - } - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET1; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - } - eval $CHILD2_2_SELECT_INCREMENT_TABLES1; - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_AUTO_INCREMENT_INCREMENT1; - echo CHILD2_2_AUTO_INCREMENT_OFFSET1; - } - eval $CHILD2_2_AUTO_INCREMENT_INCREMENT1; - eval $CHILD2_2_AUTO_INCREMENT_OFFSET1; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } -} - - ---echo ---echo deinit ---disable_warnings ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -if ($USE_REPLICATION) -{ - --connection slave1_1 - DROP DATABASE IF EXISTS auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; -} ---disable_query_log ---disable_result_log ---source slave_test_deinit.inc ---source test_deinit.inc ---enable_result_log ---enable_query_log ---enable_warnings ---echo ---echo end of test diff --git a/storage/spider/mysql-test/spider/oracle/t/spider_fixes.test b/storage/spider/mysql-test/spider/oracle/t/spider_fixes.test deleted file mode 100644 index cfca9a04e6b..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/spider_fixes.test +++ /dev/null @@ -1,1425 +0,0 @@ -# This test tests for Spider's bug fixes -source include/have_log_bin.inc; ---disable_warnings ---disable_query_log ---disable_result_log ---source test_init.inc ---source slave_test_init.inc ---enable_result_log ---enable_query_log - ---echo ---echo drop and create databases ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -if ($USE_REPLICATION) -{ - --connection slave1_1 - DROP DATABASE IF EXISTS auto_test_local; - CREATE DATABASE auto_test_local; - USE auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - CREATE DATABASE auto_test_remote; - USE auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - CREATE DATABASE auto_test_remote2; - USE auto_test_remote2; -} ---enable_warnings - ---echo ---echo test select 1 ---connection master_1 -SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - SELECT 1; - --connection child2_2 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo create table and insert -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS tb_l; ---enable_warnings ---disable_query_log -echo CREATE TABLE tb_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) MASTER_1_ENGINE2 MASTER_1_CHARSET2; -eval CREATE TABLE tb_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; ---enable_query_log -INSERT INTO tb_l (a, b, c) VALUES - (1, 'a', '2008-08-01 10:21:39'), - (2, 'b', '2000-01-01 00:00:00'), - (3, 'e', '2007-06-04 20:03:11'), - (4, 'd', '2003-11-30 05:01:03'), - (5, 'c', '2001-12-31 23:59:59'); ---disable_warnings -DROP TABLE IF EXISTS ta_l; ---enable_warnings ---disable_query_log -echo CREATE TABLE ta_l ( - PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; ---enable_query_log -INSERT INTO ta_l SELECT a, b, c FROM tb_l; - ---echo ---echo 2.13 ---echo select table with "order by desc" and "<" -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_ps2_protocol -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -WHERE a < 5 ORDER BY a DESC LIMIT 3; ---enable_ps2_protocol -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select table with "order by desc" and "<=" -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_ps2_protocol -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -WHERE a <= 5 ORDER BY a DESC LIMIT 3; ---enable_ps2_protocol -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo 2.14 ---echo update table with range scan and split_read -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -UPDATE ta_l SET c = '2000-02-02 00:00:00' WHERE a > 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo 2.15 ---echo select table with range scan -TRUNCATE TABLE ta_l; ---disable_warnings -DROP TABLE IF EXISTS ta_l; ---enable_warnings -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES6; - echo CHILD2_1_CREATE_TABLES6; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES6; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES6; - --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_result_log - } -} ---connection master_1 ---disable_query_log -echo CREATE TABLE ta_l ( - a int(11) NOT NULL DEFAULT '0', - b char(1) DEFAULT NULL, - c datetime DEFAULT NULL, - PRIMARY KEY (a, b, c) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1; -eval CREATE TABLE ta_l ( - a int(11) NOT NULL DEFAULT '0', - b char(1) DEFAULT NULL, - c datetime DEFAULT NULL, - PRIMARY KEY (a, b, c) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1; ---enable_query_log -INSERT INTO ta_l SELECT a, b, c FROM tb_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b' -AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b' -AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a >= 4 AND b = 'd' -AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a > 4 AND b = 'c' -AND c = '2001-12-31 23:59:59'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b <= 'd' -AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b < 'e' -AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND b = 'b' -AND c = '2000-01-01 00:00:00'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND b = 'b' -AND c = '2000-01-01 00:00:00'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b' -AND b <= 'd' AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b' -AND b < 'e' AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND a >= 1 -AND b >= 'b' AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND a > 1 -AND b >= 'b' AND c = '2000-01-01 00:00:00'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo 2.16 ---echo auto_increment insert with trigger -if ($HAVE_TRIGGER) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_result_log - } - --disable_query_log - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_1_DROP_TABLES4; - echo CHILD2_1_CREATE_TABLES4; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES4; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES4; - --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_result_log - } - } - --connection master_1 - --disable_query_log - echo CREATE TABLE ta_l_auto_inc ( - a INT AUTO_INCREMENT, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1; - eval CREATE TABLE ta_l_auto_inc ( - a INT AUTO_INCREMENT, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1; - echo CREATE TABLE tc_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) MASTER_1_ENGINE2 MASTER_1_CHARSET2; - eval CREATE TABLE tc_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; - --enable_query_log - --eval CREATE TRIGGER ins_ta_l_auto_inc AFTER INSERT ON ta_l_auto_inc FOR EACH ROW BEGIN INSERT INTO tc_l (a, b, c) VALUES (NEW.a, NEW.b, NEW.c); END; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - INSERT INTO ta_l_auto_inc (a, b, c) VALUES - (NULL, 's', '2008-12-31 20:59:59'); - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_TABLES4; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM tc_l ORDER BY a; -} - ---echo ---echo 2.17 ---echo engine-condition-pushdown with "or" and joining -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l WHERE a = 1 OR a IN (SELECT a FROM tb_l); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo 2.23 ---echo index merge -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_result_log - } - --disable_query_log - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_1_DROP_TABLES5; - echo CHILD2_1_CREATE_TABLES5; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES5; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES5; - --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_result_log - } -} ---connection master_1 ---disable_query_log -echo CREATE TABLE ta_l_int ( - a INT AUTO_INCREMENT, - b INT DEFAULT 10, - c INT DEFAULT 11, - PRIMARY KEY(a), - KEY idx1(b), - KEY idx2(c) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1; -eval CREATE TABLE ta_l_int ( - a INT AUTO_INCREMENT, - b INT DEFAULT 10, - c INT DEFAULT 11, - PRIMARY KEY(a), - KEY idx1(b), - KEY idx2(c) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; ---enable_query_log -INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3); -INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int; -INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int; -INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int; -INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2) -WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo 2.24 ---echo index scan update without PK ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS ta_l_int; ---enable_warnings ---disable_query_log -echo CREATE TABLE ta_l_int ( - a INT NOT NULL, - b INT DEFAULT 10, - c INT DEFAULT 11, - KEY idx1(b), - KEY idx2(c) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1; -if ($MASTER_1_NEEDPK) -{ - --error ER_REQUIRES_PRIMARY_KEY - eval CREATE TABLE ta_l_int ( - a INT NOT NULL, - b INT DEFAULT 10, - c INT DEFAULT 11, - KEY idx1(b), - KEY idx2(c) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; - eval CREATE TABLE ta_l_int ( - a INT NOT NULL, - b INT DEFAULT 10, - c INT DEFAULT 11, - PRIMARY KEY(a), - KEY idx1(b), - KEY idx2(c) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; -} -if (!$MASTER_1_NEEDPK) -{ - eval CREATE TABLE ta_l_int ( - a INT NOT NULL, - b INT DEFAULT 10, - c INT DEFAULT 11, - KEY idx1(b), - KEY idx2(c) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; -} ---enable_query_log -SELECT a, b, c FROM ta_l_int ORDER BY a; -INSERT INTO ta_l_int (a, b, c) VALUES (0, 2, 3); -INSERT INTO ta_l_int (a, b, c) VALUES (18, 2, 3); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -UPDATE ta_l_int SET c = 4 WHERE b = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE '%update %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, c FROM ta_l_int ORDER BY a; - - ---echo ---echo 2.25 ---echo direct order limit ---connection master_1 -eval $MASTER_1_CHECK_DIRECT_ORDER_LIMIT_STATUS; ---disable_ps2_protocol -SELECT a, b, c FROM ta_l_int ORDER BY a LIMIT 3; ---enable_ps2_protocol -eval $MASTER_1_CHECK_DIRECT_ORDER_LIMIT_STATUS; - - ---echo ---echo 2.26 ---echo lock tables -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_LOCK_TABLES1; - echo CHILD2_1_DROP_LOCK_TABLES2; - echo CHILD2_1_CREATE_LOCK_TABLES1; - echo CHILD2_1_CREATE_LOCK_TABLES2; - } - --disable_warnings - eval $CHILD2_1_DROP_LOCK_TABLES1; - eval $CHILD2_1_DROP_LOCK_TABLES2; - --enable_warnings - eval $CHILD2_1_CREATE_LOCK_TABLES1; - eval $CHILD2_1_CREATE_LOCK_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_LOCK_TABLES1; - echo CHILD2_2_DROP_LOCK_TABLES2; - echo CHILD2_2_CREATE_LOCK_TABLES1; - echo CHILD2_2_CREATE_LOCK_TABLES2; - } - --disable_warnings - eval $CHILD2_2_DROP_LOCK_TABLES1; - eval $CHILD2_2_DROP_LOCK_TABLES2; - --enable_warnings - eval $CHILD2_2_CREATE_LOCK_TABLES1; - eval $CHILD2_2_CREATE_LOCK_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS t1; -DROP TABLE IF EXISTS t2; ---enable_warnings ---disable_query_log -echo CREATE TABLE t1 ( - id int(11) NOT NULL, - PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK1; -eval CREATE TABLE t1 ( - id int(11) NOT NULL, - PRIMARY KEY (id) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_LOCK1; -echo CREATE TABLE t2 ( - id int(11) NOT NULL, - PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK2; -eval CREATE TABLE t2 ( - id int(11) NOT NULL, - PRIMARY KEY (id) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_LOCK2; ---enable_query_log -LOCK TABLES t1 READ, t2 READ; -UNLOCK TABLES; - - ---echo ---echo auto_increment -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_INCREMENT_TABLES1; - echo CHILD2_1_CREATE_INCREMENT_TABLES1; - echo CHILD2_1_AUTO_INCREMENT_INCREMENT2; - echo CHILD2_1_AUTO_INCREMENT_OFFSET2; - } - --disable_warnings - eval $CHILD2_1_DROP_INCREMENT_TABLES1; - --enable_warnings - eval $CHILD2_1_CREATE_INCREMENT_TABLES1; - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -if ($USE_REPLICATION) -{ - save_master_pos; - --connection slave1_1 - sync_with_master; - --connection master_1 - --disable_query_log - SET SESSION sql_log_bin= 0; - --enable_query_log -} ---disable_warnings -DROP TABLE IF EXISTS t1; ---enable_warnings ---disable_query_log -echo CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1; -echo MASTER_1_AUTO_INCREMENT_INCREMENT2; -echo MASTER_1_AUTO_INCREMENT_OFFSET2; -eval CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1; -eval $MASTER_1_AUTO_INCREMENT_INCREMENT2; -eval $MASTER_1_AUTO_INCREMENT_OFFSET2; -if ($USE_REPLICATION) -{ - SET SESSION sql_log_bin= 1; - --connection slave1_1 - --disable_warnings - DROP TABLE IF EXISTS t1; - --enable_warnings - echo CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1; - eval CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1; - --connection master_1 -} ---enable_query_log -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -SELECT MAX(id) FROM t1; -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -SELECT MAX(id) FROM t1; -INSERT INTO t1 (id) VALUES (null); -SELECT LAST_INSERT_ID(); -SELECT MAX(id) FROM t1; -INSERT INTO t1 (id) VALUES (null); -SELECT LAST_INSERT_ID(); -SELECT MAX(id) FROM t1; -INSERT INTO t1 () VALUES (),(),(),(); -SELECT LAST_INSERT_ID(); -SELECT id FROM t1 ORDER BY id; -SET INSERT_ID=5000; -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -SELECT MAX(id) FROM t1; -INSERT INTO t1 (id) VALUES (10000); -SELECT LAST_INSERT_ID(); -SELECT MAX(id) FROM t1; -INSERT INTO t1 (id) VALUES (1000); -SELECT LAST_INSERT_ID(); -SELECT MAX(id) FROM t1; -if ($USE_REPLICATION) -{ - save_master_pos; - --connection slave1_1 - sync_with_master; - SELECT id FROM t1 ORDER BY id; - --connection master_1 - --disable_query_log - SET SESSION sql_log_bin= 0; - --enable_query_log -} -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_INCREMENT_TABLES1; - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_AUTO_INCREMENT_INCREMENT1; - echo CHILD2_1_AUTO_INCREMENT_OFFSET1; - } - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET1; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - - ---echo ---echo read only -let $MASTER_1_ENGINE_IS_SPIDER= - `SELECT IF('$MASTER_1_ENGINE_TYPE' = 'Spider' OR - '$MASTER_1_HIDDEN_ENGINE_TYPE' = 'Spider', 1, 0)`; -if ($MASTER_1_ENGINE_IS_SPIDER) -{ - --connection master_1 - --disable_warnings - DROP TABLE IF EXISTS t1; - --enable_warnings - --disable_query_log - echo CREATE TABLE t1 ( - id int(11) NOT NULL, - PRIMARY KEY (id) - ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_READONLY1_1; - eval CREATE TABLE t1 ( - id int(11) NOT NULL, - PRIMARY KEY (id) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_READONLY1_1; - --let $MIN_VAL= `SELECT MIN(id) FROM t1` - --enable_query_log - SELECT id FROM t1 ORDER BY id; - --error 12518 - INSERT INTO t1 (id) VALUES (1); - --error 12518 - eval UPDATE t1 SET id = 4 WHERE id = $MIN_VAL; - --error 12518 - eval DELETE FROM t1 WHERE id = $MIN_VAL; - --error 12518 - DELETE FROM t1; - --error 12518 - TRUNCATE t1; -} -if (!$MASTER_1_ENGINE_IS_SPIDER) -{ - --echo skipped -} - - ---echo ---echo 2.27 ---echo error mode -if ($MASTER_1_ENGINE_IS_SPIDER) -{ - --connection master_1 - --disable_warnings - DROP TABLE IF EXISTS t1; - --enable_warnings - --disable_query_log - echo CREATE TABLE t1 ( - id int(11) NOT NULL, - PRIMARY KEY (id) - ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_ERROR_MODE1_1; - eval CREATE TABLE t1 ( - id int(11) NOT NULL, - PRIMARY KEY (id) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_ERROR_MODE1_1; - --enable_query_log - SELECT id FROM t1 ORDER BY id; - INSERT INTO t1 (id) VALUES (1); - DELETE FROM t1; - TRUNCATE t1; -} -if (!$MASTER_1_ENGINE_IS_SPIDER) -{ - --echo skipped -} - - ---echo ---echo 3.0 ---echo is null -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_result_log - } - --disable_query_log - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_1_DROP_TEXT_KEY_TABLES1; - echo CHILD2_1_CREATE_TEXT_KEY_TABLES1; - } - --disable_warnings - eval $CHILD2_1_DROP_TEXT_KEY_TABLES1; - --enable_warnings - eval $CHILD2_1_CREATE_TEXT_KEY_TABLES1; - --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_result_log - } -} ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS t1; ---enable_warnings ---disable_query_log -echo CREATE TABLE t1 ( - a VARCHAR(255), - b VARCHAR(255), - c VARCHAR(255), - KEY idx1(a,b), - KEY idx2(b), - PRIMARY KEY(c) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_TEXT_KEY1_1; -eval CREATE TABLE t1 ( - a VARCHAR(255), - b VARCHAR(255), - c VARCHAR(255), - KEY idx1(a,b), - KEY idx2(b), - PRIMARY KEY(c) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_TEXT_KEY1_1; ---enable_query_log -insert into t1 values (null, null, '2048'); -insert into t1 values ('1', '1', '1'); -insert into t1 select a + 1, b + 1, c + 1 from t1; -insert into t1 select a + 2, b + 2, c + 2 from t1; -insert into t1 select a + 4, b + 4, c + 4 from t1; -insert into t1 select a + 8, b + 8, c + 8 from t1; -insert into t1 select a + 16, b + 16, c + 16 from t1; -insert into t1 select a + 32, b + 32, c + 32 from t1; -insert into t1 select a + 64, b + 64, c + 64 from t1; -insert into t1 select a + 128, b + 128, c + 128 from t1; -insert into t1 select a + 256, b + 256, c + 256 from t1; -insert into t1 select a + 512, b + 512, c + 512 from t1; -flush tables; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -select a from t1 where a is null order by a limit 30; -select b from t1 where b is null order by b limit 30; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TEXT_PK_TABLES1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - - ---echo ---echo direct_order_limit ---connection master_1 -TRUNCATE TABLE t1; -insert into t1 values ('1', '1', '1'); -insert into t1 select a + 1, b + 1, c + 1 from t1; -insert into t1 select a + 2, b + 2, c + 2 from t1; -insert into t1 select a + 4, b + 4, c + 4 from t1; -insert into t1 select a + 8, b + 8, c + 8 from t1; -insert into t1 select a + 16, b + 16, c + 16 from t1; -insert into t1 select a, b + 32, c + 32 from t1; -insert into t1 select a, b + 64, c + 64 from t1; -insert into t1 select a, b + 128, c + 128 from t1; -flush tables; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -select a, b, c from t1 where a = '10' and b <> '100' order by c desc limit 5; -select a, c from t1 where a = '10' order by b desc limit 5; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TEXT_PK_TABLES1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - - ---echo ---echo deinit ---disable_warnings ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -if ($USE_REPLICATION) -{ - --connection slave1_1 - DROP DATABASE IF EXISTS auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; -} ---disable_query_log ---disable_result_log ---source slave_test_deinit.inc ---source test_deinit.inc ---enable_result_log ---enable_query_log ---enable_warnings ---echo ---echo end of test diff --git a/storage/spider/mysql-test/spider/oracle/t/spider_fixes_part.test b/storage/spider/mysql-test/spider/oracle/t/spider_fixes_part.test deleted file mode 100644 index ef5a8026c02..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/spider_fixes_part.test +++ /dev/null @@ -1,645 +0,0 @@ -# This test tests for Spider's bug fixes -source include/have_log_bin.inc; ---disable_warnings ---disable_query_log ---disable_result_log ---source test_init.inc ---source slave_test_init.inc ---enable_result_log ---enable_query_log -if (!$HAVE_PARTITION) -{ - --disable_query_log - --disable_result_log - --source slave_test_deinit.inc - --source test_deinit.inc - --enable_result_log - --enable_query_log - --enable_warnings - skip Test requires partitioning; -} - ---echo ---echo drop and create databases ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -if ($USE_REPLICATION) -{ - --connection slave1_1 - DROP DATABASE IF EXISTS auto_test_local; - CREATE DATABASE auto_test_local; - USE auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - CREATE DATABASE auto_test_remote; - USE auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - CREATE DATABASE auto_test_remote2; - USE auto_test_remote2; -} ---enable_warnings - ---echo ---echo test select 1 ---connection master_1 -SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - SELECT 1; - --connection child2_2 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS tb_l; ---enable_warnings ---disable_query_log -echo CREATE TABLE tb_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) MASTER_1_ENGINE2 MASTER_1_CHARSET2; -eval CREATE TABLE tb_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; ---enable_query_log -INSERT INTO tb_l (a, b, c) VALUES - (1, 'a', '2008-08-01 10:21:39'), - (2, 'b', '2000-01-01 00:00:00'), - (3, 'e', '2007-06-04 20:03:11'), - (4, 'd', '2003-11-30 05:01:03'), - (5, 'c', '2001-12-31 23:59:59'); - ---echo ---echo 2.17 ---echo partition with sort -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_2_DROP_TABLES; - --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES2; - echo CHILD2_1_CREATE_TABLES2; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES2; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - --disable_query_log - echo CREATE TABLE ta_l2 ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1; - eval CREATE TABLE ta_l2 ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1; - --enable_query_log - INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 WHERE a > 1 - ORDER BY a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } -} - ---echo ---echo 2.23 ---echo partition update with moving partition -if ($HAVE_PARTITION) -{ - --connection master_1 - --disable_warnings - DROP TABLE IF EXISTS ta_l2; - --enable_warnings - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_2_DROP_TABLES; - --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES2; - echo CHILD2_1_CREATE_TABLES2; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES2; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - --disable_query_log - echo CREATE TABLE ta_l2 ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1; - eval CREATE TABLE ta_l2 ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1; - --enable_query_log - INSERT INTO ta_l2 (a, b, c) VALUES (3, 'B', '2010-09-26 00:00:00'); - UPDATE ta_l2 SET a = 4 WHERE a = 3; - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE '%update %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE '%delete %'; - } - eval $CHILD2_2_SELECT_TABLES; - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE '%update %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE '%delete %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } -} - ---echo index merge with partition -if ($HAVE_PARTITION) -{ - --connection master_1 - --disable_warnings - DROP TABLE IF EXISTS ta_l_int; - --enable_warnings - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_result_log - } - --disable_query_log - --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_2_DROP_TABLES5; - echo CHILD2_2_CREATE_TABLES5; - } - --disable_warnings - eval $CHILD2_2_DROP_TABLES5; - --enable_warnings - eval $CHILD2_2_CREATE_TABLES5; - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_1_DROP_TABLES5; - echo CHILD2_1_CREATE_TABLES5; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES5; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES5; - --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_result_log - } - } - --connection master_1 - --disable_query_log - echo CREATE TABLE ta_l_int ( - a INT AUTO_INCREMENT, - b INT DEFAULT 10, - c INT DEFAULT 11, - PRIMARY KEY(a), - KEY idx1(b), - KEY idx2(c) - ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_P_2_1; - eval CREATE TABLE ta_l_int ( - a INT AUTO_INCREMENT, - b INT DEFAULT 10, - c INT DEFAULT 11, - PRIMARY KEY(a), - KEY idx1(b), - KEY idx2(c) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_P_2_1; - --enable_query_log - INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3); - INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int; - INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int; - INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int; - INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2) - WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } -} - - ---echo ---echo 2.26 ---echo auto_increment with partition -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_INCREMENT_TABLES1; - echo CHILD2_1_CREATE_INCREMENT_TABLES1; - echo CHILD2_1_AUTO_INCREMENT_INCREMENT2; - echo CHILD2_1_AUTO_INCREMENT_OFFSET2; - } - --disable_warnings - eval $CHILD2_1_DROP_INCREMENT_TABLES1; - --enable_warnings - eval $CHILD2_1_CREATE_INCREMENT_TABLES1; - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_INCREMENT_TABLES1; - echo CHILD2_2_CREATE_INCREMENT_TABLES1; - echo CHILD2_2_AUTO_INCREMENT_INCREMENT2; - echo CHILD2_2_AUTO_INCREMENT_OFFSET2; - } - --disable_warnings - eval $CHILD2_2_DROP_INCREMENT_TABLES1; - --enable_warnings - eval $CHILD2_2_CREATE_INCREMENT_TABLES1; - eval $CHILD2_2_AUTO_INCREMENT_INCREMENT2; - eval $CHILD2_2_AUTO_INCREMENT_OFFSET2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - if ($USE_REPLICATION) - { - save_master_pos; - --connection slave1_1 - sync_with_master; - --connection master_1 - --disable_query_log - SET SESSION sql_log_bin= 0; - --enable_query_log - } - --disable_warnings - DROP TABLE IF EXISTS t1; - --enable_warnings - --disable_query_log - echo CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1; - echo MASTER_1_AUTO_INCREMENT_INCREMENT2; - echo MASTER_1_AUTO_INCREMENT_OFFSET2; - eval CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1; - eval $MASTER_1_AUTO_INCREMENT_INCREMENT2; - eval $MASTER_1_AUTO_INCREMENT_OFFSET2; - if ($USE_REPLICATION) - { - SET SESSION sql_log_bin= 1; - --connection slave1_1 - --disable_warnings - DROP TABLE IF EXISTS t1; - --enable_warnings - echo CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1; - eval CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1; - --connection master_1 - } - --enable_query_log - INSERT INTO t1 () VALUES (); - SELECT LAST_INSERT_ID(); - SELECT MAX(id) FROM t1; - INSERT INTO t1 () VALUES (); - SELECT LAST_INSERT_ID(); - SELECT MAX(id) FROM t1; - INSERT INTO t1 (id) VALUES (null); - SELECT LAST_INSERT_ID(); - SELECT MAX(id) FROM t1; - INSERT INTO t1 (id) VALUES (null); - SELECT LAST_INSERT_ID(); - SELECT MAX(id) FROM t1; - INSERT INTO t1 () VALUES (),(),(),(); - SELECT LAST_INSERT_ID(); - SELECT id FROM t1 ORDER BY id; - SET INSERT_ID=5000; - INSERT INTO t1 () VALUES (); - SELECT LAST_INSERT_ID(); - SELECT MAX(id) FROM t1; - INSERT INTO t1 (id) VALUES (10000); - SELECT LAST_INSERT_ID(); - SELECT MAX(id) FROM t1; - INSERT INTO t1 (id) VALUES (1000); - SELECT LAST_INSERT_ID(); - SELECT MAX(id) FROM t1; - if ($USE_REPLICATION) - { - save_master_pos; - --connection slave1_1 - sync_with_master; - SELECT id FROM t1 ORDER BY id; - --connection master_1 - --disable_query_log - SET SESSION sql_log_bin= 0; - --enable_query_log - } - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_INCREMENT_TABLES1; - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_AUTO_INCREMENT_INCREMENT1; - echo CHILD2_1_AUTO_INCREMENT_OFFSET1; - } - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET1; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - } - eval $CHILD2_2_SELECT_INCREMENT_TABLES1; - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_AUTO_INCREMENT_INCREMENT1; - echo CHILD2_2_AUTO_INCREMENT_OFFSET1; - } - eval $CHILD2_2_AUTO_INCREMENT_INCREMENT1; - eval $CHILD2_2_AUTO_INCREMENT_OFFSET1; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } -} - - ---echo ---echo deinit ---disable_warnings ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -if ($USE_REPLICATION) -{ - --connection slave1_1 - DROP DATABASE IF EXISTS auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; -} ---disable_query_log ---disable_result_log ---source slave_test_deinit.inc ---source test_deinit.inc ---enable_result_log ---enable_query_log ---enable_warnings ---echo ---echo end of test diff --git a/storage/spider/mysql-test/spider/oracle/t/test_deinit.inc b/storage/spider/mysql-test/spider/oracle/t/test_deinit.inc deleted file mode 100644 index 989bde26d3c..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/test_deinit.inc +++ /dev/null @@ -1,37 +0,0 @@ -# get connection and exist engine test ---echo for master_1 ---connection master_1 ---source ../include/deinit_master_1.inc ---disconnect master_1 ---echo for child2 -if ($USE_CHILD_GROUP2) -{ - --echo child2_1 - --connection child2_1 - --source ../include/deinit_child2_1.inc - --disconnect child2_1 - --echo child2_2 - --connection child2_2 - --source ../include/deinit_child2_2.inc - --disconnect child2_2 - --echo child2_3 - --connection child2_3 - --source ../include/deinit_child2_3.inc - --disconnect child2_3 -} ---echo for child3 -if ($USE_CHILD_GROUP3) -{ - --echo child3_1 - --connection child3_1 - --source ../include/deinit_child3_1.inc - --disconnect child3_1 - --echo child3_2 - --connection child3_2 - --source ../include/deinit_child3_2.inc - --disconnect child3_2 - --echo child3_3 - --connection child3_3 - --source ../include/deinit_child3_3.inc - --disconnect child3_3 -} diff --git a/storage/spider/mysql-test/spider/oracle/t/test_init.inc b/storage/spider/mysql-test/spider/oracle/t/test_init.inc deleted file mode 100644 index f2cd6c0269f..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/test_init.inc +++ /dev/null @@ -1,74 +0,0 @@ -# get connection and exist engine test ---echo for master_1 ---source connect_master_1.inc ---connection master_1 -CALL mtr.add_suppression("unknown variable"); -SET SESSION sql_log_bin= 0; ---let $MASTER_1_SERVER_ID=`SELECT @@global.server_id` ---let $TEST_ENGINE_TYPE= $MASTER_1_ENGINE_TYPE ---source have_partition.inc ---source have_trigger.inc ---source ../include/init_master_1.inc ---source have_engine.inc ---echo for child2 -if ($USE_CHILD_GROUP2) -{ - --echo child2_1 - --source connect_child2_1.inc - --connection child2_1 - CALL mtr.add_suppression("unknown variable *"); - SET SESSION sql_log_bin= 0; - --let $CHILD2_1_SERVER_ID=`SELECT @@global.server_id` - --let $TEST_ENGINE_TYPE= $CHILD2_1_ENGINE_TYPE - --source ../include/init_child2_1.inc - --source have_engine.inc - --echo child2_2 - --source connect_child2_2.inc - --connection child2_2 - CALL mtr.add_suppression("unknown variable *"); - SET SESSION sql_log_bin= 0; - --let $CHILD2_2_SERVER_ID=`SELECT @@global.server_id` - --let $TEST_ENGINE_TYPE= $CHILD2_2_ENGINE_TYPE - --source ../include/init_child2_2.inc - --source have_engine.inc - --echo child2_3 - --source connect_child2_3.inc - --connection child2_3 - CALL mtr.add_suppression("unknown variable *"); - SET SESSION sql_log_bin= 0; - --let $CHILD2_3_SERVER_ID=`SELECT @@global.server_id` - --let $TEST_ENGINE_TYPE= $CHILD2_3_ENGINE_TYPE - --source ../include/init_child2_3.inc - --source have_engine.inc -} ---echo for child3 -if ($USE_CHILD_GROUP3) -{ - --echo child3_1 - --source connect_child3_1.inc - --connection child3_1 - CALL mtr.add_suppression("unknown variable *"); - SET SESSION sql_log_bin= 0; - --let $CHILD3_1_SERVER_ID=`SELECT @@global.server_id` - --let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE - --source ../include/init_child3_1.inc - --source have_engine.inc - --echo child3_2 - --source connect_child3_2.inc - --connection child3_2 - CALL mtr.add_suppression("unknown variable *"); - SET SESSION sql_log_bin= 0; - --let $CHILD3_2_SERVER_ID=`SELECT @@global.server_id` - --let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE - --source ../include/init_child3_2.inc - --source have_engine.inc - --echo child3_3 - --source connect_child3_3.inc - --connection child3_3 - CALL mtr.add_suppression("unknown variable *"); - SET SESSION sql_log_bin= 0; - --let $CHILD3_3_SERVER_ID=`SELECT @@global.server_id` - --let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE - --source ../include/init_child3_3.inc - --source have_engine.inc -} diff --git a/storage/spider/mysql-test/spider/oracle/t/vp_fixes.test b/storage/spider/mysql-test/spider/oracle/t/vp_fixes.test deleted file mode 100644 index 90380227040..00000000000 --- a/storage/spider/mysql-test/spider/oracle/t/vp_fixes.test +++ /dev/null @@ -1,335 +0,0 @@ -# This test tests for VP's bug fixes ---disable_warnings ---disable_query_log ---disable_result_log ---source test_init.inc ---enable_result_log ---enable_query_log - ---echo ---echo drop and create databases ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - CREATE DATABASE auto_test_remote; - USE auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - CREATE DATABASE auto_test_remote2; - USE auto_test_remote2; -} ---enable_warnings - ---echo ---echo test select 1 ---connection master_1 -SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - SELECT 1; - --connection child2_2 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo create table and insert -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS tb_l; ---enable_warnings ---disable_query_log -echo CREATE TABLE tb_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) MASTER_1_ENGINE2 MASTER_1_CHARSET2; -eval CREATE TABLE tb_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; ---enable_query_log -INSERT INTO tb_l (a, b, c) VALUES - (1, 'a', '2008-08-01 10:21:39'), - (2, 'b', '2000-01-01 00:00:00'), - (3, 'e', '2007-06-04 20:03:11'), - (4, 'd', '2003-11-30 05:01:03'), - (5, 'c', '2001-12-31 23:59:59'); ---disable_warnings -DROP TABLE IF EXISTS ta_l; ---enable_warnings ---disable_query_log -echo CREATE TABLE ta_l ( - PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; ---enable_query_log -INSERT INTO ta_l SELECT a, b, c FROM tb_l; - ---echo ---echo 0.9 ---echo create different primary key table -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_result_log - } - --disable_query_log - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_1_DROP_TABLES5; - echo CHILD2_1_CREATE_TABLES5; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES5; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES5; - --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_result_log - } -} ---connection master_1 ---disable_query_log -echo CREATE TABLE ta_l_int ( - a INT DEFAULT 10, - b INT AUTO_INCREMENT, - c INT DEFAULT 11, - PRIMARY KEY(b) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1; -eval CREATE TABLE ta_l_int ( - a INT DEFAULT 10, - b INT AUTO_INCREMENT, - c INT DEFAULT 11, - PRIMARY KEY(b) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; ---enable_query_log -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---let $MASTER_1_IS_VP= `SELECT IF('$MASTER_1_ENGINE_TYPE' = 'VP', 1, 0)` -if ($MASTER_1_IS_VP) -{ - --error 14514 - INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); -} -if (!$MASTER_1_IS_VP) -{ - INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); - --disable_query_log - --disable_result_log - TRUNCATE TABLE ta_l_int; - --enable_query_log - --enable_result_log -} -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_TABLES5; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo create un-correspond primary key table ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS ta_l_int; ---enable_warnings -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_result_log - } - --disable_query_log - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_1_DROP_TABLES5; - echo CHILD2_1_CREATE_TABLES5; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES5; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES5; - --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_result_log - } -} ---connection master_1 ---disable_query_log -echo CREATE TABLE ta_l_int ( - a INT DEFAULT 10, - b INT DEFAULT 12, - c INT DEFAULT 11, - PRIMARY KEY(c) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1; -eval CREATE TABLE ta_l_int ( - a INT DEFAULT 10, - b INT DEFAULT 12, - c INT DEFAULT 11, - PRIMARY KEY(c) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; ---enable_query_log -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -if ($MASTER_1_IS_VP) -{ - --error 14514 - INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); -} -if (!$MASTER_1_IS_VP) -{ - INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); - --disable_query_log - --disable_result_log - TRUNCATE TABLE ta_l_int; - --enable_query_log - --enable_result_log -} -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_TABLES5; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo deinit ---disable_warnings ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; -} ---disable_query_log ---disable_result_log ---source test_deinit.inc ---enable_result_log ---enable_query_log ---enable_warnings ---echo ---echo end of test diff --git a/storage/spider/mysql-test/spider/oracle2/include/deinit_child2_1.inc b/storage/spider/mysql-test/spider/oracle2/include/deinit_child2_1.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/oracle2/include/deinit_child2_2.inc b/storage/spider/mysql-test/spider/oracle2/include/deinit_child2_2.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/oracle2/include/deinit_child2_3.inc b/storage/spider/mysql-test/spider/oracle2/include/deinit_child2_3.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/oracle2/include/deinit_child3_1.inc b/storage/spider/mysql-test/spider/oracle2/include/deinit_child3_1.inc deleted file mode 100644 index 74c8efa90aa..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/include/deinit_child3_1.inc +++ /dev/null @@ -1,3 +0,0 @@ ---let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE ---let $INIT_TEST_ENGINE= $INIT_CHILD3_1_ENGINE ---source ../../include/deinit_engine.inc diff --git a/storage/spider/mysql-test/spider/oracle2/include/deinit_child3_2.inc b/storage/spider/mysql-test/spider/oracle2/include/deinit_child3_2.inc deleted file mode 100644 index f42a980ad23..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/include/deinit_child3_2.inc +++ /dev/null @@ -1,3 +0,0 @@ ---let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE ---let $INIT_TEST_ENGINE= $INIT_CHILD3_2_ENGINE ---source ../../include/deinit_engine.inc diff --git a/storage/spider/mysql-test/spider/oracle2/include/deinit_child3_3.inc b/storage/spider/mysql-test/spider/oracle2/include/deinit_child3_3.inc deleted file mode 100644 index 0696fb991cf..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/include/deinit_child3_3.inc +++ /dev/null @@ -1,3 +0,0 @@ ---let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE ---let $INIT_TEST_ENGINE= $INIT_CHILD3_3_ENGINE ---source ../../include/deinit_engine.inc diff --git a/storage/spider/mysql-test/spider/oracle2/include/deinit_master_1.inc b/storage/spider/mysql-test/spider/oracle2/include/deinit_master_1.inc deleted file mode 100644 index c19e376d10a..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/include/deinit_master_1.inc +++ /dev/null @@ -1 +0,0 @@ ---source ../../include/deinit_spider.inc diff --git a/storage/spider/mysql-test/spider/oracle2/include/deinit_slave1_1.inc b/storage/spider/mysql-test/spider/oracle2/include/deinit_slave1_1.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child2_1.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child2_1.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child2_2.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child2_2.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child2_3.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child2_3.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_1.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_1.inc deleted file mode 100644 index c19e376d10a..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_1.inc +++ /dev/null @@ -1 +0,0 @@ ---source ../../include/deinit_spider.inc diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_2.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_2.inc deleted file mode 100644 index c19e376d10a..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_2.inc +++ /dev/null @@ -1 +0,0 @@ ---source ../../include/deinit_spider.inc diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_3.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_3.inc deleted file mode 100644 index c19e376d10a..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_3.inc +++ /dev/null @@ -1 +0,0 @@ ---source ../../include/deinit_spider.inc diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_master_1.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_master_1.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_1.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_1.inc deleted file mode 100644 index 2684829408d..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_1.inc +++ /dev/null @@ -1,8 +0,0 @@ -let $CHILD2_1_HA_AS_DROP_TABLES= - $CHILD2_1_DROP_TABLES; -let $CHILD2_1_HA_AS_CREATE_TABLES= - $CHILD2_1_CREATE_TABLES; -let $CHILD2_1_HA_AS_DROP_TABLES2= - $CHILD2_1_DROP_TABLES2; -let $CHILD2_1_HA_AS_CREATE_TABLES2= - $CHILD2_1_CREATE_TABLES2; diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_2.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_2.inc deleted file mode 100644 index 205eaa6fe35..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_2.inc +++ /dev/null @@ -1,4 +0,0 @@ -let $CHILD2_2_HA_DROP_TABLES= - $CHILD2_2_DROP_TABLES; -let $CHILD2_2_HA_CREATE_TABLES= - $CHILD2_2_CREATE_TABLES; diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_3.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_3.inc deleted file mode 100644 index 55cb858372c..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_3.inc +++ /dev/null @@ -1,4 +0,0 @@ -let $CHILD2_3_HA_DROP_TABLES= - $CHILD2_3_DROP_TABLES; -let $CHILD2_3_HA_CREATE_TABLES= - $CHILD2_3_CREATE_TABLES; diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_1.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_1.inc deleted file mode 100644 index 8357f0bdbc2..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_1.inc +++ /dev/null @@ -1,140 +0,0 @@ ---let $CHILD3_1_ENGINE_TYPE=Spider ---let $CHILD3_1_ENGINE=ENGINE=Spider ---source ../include/init_spider.inc -eval INSERT INTO mysql.spider_link_mon_servers -(db_name, table_name, link_id, sid, server, scheme, host, port, socket, - username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key, - ssl_verify_server_cert, default_file, default_group) VALUES -('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), -('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), -('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL); -let $CHILD3_1_CHECK_LINK_STATUS= - SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables - ORDER BY db_name, table_name, link_id; -let $CHILD3_1_CHECK_LINK_FAILED_LOG= - SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; -let $CHILD3_1_SET_RECOVERY_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2", lst "0 2"'; -let $CHILD3_1_SET_OK_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2", lst "0 1"'; -let $CHILD3_1_SET_OK_STATUS_AS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2", lst "1 0"'; - -let $CHILD3_1_DROP_TABLES_HA_2_1= - DROP TABLE IF EXISTS ta_l; -if ($VERSION_COMPILE_OS_WIN) -{ - let $CHILD3_1_CREATE_TABLES_HA_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2"'; - let $CHILD3_1_CREATE_TABLES_HA_AS_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2"'; -} -if (!$VERSION_COMPILE_OS_WIN) -{ - let $CHILD3_1_CREATE_TABLES_HA_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2"'; - let $CHILD3_1_CREATE_TABLES_HA_AS_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2"'; -} -let $CHILD3_1_DROP_TABLES_HA_P_2_1= - DROP TABLE IF EXISTS ta_l2; -let $CHILD3_1_CREATE_TABLES_HA_P_2_1= - CREATE TABLE ta_l2 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $CHILD3_1_CREATE_TABLES_HA_AS_P_2_1= - CREATE TABLE ta_l2 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $CHILD3_1_SET_RECOVERY_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 2"' - ); -let $CHILD3_1_SET_OK_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 1"' - ); -let $CHILD3_1_SET_OK_STATUS_AS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "1 0"' - ); diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_2.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_2.inc deleted file mode 100644 index 3ffcec24f51..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_2.inc +++ /dev/null @@ -1,140 +0,0 @@ ---let $CHILD3_2_ENGINE_TYPE=Spider ---let $CHILD3_2_ENGINE=ENGINE=Spider ---source ../include/init_spider.inc -eval INSERT INTO mysql.spider_link_mon_servers -(db_name, table_name, link_id, sid, server, scheme, host, port, socket, - username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key, - ssl_verify_server_cert, default_file, default_group) VALUES -('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), -('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), -('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL); -let $CHILD3_2_CHECK_LINK_STATUS= - SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables - ORDER BY db_name, table_name, link_id; -let $CHILD3_2_CHECK_LINK_FAILED_LOG= - SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; -let $CHILD3_2_SET_RECOVERY_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2", lst "0 2"'; -let $CHILD3_2_SET_OK_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2", lst "0 1"'; -let $CHILD3_2_SET_OK_STATUS_AS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2", lst "1 0"'; - -let $CHILD3_2_DROP_TABLES_HA_2_1= - DROP TABLE IF EXISTS ta_l; -if ($VERSION_COMPILE_OS_WIN) -{ - let $CHILD3_2_CREATE_TABLES_HA_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2"'; - let $CHILD3_2_CREATE_TABLES_HA_AS_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2"'; -} -if (!$VERSION_COMPILE_OS_WIN) -{ - let $CHILD3_2_CREATE_TABLES_HA_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2"'; - let $CHILD3_2_CREATE_TABLES_HA_AS_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2"'; -} -let $CHILD3_2_DROP_TABLES_HA_P_2_1= - DROP TABLE IF EXISTS ta_l2; -let $CHILD3_2_CREATE_TABLES_HA_P_2_1= - CREATE TABLE ta_l2 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $CHILD3_2_CREATE_TABLES_HA_AS_P_2_1= - CREATE TABLE ta_l2 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $CHILD3_2_SET_RECOVERY_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 2"' - ); -let $CHILD3_2_SET_OK_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 1"' - ); -let $CHILD3_2_SET_OK_STATUS_AS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "1 0"' - ); diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_3.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_3.inc deleted file mode 100644 index 67bd00109f5..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_3.inc +++ /dev/null @@ -1,140 +0,0 @@ ---let $CHILD3_3_ENGINE_TYPE=Spider ---let $CHILD3_3_ENGINE=ENGINE=Spider ---source ../include/init_spider.inc -eval INSERT INTO mysql.spider_link_mon_servers -(db_name, table_name, link_id, sid, server, scheme, host, port, socket, - username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key, - ssl_verify_server_cert, default_file, default_group) VALUES -('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), -('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), -('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL); -let $CHILD3_3_CHECK_LINK_STATUS= - SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables - ORDER BY db_name, table_name, link_id; -let $CHILD3_3_CHECK_LINK_FAILED_LOG= - SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; -let $CHILD3_3_SET_RECOVERY_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2", lst "0 2"'; -let $CHILD3_3_SET_OK_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2", lst "0 1"'; -let $CHILD3_3_SET_OK_STATUS_AS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2", lst "1 0"'; - -let $CHILD3_3_DROP_TABLES_HA_2_1= - DROP TABLE IF EXISTS ta_l; -if ($VERSION_COMPILE_OS_WIN) -{ - let $CHILD3_3_CREATE_TABLES_HA_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2"'; - let $CHILD3_3_CREATE_TABLES_HA_AS_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2"'; -} -if (!$VERSION_COMPILE_OS_WIN) -{ - let $CHILD3_3_CREATE_TABLES_HA_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2"'; - let $CHILD3_3_CREATE_TABLES_HA_AS_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2"'; -} -let $CHILD3_3_DROP_TABLES_HA_P_2_1= - DROP TABLE IF EXISTS ta_l2; -let $CHILD3_3_CREATE_TABLES_HA_P_2_1= - CREATE TABLE ta_l2 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $CHILD3_3_CREATE_TABLES_HA_AS_P_2_1= - CREATE TABLE ta_l2 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $CHILD3_3_SET_RECOVERY_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 2"' - ); -let $CHILD3_3_SET_OK_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 1"' - ); -let $CHILD3_3_SET_OK_STATUS_AS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "1 0"' - ); diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_init_master_1.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_init_master_1.inc deleted file mode 100644 index 8ace39ab641..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/include/ha_init_master_1.inc +++ /dev/null @@ -1,109 +0,0 @@ -eval INSERT INTO mysql.spider_link_mon_servers -(db_name, table_name, link_id, sid, server, scheme, host, port, socket, - username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key, - ssl_verify_server_cert, default_file, default_group) VALUES -('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), -('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), -('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL); -let $MASTER_1_CHECK_LINK_STATUS= - SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables - ORDER BY db_name, table_name, link_id; -let $MASTER_1_CHECK_LINK_FAILED_LOG= - SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; -let $MASTER_1_SET_RECOVERY_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "$ORACLE_HOST", user "$ORACLE_USER", - password "$ORACLE_PASSWORD", msi "$CHILD3_1_SERVER_ID", mkd "2", - database "$ORACLE_DATABASE", lst "0 2"'; -let $MASTER_1_SET_OK_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "$ORACLE_HOST", user "$ORACLE_USER", - password "$ORACLE_PASSWORD", msi "$CHILD3_1_SERVER_ID", mkd "2", - database "$ORACLE_DATABASE", lst "0 1"'; -let $MASTER_1_SET_OK_STATUS_AS_2_1= - ALTER TABLE ta_l - CONNECTION='host "$ORACLE_HOST", user "$ORACLE_USER", - password "$ORACLE_PASSWORD", msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "$ORACLE_DATABASE", lst "1 0"'; -let $MASTER_1_COPY_TABLES_2_1= - SELECT spider_copy_tables('ta_l', '0', '1'); - -if ($VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT_HA_2_1= - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3", - wrapper "oracle"' - CONNECTION='host "$ORACLE_HOST", user "$ORACLE_USER", - password "$ORACLE_PASSWORD", msi "$CHILD3_1_SERVER_ID", mkd "2", - database "$ORACLE_DATABASE"'; - let $MASTER_1_COMMENT_HA_AS_2_1= - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3", - wrapper "oracle"' - CONNECTION='host "$ORACLE_HOST", user "$ORACLE_USER", - password "$ORACLE_PASSWORD", msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "$ORACLE_DATABASE"'; -} -if (!$VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT_HA_2_1= - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3", - wrapper "oracle"' - CONNECTION='host "$ORACLE_HOST", user "$ORACLE_USER", - password "$ORACLE_PASSWORD", msi "$CHILD3_1_SERVER_ID", mkd "2", - database "$ORACLE_DATABASE"'; - let $MASTER_1_COMMENT_HA_AS_2_1= - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3", - wrapper "oracle"' - CONNECTION='host "$ORACLE_HOST", user "$ORACLE_USER", - password "$ORACLE_PASSWORD", msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "$ORACLE_DATABASE"'; -} -let $MASTER_1_COMMENT_HA_P_2_1= - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $MASTER_1_COMMENT_HA_AS_P_2_1= - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $MASTER_1_SET_RECOVERY_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 2"' - ); -let $MASTER_1_SET_OK_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 1"' - ); -let $MASTER_1_SET_OK_STATUS_AS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "1 0"' - ); -let $MASTER_1_COPY_TABLES_P_2_1= - SELECT spider_copy_tables('ta_l2#P#pt2', '0', '1'); -let $MASTER_1_CHECK_HA_STATUS= - SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; -let $MASTER_1_CHANGE_HA_MON= - SELECT spider_flush_table_mon_cache(); diff --git a/storage/spider/mysql-test/spider/oracle2/include/hs_deinit_child2_1.inc b/storage/spider/mysql-test/spider/oracle2/include/hs_deinit_child2_1.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/oracle2/include/hs_deinit_child2_2.inc b/storage/spider/mysql-test/spider/oracle2/include/hs_deinit_child2_2.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/oracle2/include/hs_deinit_child2_3.inc b/storage/spider/mysql-test/spider/oracle2/include/hs_deinit_child2_3.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/oracle2/include/hs_deinit_master_1.inc b/storage/spider/mysql-test/spider/oracle2/include/hs_deinit_master_1.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_1.inc b/storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_1.inc deleted file mode 100644 index f3f92a61e6f..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_1.inc +++ /dev/null @@ -1,24 +0,0 @@ -let $CHILD2_1_HS_DROP_TABLES= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "hs_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_HS_CREATE_TABLES= - SELECT spider_direct_sql('CREATE TABLE "hs_r" ( - "a" INT DEFAULT 10, - "b" CHAR(1) DEFAULT \'c\', - "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), - "d" INT DEFAULT 11, - CONSTRAINT "pk_s_2_1_hs_r" PRIMARY KEY("a") - )', '', 'srv "s_2_1"'); -let $CHILD2_1_HS_SELECT_TABLES= - SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\'), "d" FROM "hs_r" ORDER BY "a"', '', 'srv "s_2_1"'); -let $CHILD2_1_HS_DROP_TABLES2= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "hs_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_HS_CREATE_TABLES2= - SELECT spider_direct_sql('CREATE TABLE "hs_r2" ( - "a" INT DEFAULT 10, - "b" CHAR(1) DEFAULT \'c\', - "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), - "d" INT DEFAULT 11, - CONSTRAINT "pk_s_2_1_hs_r2" PRIMARY KEY("a") - )', '', 'srv "s_2_1"'); -let $CHILD2_1_HS_SELECT_TABLES2= - SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\'), "d" FROM "hs_r2" ORDER BY "a"', '', 'srv "s_2_1"'); diff --git a/storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_2.inc b/storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_2.inc deleted file mode 100644 index 4bd8d49c17c..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_2.inc +++ /dev/null @@ -1,12 +0,0 @@ -let $CHILD2_2_HS_DROP_TABLES= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "hs_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"'); -let $CHILD2_2_HS_CREATE_TABLES= - SELECT spider_direct_sql('CREATE TABLE "hs_r3" ( - "a" INT DEFAULT 10, - "b" CHAR(1) DEFAULT \'c\', - "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), - "d" INT DEFAULT 11, - CONSTRAINT "pk_s_2_2_hs_r3" PRIMARY KEY("a") - )', '', 'srv "s_2_2"'); -let $CHILD2_2_HS_SELECT_TABLES= - SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\'), "d" FROM "hs_r3" ORDER BY "a"', '', 'srv "s_2_2"'); diff --git a/storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_3.inc b/storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_3.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/oracle2/include/hs_init_master_1.inc b/storage/spider/mysql-test/spider/oracle2/include/hs_init_master_1.inc deleted file mode 100644 index 0ff5e2a10d9..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/include/hs_init_master_1.inc +++ /dev/null @@ -1,12 +0,0 @@ -let $MASTER_1_HS_COMMENT_TMP= - COMMENT=''; -let $MASTER_1_HS_COMMENT_2_1= - COMMENT='srv "s_2_1", table "hs_r", uhr "1", uhw "1", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT"'; -let $MASTER_1_HS_COMMENT_P_2_1= - COMMENT='uhr "1", uhw "1"' - PARTITION BY RANGE(a) ( - PARTITION pt1 VALUES LESS THAN (4) - COMMENT='srv "s_2_1", table "hs_r2", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT"', - PARTITION pt2 VALUES LESS THAN MAXVALUE - COMMENT='srv "s_2_2", table "hs_r3", hrp "$CHILD2_2_HSRPORT", hwp "$CHILD2_2_HSWPORT"' - ); diff --git a/storage/spider/mysql-test/spider/oracle2/include/init_child2_1.inc b/storage/spider/mysql-test/spider/oracle2/include/init_child2_1.inc deleted file mode 100644 index c24736eefca..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/include/init_child2_1.inc +++ /dev/null @@ -1,192 +0,0 @@ ---connection master_1 -SELECT spider_direct_sql('ALTER SESSION SET NLS_DATE_FORMAT=\'YYYY-MM-DD HH24:MI:SS\'', '', 'srv "s_2_1"'); -SELECT spider_direct_sql('ALTER SESSION SET NLS_TIME_FORMAT=\'HH24:MI:SSXFF\'', '', 'srv "s_2_1"'); -SELECT spider_direct_sql('ALTER SESSION SET NLS_TIMESTAMP_FORMAT=\'YYYY-MM-DD HH24:MI:SSXFF\'', '', 'srv "s_2_1"'); -let $CHILD2_1_DROP_TABLES= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_CREATE_TABLES= - SELECT spider_direct_sql('CREATE TABLE "ta_r" ( - "a" INT DEFAULT 10, - "b" CHAR(1) DEFAULT \'c\', - "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), - CONSTRAINT "pk_s_2_1_ta_r" PRIMARY KEY("a") - )', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE INDEX "idx1" ON "ta_r"("b")', '', 'srv "s_2_1"'); -let $CHILD2_1_SELECT_TABLES= - SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r" ORDER BY "a"', '', 'srv "s_2_1"'); -let $CHILD2_1_DROP_TABLES2= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_CREATE_TABLES2= - SELECT spider_direct_sql('CREATE TABLE "ta_r2" ( - "a" INT DEFAULT 10, - "b" CHAR(1) DEFAULT \'c\', - "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), - CONSTRAINT "pk_s_2_1_ta_r2" PRIMARY KEY("a") - )', '', 'srv "s_2_1"'); -let $CHILD2_1_SELECT_TABLES2= - SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r2" ORDER BY "a"', '', 'srv "s_2_1"'); -let $CHILD2_1_DROP_TABLES3= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r_no_idx"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_CREATE_TABLES3= - SELECT spider_direct_sql('CREATE TABLE "ta_r_no_idx" ( - "a" INT DEFAULT 10, - "b" CHAR(1) DEFAULT \'c\', - "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\') - )', '', 'srv "s_2_1"'); -let $CHILD2_1_SELECT_TABLES3= - SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r_no_idx" ORDER BY "a"', '', 'srv "s_2_1"'); -let $CHILD2_1_DROP_TABLES4= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r_auto_inc"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_CREATE_TABLES4= - SELECT spider_direct_sql('CREATE TABLE "ta_r_auto_inc" ( - "a" INT DEFAULT 10, - "b" CHAR(1) DEFAULT \'c\', - "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), - CONSTRAINT "pk_s_2_1_ta_r_auto_inc" PRIMARY KEY("a") - )', '', 'srv "s_2_1"'); -let $CHILD2_1_SELECT_TABLES4= - SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r_auto_inc" - ORDER BY "a"', '', 'srv "s_2_1"'); -let $CHILD2_1_DROP_TABLES5= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "s_2_1_ta_r_int"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_CREATE_TABLES5= - SELECT spider_direct_sql('CREATE TABLE "s_2_1_ta_r_int" ( - "a" INT DEFAULT 3, - "b" INT DEFAULT 10, - "c" INT DEFAULT 11, - CONSTRAINT "pk_s_2_1_ta_r_int" PRIMARY KEY("a") - )', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE INDEX "idx1_s_2_1_ta_r_int" ON "s_2_1_ta_r_int"("b")', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE INDEX "idx2_s_2_1_ta_r_int" ON "s_2_1_ta_r_int"("c")', '', 'srv "s_2_1"'); -let $CHILD2_1_SELECT_TABLES5= - SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "s_2_1_ta_r_int" ORDER BY "a"', '', 'srv "s_2_1"'); -let $CHILD2_1_DROP_TABLES6= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r_3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_CREATE_TABLES6= - SELECT spider_direct_sql('CREATE TABLE "ta_r_3" ( - "a" INT DEFAULT 10, - "b" CHAR(1) DEFAULT \'c\', - "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\') - )', '', 'srv "s_2_1"'); -let $CHILD2_1_SELECT_TABLES6= - SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r_3" ORDER BY "a"', '', 'srv "s_2_1"'); -let $CHILD2_1_DROP_FT_TABLES= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ft_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_CREATE_FT_TABLES= - SELECT spider_direct_sql('CREATE TABLE "ft_r" ( - "a" INT DEFAULT 0, - "b" TEXT, - "c" TEXT, - "d" TEXT, - CONSTRAINT "pk_s_2_1_ft_r" PRIMARY KEY("a"), - FULLTEXT INDEX "ft_idx1"("b"), - FULLTEXT INDEX "ft_idx2"("c") - )', '', 'srv "s_2_1"'); -let $CHILD2_1_SELECT_FT_TABLES= - SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "ft_r" ORDER BY "a"', '', 'srv "s_2_1"'); -let $CHILD2_1_DROP_FT_TABLES2= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ft_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_CREATE_FT_TABLES2= - SELECT spider_direct_sql('CREATE TABLE "ft_r2" ( - "a" INT DEFAULT 0, - "b" TEXT, - "c" TEXT, - "d" TEXT, - CONSTRAINT "pk_s_2_1_ft_r2" PRIMARY KEY("a"), - FULLTEXT INDEX "ft_idx1"("b"), - FULLTEXT INDEX "ft_idx2"("c") - )', '', 'srv "s_2_1"'); -let $CHILD2_1_SELECT_FT_TABLES2= - SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "ft_r2" ORDER BY "a"', '', 'srv "s_2_1"'); -let $CHILD2_1_DROP_GM_TABLES= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "gm_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_CREATE_GM_TABLES= - SELECT spider_direct_sql('CREATE TABLE "gm_r" ( - "a" INT DEFAULT 0, - "b" GEOMETRY NOT NULL, - "c" GEOMETRY NOT NULL, - CONSTRAINT "pk_s_2_1_gm_r" PRIMARY KEY("a"), - SPATIAL INDEX "sp_idx1"("b"), - SPATIAL INDEX "sp_idx2"("c") - )', '', 'srv "s_2_1"'); -let $CHILD2_1_SELECT_GM_TABLES= - SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "gm_r" ORDER BY "a"', '', 'srv "s_2_1"'); -let $CHILD2_1_DROP_GM_TABLES2= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "gm_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_CREATE_GM_TABLES2= - SELECT spider_direct_sql('CREATE TABLE "gm_r2" ( - "a" INT DEFAULT 0, - "b" GEOMETRY NOT NULL, - "c" GEOMETRY NOT NULL, - CONSTRAINT "pk_s_2_1_gm_r2" PRIMARY KEY("a"), - SPATIAL INDEX "sp_idx1"("b"), - SPATIAL INDEX "sp_idx2"("c") - )', '', 'srv "s_2_1"'); -let $CHILD2_1_SELECT_GM_TABLES2= - SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "gm_r2" ORDER BY "a"', '', 'srv "s_2_1"'); -let $CHILD2_1_DROP_LOCK_TABLES1= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_CREATE_LOCK_TABLES1= - SELECT spider_direct_sql('CREATE TABLE "t1_1" ( - "id" INT NOT NULL, - CONSTRAINT "pk_s_2_1_t1_1" PRIMARY KEY ("id") - )', '', 'srv "s_2_1"'); -let $CHILD2_1_DROP_LOCK_TABLES2= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t2_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_CREATE_LOCK_TABLES2= - SELECT spider_direct_sql('CREATE TABLE "t2_2" ( - "id" INT NOT NULL, - CONSTRAINT "pk_s_2_1_t2_2" PRIMARY KEY ("id") - )', '', 'srv "s_2_1"'); -let $CHILD2_1_DROP_INCREMENT_TABLES1= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_CREATE_INCREMENT_TABLES1= - SELECT spider_direct_sql('CREATE TABLE "t1_1" ( - "id" INT NOT NULL, - CONSTRAINT "pk_s_2_1_t1_1" PRIMARY KEY ("id") - )', '', 'srv "s_2_1"'); -let $CHILD2_1_SELECT_INCREMENT_TABLES1= - SELECT spider_direct_sql('SELECT "id" FROM "t1_1" ORDER BY "id"', '', 'srv "s_2_1"'); -let $CHILD2_1_DROP_TEXT_PK_TABLES1= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_CREATE_TEXT_PK_TABLES1= - SELECT spider_direct_sql('CREATE TABLE "t1" ( - "a" VARCHAR(255), - CONSTRAINT "pk_s_2_1_t1" PRIMARY KEY ("a") - )', '', 'srv "s_2_1"'); -let $CHILD2_1_SELECT_TEXT_PK_TABLES1= - SELECT spider_direct_sql('SELECT "a" FROM "t1" ORDER BY "a"', '', 'srv "s_2_1"'); -let $CHILD2_1_DROP_TEXT_KEY_TABLES1= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); -let $CHILD2_1_CREATE_TEXT_KEY_TABLES1= - SELECT spider_direct_sql('CREATE TABLE "t1" ( - "a" VARCHAR(255), - "b" VARCHAR(255), - "c" VARCHAR(255), - CONSTRAINT "pk_s_2_1_t1" PRIMARY KEY ("c") - )', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE INDEX "idx1_t1" ON "t1"("a","b")', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE INDEX "idx2_t1" ON "t1"("b")', '', 'srv "s_2_1"'); -let $CHILD2_1_SELECT_TEXT_KEY_TABLES1= - SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "t1" ORDER BY "c"', '', 'srv "s_2_1"'); -let $CHILD2_1_AUTO_INCREMENT_INCREMENT1= - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_1"'); -let $CHILD2_1_AUTO_INCREMENT_INCREMENT2= - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"'); -let $CHILD2_1_AUTO_INCREMENT_OFFSET1= - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_1"'); -let $CHILD2_1_AUTO_INCREMENT_OFFSET2= - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"'); diff --git a/storage/spider/mysql-test/spider/oracle2/include/init_child2_2.inc b/storage/spider/mysql-test/spider/oracle2/include/init_child2_2.inc deleted file mode 100644 index fd4497c0b59..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/include/init_child2_2.inc +++ /dev/null @@ -1,94 +0,0 @@ ---connection master_1 -SELECT spider_direct_sql('ALTER SESSION SET NLS_DATE_FORMAT=\'YYYY-MM-DD HH24:MI:SS\'', '', 'srv "s_2_2"'); -SELECT spider_direct_sql('ALTER SESSION SET NLS_TIME_FORMAT=\'HH24:MI:SSXFF\'', '', 'srv "s_2_2"'); -SELECT spider_direct_sql('ALTER SESSION SET NLS_TIMESTAMP_FORMAT=\'YYYY-MM-DD HH24:MI:SSXFF\'', '', 'srv "s_2_2"'); -let $CHILD2_2_DROP_TABLES= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"'); -let $CHILD2_2_CREATE_TABLES= - SELECT spider_direct_sql('CREATE TABLE "ta_r3" ( - "a" INT DEFAULT 10, - "b" CHAR(1) DEFAULT \'c\', - "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), - CONSTRAINT "pk_s_2_2_ta_r3" PRIMARY KEY("a") - )', '', 'srv "s_2_2"'); -let $CHILD2_2_DROP_TABLES5= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "s_2_2_ta_r_int"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"'); -let $CHILD2_2_CREATE_TABLES5= - SELECT spider_direct_sql('CREATE TABLE "s_2_2_ta_r_int" ( - "a" INT DEFAULT 3, - "b" INT DEFAULT 10, - "c" INT DEFAULT 11, - CONSTRAINT "pk_s_2_2_ta_r_int" PRIMARY KEY("a") - )', '', 'srv "s_2_2"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE INDEX "idx1_s_2_2_ta_r_int" ON "s_2_2_ta_r_int"("b")', '', 'srv "s_2_2"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE INDEX "idx2_s_2_2_ta_r_int" ON "s_2_2_ta_r_int"("c")', '', 'srv "s_2_2"'); -let $CHILD2_2_SELECT_TABLES= - SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r3" ORDER BY "a"', '', 'srv "s_2_2"'); -let $CHILD2_2_DROP_FT_TABLES= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ft_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"'); -let $CHILD2_2_CREATE_FT_TABLES= - SELECT spider_direct_sql('CREATE TABLE "ft_r3" ( - "a" INT DEFAULT 0, - "b" TEXT, - "c" TEXT, - "d" TEXT, - CONSTRAINT "pk_s_2_2_ft_r3" PRIMARY KEY("a"), - FULLTEXT INDEX "ft_idx1"("b"), - FULLTEXT INDEX "ft_idx2"("c") - )', '', 'srv "s_2_2"'); -let $CHILD2_2_SELECT_FT_TABLES= - SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "ft_r3" ORDER BY "a"', '', 'srv "s_2_2"'); -let $CHILD2_2_DROP_GM_TABLES= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "gm_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"'); -let $CHILD2_2_CREATE_GM_TABLES= - SELECT spider_direct_sql('CREATE TABLE "gm_r3" ( - "a" INT DEFAULT 0, - "b" GEOMETRY NOT NULL, - "c" GEOMETRY NOT NULL, - CONSTRAINT "pk_s_2_2_gm_r3" PRIMARY KEY("a"), - SPATIAL INDEX "sp_idx1"("b"), - SPATIAL INDEX "sp_idx2"("c") - )', '', 'srv "s_2_2"'); -let $CHILD2_2_SELECT_GM_TABLES= - SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "gm_r3" ORDER BY "a"', '', 'srv "s_2_2"'); -let $CHILD2_2_DROP_LOCK_TABLES1= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"'); -let $CHILD2_2_CREATE_LOCK_TABLES1= - SELECT spider_direct_sql('CREATE TABLE "t1_2" ( - "id" INT NOT NULL, - CONSTRAINT "pk_s_2_2_t1_2" PRIMARY KEY ("id") - )', '', 'srv "s_2_2"'); -let $CHILD2_2_DROP_LOCK_TABLES2= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t2_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"'); -let $CHILD2_2_CREATE_LOCK_TABLES2= - SELECT spider_direct_sql('CREATE TABLE "t2_1" ( - "id" INT NOT NULL, - CONSTRAINT "pk_s_2_2_t2_1" PRIMARY KEY ("id") - )', '', 'srv "s_2_2"'); -let $CHILD2_2_DROP_INCREMENT_TABLES1= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"'); -let $CHILD2_2_CREATE_INCREMENT_TABLES1= - SELECT spider_direct_sql('CREATE TABLE "t1_2" ( - "id" INT NOT NULL, - CONSTRAINT "pk_s_2_2_t1_2" PRIMARY KEY ("id") - )', '', 'srv "s_2_2"'); -let $CHILD2_2_SELECT_INCREMENT_TABLES1= - SELECT spider_direct_sql('SELECT "id" FROM "t1_2" ORDER BY "id"', '', 'srv "s_2_2"'); -let $CHILD2_2_AUTO_INCREMENT_INCREMENT1= - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_2"'); -let $CHILD2_2_AUTO_INCREMENT_INCREMENT2= - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"'); -let $CHILD2_2_AUTO_INCREMENT_OFFSET1= - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_2"'); -let $CHILD2_2_AUTO_INCREMENT_OFFSET2= - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"'); diff --git a/storage/spider/mysql-test/spider/oracle2/include/init_child2_3.inc b/storage/spider/mysql-test/spider/oracle2/include/init_child2_3.inc deleted file mode 100644 index e16dfeffd81..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/include/init_child2_3.inc +++ /dev/null @@ -1,15 +0,0 @@ ---connection master_1 -SELECT spider_direct_sql('ALTER SESSION SET NLS_DATE_FORMAT=\'YYYY-MM-DD HH24:MI:SS\'', '', 'srv "s_2_3"'); -SELECT spider_direct_sql('ALTER SESSION SET NLS_TIME_FORMAT=\'HH24:MI:SSXFF\'', '', 'srv "s_2_3"'); -SELECT spider_direct_sql('ALTER SESSION SET NLS_TIMESTAMP_FORMAT=\'YYYY-MM-DD HH24:MI:SSXFF\'', '', 'srv "s_2_3"'); -let $CHILD2_3_DROP_TABLES= - SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r4"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_3"'); -let $CHILD2_3_CREATE_TABLES= - SELECT spider_direct_sql('CREATE TABLE "ta_r4" ( - "a" INT DEFAULT 10, - "b" CHAR(1) DEFAULT \'c\', - "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), - CONSTRAINT "pk_s_2_3_ta_r4" PRIMARY KEY("a") - )', '', 'srv "s_2_3"'); -let $CHILD2_3_SELECT_TABLES= - SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r4" ORDER BY "a"', '', 'srv "s_2_3"'); diff --git a/storage/spider/mysql-test/spider/oracle2/include/init_child3_1.inc b/storage/spider/mysql-test/spider/oracle2/include/init_child3_1.inc deleted file mode 100644 index d2d308cbefe..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/include/init_child3_1.inc +++ /dev/null @@ -1,3 +0,0 @@ ---let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE ---source ../../include/init_engine.inc ---let $INIT_CHILD3_1_ENGINE= $INIT_TEST_ENGINE diff --git a/storage/spider/mysql-test/spider/oracle2/include/init_child3_2.inc b/storage/spider/mysql-test/spider/oracle2/include/init_child3_2.inc deleted file mode 100644 index 3fbe1bd55bb..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/include/init_child3_2.inc +++ /dev/null @@ -1,3 +0,0 @@ ---let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE ---source ../../include/init_engine.inc ---let $INIT_CHILD3_2_ENGINE= $INIT_TEST_ENGINE diff --git a/storage/spider/mysql-test/spider/oracle2/include/init_child3_3.inc b/storage/spider/mysql-test/spider/oracle2/include/init_child3_3.inc deleted file mode 100644 index 3c7aaa8af84..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/include/init_child3_3.inc +++ /dev/null @@ -1,3 +0,0 @@ ---let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE ---source ../../include/init_engine.inc ---let $INIT_CHILD3_3_ENGINE= $INIT_TEST_ENGINE diff --git a/storage/spider/mysql-test/spider/oracle2/include/init_master_1.inc b/storage/spider/mysql-test/spider/oracle2/include/init_master_1.inc deleted file mode 100644 index 00c6f544992..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/include/init_master_1.inc +++ /dev/null @@ -1,150 +0,0 @@ ---source ../include/init_spider.inc -SET spider_direct_order_limit= 10000; -SET spider_init_sql_alloc_size= 1; -SET spider_conn_recycle_mode= 2; -let $MASTER_1_COMMENT_2_1= - COMMENT='database "$ORACLE_DATABASE", table "ta_r", wrapper "oracle", - pk_name "pk_s_2_1_ta_r"' - CONNECTION='host "$ORACLE_HOST", port "$ORACLE_PORT", user "$ORACLE_USER", - password "$ORACLE_PASSWORD"'; -let $MASTER_1_COMMENT2_2_1= - COMMENT='database "$ORACLE_DATABASE", table "ta_r_no_idx", wrapper "oracle", - pk_name "pk_s_2_1_ta_r_no_idx"' - CONNECTION='host "$ORACLE_HOST", port "$ORACLE_PORT", user "$ORACLE_USER", - password "$ORACLE_PASSWORD", prt "2000000"'; -let $MASTER_1_COMMENT_P_2_1= - COMMENT='table "ta_r3"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1", table "ta_r2", - priority "1000", pk_name "pk_s_2_1_ta_r2"', - PARTITION pt2 COMMENT='srv "s_2_2", priority "1000001", - pk_name "pk_s_2_2_ta_r3"' - ); -let $MASTER_1_COMMENT2_P_2_1= - COMMENT='table "ta_r3"' - PARTITION BY RANGE(a) ( - PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1", - table "ta_r2", priority "1000", pk_name "pk_s_2_1_ta_r2"', - PARTITION pt2 VALUES LESS THAN MAXVALUE - COMMENT='srv "s_2_2", priority "1000001", pk_name "pk_s_2_2_ta_r3"' - ); -let $MASTER_1_COMMENT3_2_1= - COMMENT='database "$ORACLE_DATABASE", table "ta_r_auto_inc", - wrapper "oracle"' - CONNECTION='host "$ORACLE_HOST", port "$ORACLE_PORT", user "$ORACLE_USER", - password "$ORACLE_PASSWORD", pk_name "pk_s_2_1_ta_r_auto_inc"'; -let $MASTER_1_COMMENT3_P_2_1= - COMMENT='table "s_2_1_ta_r_int"' - PARTITION BY LIST(MOD(a, 2)) ( - PARTITION pt1 VALUES IN (0) - COMMENT='srv "s_2_1", priority "1000", pk_name "pk_s_2_1_ta_r_int"', - PARTITION pt2 VALUES IN (1) - COMMENT='srv "s_2_2", priority "1000001", pk_name "pk_s_2_2_ta_r_int", - table "s_2_2_ta_r_int"' - ); -let $MASTER_1_COMMENT4_2_1= - COMMENT='database "$ORACLE_DATABASE", table "s_2_1_ta_r_int", - wrapper "oracle"' - CONNECTION='host "$ORACLE_HOST", port "$ORACLE_PORT", user "$ORACLE_USER", - password "$ORACLE_PASSWORD", pk_name "pk_s_2_1_ta_r_int"'; -let $MASTER_1_COMMENT5_2_1= - COMMENT='database "$ORACLE_DATABASE", table "ta_r_3", wrapper "oracle"' - CONNECTION='host "$ORACLE_HOST", port "$ORACLE_PORT", user "$ORACLE_USER", - password "$ORACLE_PASSWORD", pk_name "pk_s_2_1_ta_r_3"'; -let $MASTER_1_COMMENT_FT_2_1= - COMMENT='database "$ORACLE_DATABASE", table "ft_r", wrapper "oracle"' - CONNECTION='host "$ORACLE_HOST", port "$ORACLE_PORT", user "$ORACLE_USER", - password "$ORACLE_PASSWORD", pk_name "pk_s_2_1_ft_r"'; -let $MASTER_1_COMMENT2_FT_P_2_1= - COMMENT='table "ft_r3"' - PARTITION BY RANGE(a) ( - PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1", - table "ft_r2", priority "1000", pk_name "pk_s_2_1_ft_r2"', - PARTITION pt2 VALUES LESS THAN MAXVALUE - COMMENT='srv "s_2_2", priority "1000001", pk_name "pk_s_2_2_ft_r3"' - ); -let $MASTER_1_COMMENT_GM_2_1= - COMMENT='srv "s_2_1", table "gm_r", pk_name "pk_s_2_1_gm_r"'; -let $MASTER_1_COMMENT2_GM_P_2_1= - COMMENT='table "gm_r3"' - PARTITION BY RANGE(a) ( - PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1", - table "gm_r2", priority "1000", pk_name "pk_s_2_1_gm_r2"', - PARTITION pt2 VALUES LESS THAN MAXVALUE - COMMENT='srv "s_2_2", priority "1000001", pk_name "pk_s_2_2_gm_r3"' - ); -let $MASTER_1_COMMENT_LOCK1= - COMMENT 'tbl "t1_1 t1_2", srv "s_2_1 s_2_2", - pk_name "pk_s_2_1_t1_1 pk_s_2_2_t1_2"'; -let $MASTER_1_COMMENT_LOCK2= - COMMENT 'tbl "t2_1 t2_2", srv "s_2_2 s_2_1", - pk_name "pk_s_2_2_t2_1 pk_s_2_1_t2_2"'; -let $MASTER_1_COMMENT_INCREMENT1_1= - COMMENT 'aim "2", sqn "seq_t1_1", tbl "t1_1", srv "s_2_1", - pk_name "pk_s_2_1_t1_1"'; -let $MASTER_1_COMMENT_INCREMENT1_P_1= - COMMENT 'aim "2"' - PARTITION BY LIST(MOD(id, 2)) ( - PARTITION pt1 VALUES IN (0) - COMMENT='sqn "seq_t1_1", tbl "t1_1", srv "s_2_1", pk_name "pk_s_2_1_t1_1"', - PARTITION pt2 VALUES IN (1) - COMMENT='sqn "seq_t1_2", tbl "t1_2", srv "s_2_2", pk_name "pk_s_2_2_t1_2"' - ); -let $MASTER_1_COMMENT_READONLY1_1= - COMMENT 'read_only_mode "1", tbl "t1_1", srv "s_2_1", - pk_name "pk_s_2_1_t1_1"'; -let $MASTER_1_COMMENT_ERROR_MODE1_1= - COMMENT 'erm "1", ewm "1", tbl "ter1_1", srv "s_2_1", - pk_name "pk_s_2_1_ter1_1"'; -let $MASTER_1_COMMENT_TEXT_PK1_1= - COMMENT 'tbl "t1", srv "s_2_1", pk_name "pk_s_2_1_t1"'; -let $MASTER_1_COMMENT_TEXT_KEY1_1= - COMMENT 'tbl "t1", srv "s_2_1", pk_name "pk_s_2_1_t1"'; -let $MASTER_1_CHECK_DIRECT_UPDATE_STATUS= - SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; -let $MASTER_1_CHECK_DIRECT_DELETE_STATUS= - SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%'; -let $MASTER_1_CHECK_DIRECT_ORDER_LIMIT_STATUS= - SHOW GLOBAL STATUS LIKE 'Spider_direct_order_limit%'; -let $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS= - SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; -let $MASTER_1_AUTO_INCREMENT_INCREMENT1= - SET SESSION AUTO_INCREMENT_INCREMENT = 1 $STR_SEMICOLON - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_2"'); -let $MASTER_1_AUTO_INCREMENT_INCREMENT2= - SET SESSION AUTO_INCREMENT_INCREMENT = 777 $STR_SEMICOLON - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"'); -let $MASTER_1_AUTO_INCREMENT_OFFSET1= - SET SESSION AUTO_INCREMENT_OFFSET = 1 $STR_SEMICOLON - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_2"'); -let $MASTER_1_AUTO_INCREMENT_OFFSET2= - SET SESSION AUTO_INCREMENT_OFFSET = 777 $STR_SEMICOLON - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') - $STR_SEMICOLON - SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"') - $STR_SEMICOLON - SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"'); -let $MASTER_1_AUTO_INCREMENT_OFFSET3= - SET SESSION AUTO_INCREMENT_OFFSET = 1; -let $MASTER_1_AUTO_INCREMENT_OFFSET4= - SET SESSION AUTO_INCREMENT_OFFSET = 777; diff --git a/storage/spider/mysql-test/spider/oracle2/include/init_slave1_1.inc b/storage/spider/mysql-test/spider/oracle2/include/init_slave1_1.inc deleted file mode 100644 index 73c3c6b9ef2..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/include/init_slave1_1.inc +++ /dev/null @@ -1,10 +0,0 @@ -let $SLAVE1_1_COMMENT_INCREMENT1_1= - COMMENT ''; -let $SLAVE1_1_COMMENT_INCREMENT1_P_1= - COMMENT '' - PARTITION BY LIST(MOD(id, 2)) ( - PARTITION pt1 VALUES IN (0) - COMMENT='', - PARTITION pt2 VALUES IN (1) - COMMENT='' - ); diff --git a/storage/spider/mysql-test/spider/oracle2/include/init_spider.inc b/storage/spider/mysql-test/spider/oracle2/include/init_spider.inc deleted file mode 100644 index ff9ac9aee29..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/include/init_spider.inc +++ /dev/null @@ -1,105 +0,0 @@ ---source ../../include/init_spider.inc -let $VERSION_COMPILE_OS_WIN= - `SELECT IF(@@version_compile_os like 'Win%', 1, 0)`; -if ($VERSION_COMPILE_OS_WIN) -{ - eval DROP SERVER s_2_1; - eval CREATE SERVER s_2_1 FOREIGN DATA WRAPPER oracle OPTIONS ( - HOST '$ORACLE_HOST', - DATABASE '$ORACLE_DATABASE', - USER '$ORACLE_USER', - PASSWORD '$ORACLE_PASSWORD', - PORT $ORACLE_PORT - ); - eval DROP SERVER s_2_2; - eval CREATE SERVER s_2_2 FOREIGN DATA WRAPPER oracle OPTIONS ( - HOST '$ORACLE_HOST', - DATABASE '$ORACLE_DATABASE', - USER '$ORACLE_USER', - PASSWORD '$ORACLE_PASSWORD', - PORT $ORACLE_PORT - ); - eval DROP SERVER s_2_3; - eval CREATE SERVER s_2_3 FOREIGN DATA WRAPPER oracle OPTIONS ( - HOST '$ORACLE_HOST', - DATABASE '$ORACLE_DATABASE', - USER '$ORACLE_USER', - PASSWORD '$ORACLE_PASSWORD', - PORT $ORACLE_PORT - ); - eval DROP SERVER s_3_1; - eval CREATE SERVER s_3_1 FOREIGN DATA WRAPPER mysql OPTIONS ( - HOST 'localhost', - DATABASE 'auto_test_local', - USER 'root', - PASSWORD '', - PORT $CHILD3_1_MYPORT - ); - eval DROP SERVER s_3_2; - eval CREATE SERVER s_3_2 FOREIGN DATA WRAPPER mysql OPTIONS ( - HOST 'localhost', - DATABASE 'auto_test_local', - USER 'root', - PASSWORD '', - PORT $CHILD3_2_MYPORT - ); - eval DROP SERVER s_3_3; - eval CREATE SERVER s_3_3 FOREIGN DATA WRAPPER mysql OPTIONS ( - HOST 'localhost', - DATABASE 'auto_test_local', - USER 'root', - PASSWORD '', - PORT $CHILD2_3_MYPORT - ); -} -if (!$VERSION_COMPILE_OS_WIN) -{ - eval DROP SERVER s_2_1; - eval CREATE SERVER s_2_1 FOREIGN DATA WRAPPER oracle OPTIONS ( - HOST '$ORACLE_HOST', - DATABASE '$ORACLE_DATABASE', - USER '$ORACLE_USER', - PASSWORD '$ORACLE_PASSWORD', - PORT $ORACLE_PORT - ); - eval DROP SERVER s_2_2; - eval CREATE SERVER s_2_2 FOREIGN DATA WRAPPER oracle OPTIONS ( - HOST '$ORACLE_HOST', - DATABASE '$ORACLE_DATABASE', - USER '$ORACLE_USER', - PASSWORD '$ORACLE_PASSWORD', - PORT $ORACLE_PORT - ); - eval DROP SERVER s_2_3; - eval CREATE SERVER s_2_3 FOREIGN DATA WRAPPER oracle OPTIONS ( - HOST '$ORACLE_HOST', - DATABASE '$ORACLE_DATABASE', - USER '$ORACLE_USER', - PASSWORD '$ORACLE_PASSWORD', - PORT $ORACLE_PORT - ); - eval DROP SERVER s_3_1; - eval CREATE SERVER s_3_1 FOREIGN DATA WRAPPER mysql OPTIONS ( - HOST 'localhost', - DATABASE 'auto_test_local', - USER 'root', - PASSWORD '', - SOCKET '$CHILD3_1_MYSOCK' - ); - eval DROP SERVER s_3_2; - eval CREATE SERVER s_3_2 FOREIGN DATA WRAPPER mysql OPTIONS ( - HOST 'localhost', - DATABASE 'auto_test_local', - USER 'root', - PASSWORD '', - SOCKET '$CHILD3_2_MYSOCK' - ); - eval DROP SERVER s_3_3; - eval CREATE SERVER s_3_3 FOREIGN DATA WRAPPER mysql OPTIONS ( - HOST 'localhost', - DATABASE 'auto_test_local', - USER 'root', - PASSWORD '', - SOCKET '$CHILD3_3_MYSOCK' - ); -} diff --git a/storage/spider/mysql-test/spider/oracle2/my.cnf b/storage/spider/mysql-test/spider/oracle2/my.cnf deleted file mode 100644 index efa05c8e8b0..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/my.cnf +++ /dev/null @@ -1,146 +0,0 @@ -# Use default setting for mysqld processes -!include include/default_mysqld.cnf - -[mysqld.1.1] -log-bin= master-bin -loose_handlersocket_port= 20000 -loose_handlersocket_port_wr= 20001 -loose_handlersocket_threads= 2 -loose_handlersocket_threads_wr= 1 -loose_handlersocket_support_merge_table= 0 -loose_handlersocket_direct_update_mode= 2 -loose_handlersocket_unlimited_boundary= 65536 -loose_handlersocket_bulk_insert= 0 -loose_handlersocket_bulk_insert_timeout= 0 -loose_handlersocket_general_log= 1 -loose_handlersocket_timeout= 30 -loose_handlersocket_close_table_interval=2 -open_files_limit= 4096 -loose_partition= 1 - -[mysqld.3.1] -loose_partition= 1 - -[mysqld.3.2] -loose_partition= 1 - -[mysqld.3.3] -loose_partition= 1 - -[mysqld.4.1] -loose_partition= 1 - - -[ENV] -USE_GEOMETRY_TEST= 0 -USE_FULLTEXT_TEST= 0 -USE_HA_TEST= 1 -USE_GENERAL_LOG= 1 -USE_REPLICATION= 0 -MASTER_1_MYPORT= @mysqld.1.1.port -MASTER_1_HSRPORT= 20000 -MASTER_1_HSWPORT= 20001 -MASTER_1_MYSOCK= @mysqld.1.1.socket -MASTER_1_ENGINE_TYPE= Spider -#MASTER_1_ENGINE_TYPE= MyISAM -MASTER_1_ENGINE= ENGINE=Spider -MASTER_1_CHARSET= DEFAULT CHARSET=utf8 -MASTER_1_ENGINE2= ENGINE=MyISAM -MASTER_1_CHARSET2= DEFAULT CHARSET=utf8 -MASTER_1_CHARSET3= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci -SLAVE1_1_MYPORT= @mysqld.4.1.port -SLAVE1_1_MYSOCK= @mysqld.4.1.socket -SLAVE1_1_ENGINE_TYPE= MyISAM -SLAVE1_1_ENGINE= ENGINE=MyISAM -SLAVE1_1_CHARSET= DEFAULT CHARSET=utf8 -USE_CHILD_GROUP2= 1 -OUTPUT_CHILD_GROUP2= 0 -CHILD2_1_MYPORT= @mysqld.1.1.port -CHILD2_1_MYSOCK= @mysqld.1.1.socket -CHILD2_1_ENGINE_TYPE= InnoDB -CHILD2_1_ENGINE= ENGINE=InnoDB -CHILD2_1_CHARSET= DEFAULT CHARSET=utf8 -CHILD2_1_CHARSET2= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci -CHILD2_2_MYPORT= @mysqld.1.1.port -CHILD2_2_MYSOCK= @mysqld.1.1.socket -CHILD2_2_ENGINE_TYPE= InnoDB -CHILD2_2_ENGINE= ENGINE=InnoDB -CHILD2_2_CHARSET= DEFAULT CHARSET=utf8 -CHILD2_3_MYPORT= @mysqld.1.1.port -CHILD2_3_MYSOCK= @mysqld.1.1.socket -CHILD2_3_ENGINE_TYPE= InnoDB -CHILD2_3_ENGINE= ENGINE=InnoDB -CHILD2_3_CHARSET= DEFAULT CHARSET=utf8 -CHILD2_1_FT_MYPORT= @mysqld.1.1.port -CHILD2_1_FT_MYSOCK= @mysqld.1.1.socket -CHILD2_1_FT_ENGINE_TYPE= MyISAM -CHILD2_1_FT_ENGINE= ENGINE=MyISAM -CHILD2_1_FT_CHARSET= DEFAULT CHARSET=utf8 -CHILD2_2_FT_MYPORT= @mysqld.1.1.port -CHILD2_2_FT_MYSOCK= @mysqld.1.1.socket -CHILD2_2_FT_ENGINE_TYPE= MyISAM -CHILD2_2_FT_ENGINE= ENGINE=MyISAM -CHILD2_2_FT_CHARSET= DEFAULT CHARSET=utf8 -CHILD2_1_GM_MYPORT= @mysqld.1.1.port -CHILD2_1_GM_MYSOCK= @mysqld.1.1.socket -CHILD2_1_GM_ENGINE_TYPE= MyISAM -CHILD2_1_GM_ENGINE= ENGINE=MyISAM -CHILD2_1_GM_CHARSET= DEFAULT CHARSET=utf8 -CHILD2_2_GM_MYPORT= @mysqld.1.1.port -CHILD2_2_GM_MYSOCK= @mysqld.1.1.socket -CHILD2_2_GM_ENGINE_TYPE= MyISAM -CHILD2_2_GM_ENGINE= ENGINE=MyISAM -CHILD2_2_GM_CHARSET= DEFAULT CHARSET=utf8 -USE_CHILD_GROUP3= 1 -OUTPUT_CHILD_GROUP3= 0 -CHILD3_1_MYPORT= @mysqld.3.1.port -CHILD3_1_MYSOCK= @mysqld.3.1.socket -CHILD3_1_ENGINE_TYPE= InnoDB -CHILD3_1_ENGINE= ENGINE=InnoDB -CHILD3_1_CHARSET= DEFAULT CHARSET=utf8 -CHILD3_2_MYPORT= @mysqld.3.2.port -CHILD3_2_MYSOCK= @mysqld.3.2.socket -CHILD3_2_ENGINE_TYPE= InnoDB -CHILD3_2_ENGINE= ENGINE=InnoDB -CHILD3_2_CHARSET= DEFAULT CHARSET=utf8 -CHILD3_3_MYPORT= @mysqld.3.3.port -CHILD3_3_MYSOCK= @mysqld.3.3.socket -CHILD3_3_ENGINE_TYPE= InnoDB -CHILD3_3_ENGINE= ENGINE=InnoDB -CHILD3_3_CHARSET= DEFAULT CHARSET=utf8 -ORACLE_HOST= xe -ORACLE_PORT= 1521 -ORACLE_USER= system -ORACLE_PASSWORD= oracle -ORACLE_DATABASE= SYSTEM - -STR_SEMICOLON= ; - -#The followings are set in include/init_xxx.inc files -# MASTER_1_COMMENT_2_1 -# MASTER_1_COMMENT2_2_1 -# MASTER_1_COMMENT3_2_1 -# MASTER_1_COMMENT4_2_1 -# MASTER_1_COMMENT5_2_1 -# MASTER_1_COMMENT_P_2_1 -# CHILD2_1_DROP_TABLES -# CHILD2_1_CREATE_TABLES -# CHILD2_1_SELECT_TABLES -# CHILD2_1_DROP_TABLES2 -# CHILD2_1_CREATE_TABLES2 -# CHILD2_1_SELECT_TABLES2 -# CHILD2_1_DROP_TABLES3 -# CHILD2_1_CREATE_TABLES3 -# CHILD2_1_SELECT_TABLES3 -# CHILD2_1_DROP_TABLES4 -# CHILD2_1_CREATE_TABLES4 -# CHILD2_1_SELECT_TABLES4 -# CHILD2_1_DROP_TABLES5 -# CHILD2_1_CREATE_TABLES5 -# CHILD2_1_SELECT_TABLES5 -# CHILD2_1_DROP_TABLES6 -# CHILD2_1_CREATE_TABLES6 -# CHILD2_1_SELECT_TABLES6 -# CHILD2_2_DROP_TABLES -# CHILD2_2_CREATE_TABLES -# CHILD2_2_SELECT_TABLES diff --git a/storage/spider/mysql-test/spider/oracle2/r/basic_sql.result b/storage/spider/mysql-test/spider/oracle2/r/basic_sql.result deleted file mode 100644 index 1e9fe78acea..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/r/basic_sql.result +++ /dev/null @@ -1,634 +0,0 @@ -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -drop and create databases -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -CREATE DATABASE auto_test_remote; -USE auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -CREATE DATABASE auto_test_remote2; -USE auto_test_remote2; - -test select 1 -SELECT 1; -1 -1 - -create table select test -DROP TABLE IF EXISTS tb_l; -CREATE TABLE tb_l ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE2 MASTER_1_CHARSET2 -INSERT INTO tb_l (a, b, c) VALUES -(1, 'a', '2008-08-01 10:21:39'), -(2, 'b', '2000-01-01 00:00:00'), -(3, 'e', '2007-06-04 20:03:11'), -(4, 'd', '2003-11-30 05:01:03'), -(5, 'c', '2001-12-31 23:59:59'); -DROP TABLE IF EXISTS ta_l; -CREATE TABLE ta_l ( -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 -SELECT a, b, c FROM tb_l -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 - -create table ignore select test -DROP TABLE IF EXISTS ta_l; -DROP TABLE IF EXISTS tb_l; -CREATE TABLE tb_l ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE2 MASTER_1_CHARSET2 -INSERT INTO tb_l (a, b, c) VALUES -(1, 'f', '2008-07-01 10:21:39'), -(2, 'g', '2000-02-01 00:00:00'), -(3, 'j', '2007-05-04 20:03:11'), -(4, 'i', '2003-10-30 05:01:03'), -(5, 'h', '2001-10-31 23:59:59'); -CREATE TABLE ta_l ( -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 -IGNORE SELECT a, b, c FROM tb_l -Warnings: -Warning 1062 Duplicate entry '1' for key 'PRIMARY' -Warning 1062 Duplicate entry '2' for key 'PRIMARY' -Warning 1062 Duplicate entry '3' for key 'PRIMARY' -Warning 1062 Duplicate entry '4' for key 'PRIMARY' -Warning 1062 Duplicate entry '5' for key 'PRIMARY' -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 - -create table ignore select test -DROP TABLE IF EXISTS ta_l; -CREATE TABLE ta_l ( -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 -REPLACE SELECT a, b, c FROM tb_l -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -create no index table -DROP TABLE IF EXISTS ta_l_no_idx; -CREATE TABLE ta_l_no_idx -MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1 -SELECT a, b, c FROM tb_l -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l_no_idx ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -select table -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -select table shared mode -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a -LOCK IN SHARE MODE; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -select table for update -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a -FOR UPDATE; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -select table join -SELECT a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a, tb_l b -WHERE a.a = b.a ORDER BY a.a; -a b date_format(b.c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -select table straight_join -SELECT STRAIGHT_JOIN a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s') -FROM ta_l a, tb_l b WHERE a.a = b.a ORDER BY a.a; -a b date_format(b.c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -select sql_small_result -SELECT SQL_SMALL_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -select sql_big_result -SELECT SQL_BIG_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -select sql_buffer_result -SELECT SQL_BUFFER_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -select sql_cache -SELECT SQL_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -select sql_no_cache -SELECT SQL_NO_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -select sql_calc_found_rows -SELECT SQL_CALC_FOUND_ROWS a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a LIMIT 4; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -SELECT found_rows(); -found_rows() -5 - -select high_priority -SELECT HIGH_PRIORITY a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -select distinct -SELECT DISTINCT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -select count -SELECT count(*) FROM ta_l ORDER BY a; -count(*) -5 - -select table join not use index -SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM tb_l a WHERE -EXISTS (SELECT * FROM ta_l b WHERE b.b = a.b) ORDER BY a.a; -a b date_format(a.c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -select using pushdown -SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE -a.b = 'g' ORDER BY a.a; -a b date_format(a.c, '%Y-%m-%d %H:%i:%s') -2 g 2000-02-01 00:00:00 - -select using index and pushdown -SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE -a.a > 0 AND a.b = 'g' ORDER BY a.a; -a b date_format(a.c, '%Y-%m-%d %H:%i:%s') -2 g 2000-02-01 00:00:00 - -insert -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -2 e 2008-01-01 23:59:59 - -insert select -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -insert select a -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1), -'e', '2008-01-01 23:59:59'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 e 2008-01-01 23:59:59 - -insert low_priority -TRUNCATE TABLE ta_l; -INSERT LOW_PRIORITY INTO ta_l (a, b, c) values (2, 'e', '2008-01-01 23:59:59'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -2 e 2008-01-01 23:59:59 - -insert high_priority -TRUNCATE TABLE ta_l; -INSERT HIGH_PRIORITY INTO ta_l (a, b, c) VALUES (2, 'e', -'2008-01-01 23:59:59'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -2 e 2008-01-01 23:59:59 - -insert ignore -INSERT IGNORE INTO ta_l (a, b, c) VALUES (2, 'd', '2009-02-02 01:01:01'); -Warnings: -Warning 1062 Duplicate entry '2' for key 'PRIMARY' -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -2 e 2008-01-01 23:59:59 - -insert update (insert) -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE -KEY UPDATE b = 'f', c = '2005-08-08 11:11:11'; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -2 e 2008-01-01 23:59:59 - -insert update (update) -INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE -KEY UPDATE b = 'f', c = '2005-08-08 11:11:11'; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -2 f 2005-08-08 11:11:11 - -replace -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59'); -REPLACE INTO ta_l (a, b, c) VALUES (2, 'f', '2008-02-02 02:02:02'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -2 f 2008-02-02 02:02:02 - -replace select -REPLACE INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -replace select a -REPLACE INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1), -'e', '2008-01-01 23:59:59'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 e 2008-01-01 23:59:59 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -replace low_priority -REPLACE LOW_PRIORITY INTO ta_l (a, b, c) VALUES (3, 'g', -'2009-03-03 03:03:03'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 e 2008-01-01 23:59:59 -2 g 2000-02-01 00:00:00 -3 g 2009-03-03 03:03:03 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -update -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'); -UPDATE ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 e 2008-01-01 23:59:59 -2 f 2008-02-02 02:02:02 - -update select -UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a IN (SELECT a FROM -tb_l); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 g 2009-03-03 03:03:03 -2 g 2009-03-03 03:03:03 - -update select a -UPDATE ta_l SET b = 'h', c = '2010-04-04 04:04:04' WHERE a = (SELECT a FROM -tb_l ORDER BY a LIMIT 1); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 h 2010-04-04 04:04:04 -2 g 2009-03-03 03:03:03 - -update join -UPDATE ta_l a, tb_l b SET a.b = b.b, a.c = b.c WHERE a.a = b.a; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 - -update join a -UPDATE ta_l a, tb_l b SET a.b = 'g', a.c = '2009-03-03 03:03:03' WHERE -a.a = b.a; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 g 2009-03-03 03:03:03 -2 g 2009-03-03 03:03:03 - -update low_priority -UPDATE LOW_PRIORITY ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 g 2009-03-03 03:03:03 -2 f 2008-02-02 02:02:02 - -update ignore -UPDATE IGNORE ta_l SET a = 1, b = 'g', c = '2009-03-03 03:03:03' WHERE a = 2; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 g 2009-03-03 03:03:03 -2 f 2008-02-02 02:02:02 - -update pushdown -update ta_l set b = 'j', c = '2009-03-03 03:03:03' where b = 'f'; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 g 2009-03-03 03:03:03 -2 j 2009-03-03 03:03:03 - -update index pushdown -UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'j'; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 g 2009-03-03 03:03:03 -2 g 2009-03-03 03:03:03 - -delete -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -DELETE FROM ta_l WHERE a = 2; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 e 2008-01-01 23:59:59 -3 e 2008-01-01 23:59:59 -4 e 2008-01-01 23:59:59 -5 e 2008-01-01 23:59:59 -6 e 2008-01-01 23:59:59 -7 e 2008-01-01 23:59:59 -8 e 2008-01-01 23:59:59 -9 e 2008-01-01 23:59:59 -10 j 2008-01-01 23:59:59 - -delete all -DELETE FROM ta_l; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') - -delete select -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -DELETE FROM ta_l WHERE a IN (SELECT a FROM tb_l); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -6 e 2008-01-01 23:59:59 -7 e 2008-01-01 23:59:59 -8 e 2008-01-01 23:59:59 -9 e 2008-01-01 23:59:59 -10 j 2008-01-01 23:59:59 - -delete select a -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -DELETE FROM ta_l WHERE a = (SELECT a FROM tb_l ORDER BY a LIMIT 1); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -2 e 2008-01-01 23:59:59 -3 e 2008-01-01 23:59:59 -4 e 2008-01-01 23:59:59 -5 e 2008-01-01 23:59:59 -6 e 2008-01-01 23:59:59 -7 e 2008-01-01 23:59:59 -8 e 2008-01-01 23:59:59 -9 e 2008-01-01 23:59:59 -10 j 2008-01-01 23:59:59 - -delete join -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -DELETE a FROM ta_l a, (SELECT a FROM tb_l ORDER BY a) b WHERE a.a = b.a; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -6 e 2008-01-01 23:59:59 -7 e 2008-01-01 23:59:59 -8 e 2008-01-01 23:59:59 -9 e 2008-01-01 23:59:59 -10 j 2008-01-01 23:59:59 - -delete low_priority -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -DELETE LOW_PRIORITY FROM ta_l WHERE a = 2; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 e 2008-01-01 23:59:59 -3 e 2008-01-01 23:59:59 -4 e 2008-01-01 23:59:59 -5 e 2008-01-01 23:59:59 -6 e 2008-01-01 23:59:59 -7 e 2008-01-01 23:59:59 -8 e 2008-01-01 23:59:59 -9 e 2008-01-01 23:59:59 -10 j 2008-01-01 23:59:59 - -delete ignore -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -DELETE IGNORE FROM ta_l WHERE a = 2; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 e 2008-01-01 23:59:59 -3 e 2008-01-01 23:59:59 -4 e 2008-01-01 23:59:59 -5 e 2008-01-01 23:59:59 -6 e 2008-01-01 23:59:59 -7 e 2008-01-01 23:59:59 -8 e 2008-01-01 23:59:59 -9 e 2008-01-01 23:59:59 -10 j 2008-01-01 23:59:59 - -delete quick -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -DELETE QUICK FROM ta_l WHERE a = 2; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 e 2008-01-01 23:59:59 -3 e 2008-01-01 23:59:59 -4 e 2008-01-01 23:59:59 -5 e 2008-01-01 23:59:59 -6 e 2008-01-01 23:59:59 -7 e 2008-01-01 23:59:59 -8 e 2008-01-01 23:59:59 -9 e 2008-01-01 23:59:59 -10 j 2008-01-01 23:59:59 - -delete pushdown -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -DELETE FROM ta_l WHERE b = 'e'; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -10 j 2008-01-01 23:59:59 - -delete index pushdown -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -DELETE FROM ta_l WHERE a > 0 AND b = 'e'; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -10 j 2008-01-01 23:59:59 - -truncate -TRUNCATE TABLE ta_l; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') - -deinit -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -end of test diff --git a/storage/spider/mysql-test/spider/oracle2/r/basic_sql_part.result b/storage/spider/mysql-test/spider/oracle2/r/basic_sql_part.result deleted file mode 100644 index 9e1201c17c9..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/r/basic_sql_part.result +++ /dev/null @@ -1,121 +0,0 @@ -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -drop and create databases -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -CREATE DATABASE auto_test_remote; -USE auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -CREATE DATABASE auto_test_remote2; -USE auto_test_remote2; - -test select 1 -SELECT 1; -1 -1 -DROP TABLE IF EXISTS tb_l; -CREATE TABLE tb_l ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE2 MASTER_1_CHARSET2 -INSERT INTO tb_l (a, b, c) VALUES -(1, 'f', '2008-07-01 10:21:39'), -(2, 'g', '2000-02-01 00:00:00'), -(3, 'j', '2007-05-04 20:03:11'), -(4, 'i', '2003-10-30 05:01:03'), -(5, 'h', '2001-10-31 23:59:59'); - -create table with partition and select test -CREATE TABLE ta_l2 ( -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_COMMENT_P_2_1 -SELECT a, b, c FROM tb_l -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -select partition using pushdown -SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE -a.b = 'g' ORDER BY a.a; -a b date_format(a.c, '%Y-%m-%d %H:%i:%s') -2 g 2000-02-01 00:00:00 - -select partition using index pushdown -SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE -a.a > 0 AND a.b = 'g' ORDER BY a.a; -a b date_format(a.c, '%Y-%m-%d %H:%i:%s') -2 g 2000-02-01 00:00:00 - -update partition pushdown -UPDATE ta_l2 SET b = 'e', c = '2009-03-03 03:03:03' WHERE b = 'j'; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 e 2009-03-03 03:03:03 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -update partition index pushdown -UPDATE ta_l2 SET b = 'j', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'e'; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2009-03-03 03:03:03 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -delete partition pushdown -TRUNCATE TABLE ta_l2; -INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; -DELETE FROM ta_l2 WHERE b = 'g'; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -delete partition index pushdown -TRUNCATE TABLE ta_l2; -INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; -DELETE FROM ta_l2 WHERE a > 0 AND b = 'g'; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -5 h 2001-10-31 23:59:59 - -deinit -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -end of test diff --git a/storage/spider/mysql-test/spider/oracle2/r/direct_aggregate.result b/storage/spider/mysql-test/spider/oracle2/r/direct_aggregate.result deleted file mode 100644 index fe5752cff65..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/r/direct_aggregate.result +++ /dev/null @@ -1,91 +0,0 @@ -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -drop and create databases -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -CREATE DATABASE auto_test_remote; -USE auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -CREATE DATABASE auto_test_remote2; -USE auto_test_remote2; - -test select 1 -SELECT 1; -1 -1 - -create table select test -DROP TABLE IF EXISTS ta_l; -CREATE TABLE ta_l ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 -INSERT INTO ta_l (a, b, c) VALUES -(1, 'a', '2008-08-01 10:21:39'), -(2, 'b', '2000-01-01 00:00:00'), -(3, 'e', '2007-06-04 20:03:11'), -(4, 'd', '2003-11-30 05:01:03'), -(5, 'c', '2001-12-31 23:59:59'); - -direct_aggregating test -SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; -Variable_name Value -Spider_direct_aggregate 0 -SELECT COUNT(*) FROM ta_l; -COUNT(*) -5 -SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; -Variable_name Value -Spider_direct_aggregate 1 -SELECT MAX(a) FROM ta_l; -MAX(a) -5 -SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; -Variable_name Value -Spider_direct_aggregate 1 -SELECT MIN(a) FROM ta_l; -MIN(a) -1 -SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; -Variable_name Value -Spider_direct_aggregate 1 -SELECT MAX(a) FROM ta_l WHERE a < 5; -MAX(a) -4 -SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; -Variable_name Value -Spider_direct_aggregate 1 -SELECT MIN(a) FROM ta_l WHERE a > 1; -MIN(a) -2 -SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; -Variable_name Value -Spider_direct_aggregate 1 - -deinit -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -end of test diff --git a/storage/spider/mysql-test/spider/oracle2/r/direct_aggregate_part.result b/storage/spider/mysql-test/spider/oracle2/r/direct_aggregate_part.result deleted file mode 100644 index 9bde4a1746a..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/r/direct_aggregate_part.result +++ /dev/null @@ -1,82 +0,0 @@ -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -drop and create databases -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -CREATE DATABASE auto_test_remote; -USE auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -CREATE DATABASE auto_test_remote2; -USE auto_test_remote2; - -test select 1 -SELECT 1; -1 -1 - -with partition test -CREATE TABLE ta_l2 ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1 -SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; -Variable_name Value -Spider_direct_aggregate 0 -SELECT COUNT(*) FROM ta_l2; -COUNT(*) -5 -SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; -Variable_name Value -Spider_direct_aggregate 2 -SELECT MAX(a) FROM ta_l2; -MAX(a) -5 -SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; -Variable_name Value -Spider_direct_aggregate 2 -SELECT MIN(a) FROM ta_l2; -MIN(a) -1 -SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; -Variable_name Value -Spider_direct_aggregate 2 -SELECT MAX(a) FROM ta_l2 WHERE a < 5; -MAX(a) -4 -SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; -Variable_name Value -Spider_direct_aggregate 2 -SELECT MIN(a) FROM ta_l2 WHERE a > 1; -MIN(a) -2 -SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; -Variable_name Value -Spider_direct_aggregate 2 - -deinit -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -end of test diff --git a/storage/spider/mysql-test/spider/oracle2/r/direct_update.result b/storage/spider/mysql-test/spider/oracle2/r/direct_update.result deleted file mode 100644 index 3dc39d5f630..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/r/direct_update.result +++ /dev/null @@ -1,138 +0,0 @@ -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -drop and create databases -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -CREATE DATABASE auto_test_remote; -USE auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -CREATE DATABASE auto_test_remote2; -USE auto_test_remote2; - -test select 1 -SELECT 1; -1 -1 - -create table select test -DROP TABLE IF EXISTS ta_l; -CREATE TABLE ta_l ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 -INSERT INTO ta_l (a, b, c) VALUES -(1, 'a', '2008-08-01 10:21:39'), -(2, 'b', '2000-01-01 00:00:00'), -(3, 'e', '2007-06-04 20:03:11'), -(4, 'd', '2003-11-30 05:01:03'), -(5, 'c', '2001-12-31 23:59:59'); - -direct_updating test -SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 -update all rows with function -UPDATE ta_l SET c = ADDDATE(c, 1); -SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -2 b 2000-01-02 00:00:00 -3 e 2007-06-05 20:03:11 -4 d 2003-12-01 05:01:03 -5 c 2002-01-01 23:59:59 -update by primary key -UPDATE ta_l SET b = 'x' WHERE a = 3; -SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -2 b 2000-01-02 00:00:00 -3 x 2007-06-05 20:03:11 -4 d 2003-12-01 05:01:03 -5 c 2002-01-01 23:59:59 -update by a column without index -UPDATE ta_l SET c = '2011-10-17' WHERE b = 'x'; -SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -2 b 2000-01-02 00:00:00 -3 x 2011-10-17 00:00:00 -4 d 2003-12-01 05:01:03 -5 c 2002-01-01 23:59:59 -update by primary key with order and limit -UPDATE ta_l SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1; -SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -2 b 2000-01-02 00:00:00 -3 x 2011-10-18 00:00:00 -4 d 2003-12-01 05:01:03 -5 c 2002-01-01 23:59:59 -delete by primary key with order and limit -DELETE FROM ta_l WHERE a < 4 ORDER BY c LIMIT 1; -SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -3 x 2011-10-18 00:00:00 -4 d 2003-12-01 05:01:03 -5 c 2002-01-01 23:59:59 -delete by a column without index -DELETE FROM ta_l WHERE b = 'c'; -SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -3 x 2011-10-18 00:00:00 -4 d 2003-12-01 05:01:03 -delete by primary key -DELETE FROM ta_l WHERE a = 3; -SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -4 d 2003-12-01 05:01:03 - -deinit -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -end of test diff --git a/storage/spider/mysql-test/spider/oracle2/r/direct_update_part.result b/storage/spider/mysql-test/spider/oracle2/r/direct_update_part.result deleted file mode 100644 index 8a22c40a0da..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/r/direct_update_part.result +++ /dev/null @@ -1,129 +0,0 @@ -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -drop and create databases -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -CREATE DATABASE auto_test_remote; -USE auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -CREATE DATABASE auto_test_remote2; -USE auto_test_remote2; - -test select 1 -SELECT 1; -1 -1 - -with partition test -CREATE TABLE ta_l2 ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1 -SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 -update all rows with function -UPDATE ta_l2 SET c = ADDDATE(c, 1); -SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -2 b 2000-01-02 00:00:00 -3 e 2007-06-05 20:03:11 -4 d 2003-12-01 05:01:03 -5 c 2002-01-01 23:59:59 -update by primary key -UPDATE ta_l2 SET b = 'x' WHERE a = 3; -SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -2 b 2000-01-02 00:00:00 -3 x 2007-06-05 20:03:11 -4 d 2003-12-01 05:01:03 -5 c 2002-01-01 23:59:59 -update by a column without index -UPDATE ta_l2 SET c = '2011-10-17' WHERE b = 'x'; -SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -2 b 2000-01-02 00:00:00 -3 x 2011-10-17 00:00:00 -4 d 2003-12-01 05:01:03 -5 c 2002-01-01 23:59:59 -update by primary key with order and limit -UPDATE ta_l2 SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1; -SHOW GLOBAL STATUS LIKE 'Spider_direct_update%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -2 b 2000-01-02 00:00:00 -3 x 2011-10-18 00:00:00 -4 d 2003-12-01 05:01:03 -5 c 2002-01-01 23:59:59 -delete by primary key with order and limit -DELETE FROM ta_l2 WHERE a < 4 ORDER BY c LIMIT 1; -SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -3 x 2011-10-18 00:00:00 -4 d 2003-12-01 05:01:03 -5 c 2002-01-01 23:59:59 -delete by a column without index -DELETE FROM ta_l2 WHERE b = 'c'; -SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -3 x 2011-10-18 00:00:00 -4 d 2003-12-01 05:01:03 -delete by primary key -DELETE FROM ta_l2 WHERE a = 3; -SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%'; -Variable_name Value -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-02 10:21:39 -4 d 2003-12-01 05:01:03 - -deinit -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -end of test diff --git a/storage/spider/mysql-test/spider/oracle2/r/function.result b/storage/spider/mysql-test/spider/oracle2/r/function.result deleted file mode 100644 index 764c774514b..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/r/function.result +++ /dev/null @@ -1,149 +0,0 @@ -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -drop and create databases -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -CREATE DATABASE auto_test_remote; -USE auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -CREATE DATABASE auto_test_remote2; -USE auto_test_remote2; - -test select 1 -SELECT 1; -1 -1 - -in() -CREATE TABLE t1 ( -a VARCHAR(255), -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET3 MASTER_1_COMMENT_TEXT_PK1_1 -insert into t1 values ('1'); -insert into t1 select a + 1 from t1; -insert into t1 select a + 2 from t1; -insert into t1 select a + 4 from t1; -insert into t1 select a + 8 from t1; -insert into t1 select a + 16 from t1; -insert into t1 select a + 32 from t1; -insert into t1 select a + 64 from t1; -insert into t1 select a + 128 from t1; -insert into t1 select a + 256 from t1; -insert into t1 select a + 512 from t1; -flush tables; -select a from t1 where a in ('15', '120'); -a -120 -15 - -date_sub() -DROP TABLE IF EXISTS ta_l; -CREATE TABLE ta_l ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 -INSERT INTO ta_l (a, b, c) VALUES -(1, 'a', '2008-08-01 10:21:39'), -(2, 'b', '2000-01-01 00:00:00'), -(3, 'e', '2007-06-04 20:03:11'), -(4, 'd', '2003-11-30 05:01:03'), -(5, 'c', '2001-12-31 23:59:59'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 -UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 YEAR); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2007-08-01 10:21:39 -2 b 1999-01-01 00:00:00 -3 e 2006-06-04 20:03:11 -4 d 2002-11-30 05:01:03 -5 c 2000-12-31 23:59:59 -UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 QUARTER); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2007-11-01 10:21:39 -2 b 1999-04-01 00:00:00 -3 e 2006-09-04 20:03:11 -4 d 2003-02-28 05:01:03 -5 c 2001-03-31 23:59:59 -UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 MONTH); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2007-10-01 10:21:39 -2 b 1999-03-01 00:00:00 -3 e 2006-08-04 20:03:11 -4 d 2003-01-28 05:01:03 -5 c 2001-02-28 23:59:59 -UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 WEEK); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2007-10-08 10:21:39 -2 b 1999-03-08 00:00:00 -3 e 2006-08-11 20:03:11 -4 d 2003-02-04 05:01:03 -5 c 2001-03-07 23:59:59 -UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 DAY); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2007-10-07 10:21:39 -2 b 1999-03-07 00:00:00 -3 e 2006-08-10 20:03:11 -4 d 2003-02-03 05:01:03 -5 c 2001-03-06 23:59:59 -UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 HOUR); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2007-10-07 11:21:39 -2 b 1999-03-07 01:00:00 -3 e 2006-08-10 21:03:11 -4 d 2003-02-03 06:01:03 -5 c 2001-03-07 00:59:59 -UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 MINUTE); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2007-10-07 11:20:39 -2 b 1999-03-07 00:59:00 -3 e 2006-08-10 21:02:11 -4 d 2003-02-03 06:00:03 -5 c 2001-03-07 00:58:59 -UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 SECOND); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2007-10-07 11:20:40 -2 b 1999-03-07 00:59:01 -3 e 2006-08-10 21:02:12 -4 d 2003-02-03 06:00:04 -5 c 2001-03-07 00:59:00 - -deinit -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -end of test diff --git a/storage/spider/mysql-test/spider/oracle2/r/ha.result b/storage/spider/mysql-test/spider/oracle2/r/ha.result deleted file mode 100644 index 8ca64dec6df..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/r/ha.result +++ /dev/null @@ -1,240 +0,0 @@ -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -drop and create databases -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -CREATE DATABASE auto_test_remote; -USE auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -CREATE DATABASE auto_test_remote2; -USE auto_test_remote2; -DROP DATABASE IF EXISTS auto_test_remote3; -CREATE DATABASE auto_test_remote3; -USE auto_test_remote3; -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; - -test select 1 -SELECT 1; -1 -1 - -create table test -DROP TABLE IF EXISTS ta_l; -CREATE TABLE ta_l ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_2_1 -INSERT INTO ta_l (a, b, c) VALUES -(1, 'a', '2008-08-01 10:21:39'), -(2, 'b', '2000-01-01 00:00:00'), -(3, 'e', '2007-06-04 20:03:11'), -(4, 'd', '2003-11-30 05:01:03'), -(5, 'c', '2001-12-31 23:59:59'); - -select test -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 - -fail-over test -SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; -Variable_name Value -Spider_mon_table_cache_version 0 -Spider_mon_table_cache_version_req 1 -INSERT INTO ta_l (a, b, c) VALUES -(6, 'e', '2011-05-05 20:04:05'); -ERROR HY000: Table 'SYSTEM.ta_r3' get a problem -SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables -ORDER BY db_name, table_name, link_id; -db_name table_name link_id link_status -auto_test_local ta_l 0 1 -auto_test_local ta_l 1 3 -SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; -db_name table_name link_id -auto_test_local ta_l 1 -SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; -Variable_name Value -Spider_mon_table_cache_version 1 -Spider_mon_table_cache_version_req 1 -INSERT INTO ta_l (a, b, c) VALUES -(6, 'e', '2011-05-05 20:04:05'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 -6 e 2011-05-05 20:04:05 - -recovery test -ALTER TABLE ta_l -CONNECTION='host "xe", user "system", - password "oracle", msi "2", mkd "2", - database "SYSTEM", lst "0 2"'; -SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables -ORDER BY db_name, table_name, link_id; -db_name table_name link_id link_status -auto_test_local ta_l 0 1 -auto_test_local ta_l 1 2 -SELECT spider_copy_tables('ta_l', '0', '1'); -spider_copy_tables('ta_l', '0', '1') -1 -ALTER TABLE ta_l -CONNECTION='host "xe", user "system", - password "oracle", msi "2", mkd "2", - database "SYSTEM", lst "0 1"'; -SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables -ORDER BY db_name, table_name, link_id; -db_name table_name link_id link_status -auto_test_local ta_l 0 1 -auto_test_local ta_l 1 1 -INSERT INTO ta_l (a, b, c) VALUES -(8, 'g', '2011-05-05 21:33:30'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 -6 e 2011-05-05 20:04:05 -8 g 2011-05-05 21:33:30 -DROP TABLE ta_l; -SELECT spider_flush_table_mon_cache(); -spider_flush_table_mon_cache() -1 - -active standby test -create table test -DROP TABLE IF EXISTS ta_l; -CREATE TABLE ta_l ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_2_1 -INSERT INTO ta_l (a, b, c) VALUES -(1, 'a', '2008-08-01 10:21:39'), -(2, 'b', '2000-01-01 00:00:00'), -(3, 'e', '2007-06-04 20:03:11'), -(4, 'd', '2003-11-30 05:01:03'), -(5, 'c', '2001-12-31 23:59:59'); - -select test -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 - -fail-over test -SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; -Variable_name Value -Spider_mon_table_cache_version 1 -Spider_mon_table_cache_version_req 2 -INSERT INTO ta_l (a, b, c) VALUES -(6, 'e', '2011-05-05 20:04:05'); -ERROR HY000: Table 'SYSTEM.ta_r' get a problem -SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables -ORDER BY db_name, table_name, link_id; -db_name table_name link_id link_status -auto_test_local ta_l 0 3 -auto_test_local ta_l 1 1 -SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; -db_name table_name link_id -auto_test_local ta_l 1 -auto_test_local ta_l 0 -SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; -Variable_name Value -Spider_mon_table_cache_version 2 -Spider_mon_table_cache_version_req 2 -INSERT INTO ta_l (a, b, c) VALUES -(6, 'e', '2011-05-05 20:04:05'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -6 e 2011-05-05 20:04:05 - -recovery test -ALTER TABLE ta_l -CONNECTION='host "xe", user "system", - password "oracle", msi "2", mkd "2", alc "1", - database "SYSTEM", lst "1 0"'; -SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables -ORDER BY db_name, table_name, link_id; -db_name table_name link_id link_status -auto_test_local ta_l 0 1 -auto_test_local ta_l 1 1 -INSERT INTO ta_l (a, b, c) VALUES -(8, 'g', '2011-05-05 21:33:30'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -8 g 2011-05-05 21:33:30 -DROP TABLE ta_l; -SELECT spider_flush_table_mon_cache(); -spider_flush_table_mon_cache() -1 - -deinit -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -DROP DATABASE IF EXISTS auto_test_remote3; -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_local; -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -end of test diff --git a/storage/spider/mysql-test/spider/oracle2/r/ha_part.result b/storage/spider/mysql-test/spider/oracle2/r/ha_part.result deleted file mode 100644 index e11b6f695e0..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/r/ha_part.result +++ /dev/null @@ -1,262 +0,0 @@ -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -drop and create databases -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -CREATE DATABASE auto_test_remote; -USE auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -CREATE DATABASE auto_test_remote2; -USE auto_test_remote2; -DROP DATABASE IF EXISTS auto_test_remote3; -CREATE DATABASE auto_test_remote3; -USE auto_test_remote3; -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; - -test select 1 -SELECT 1; -1 -1 - -create table with partition test -DROP TABLE IF EXISTS ta_l2; -CREATE TABLE ta_l2 ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_P_2_1 -INSERT INTO ta_l2 (a, b, c) VALUES -(1, 'a', '2008-08-01 10:21:39'), -(2, 'b', '2000-01-01 00:00:00'), -(3, 'e', '2007-06-04 20:03:11'), -(4, 'd', '2003-11-30 05:01:03'), -(5, 'c', '2001-12-31 23:59:59'); - -select test -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 - -fail-over test -SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; -Variable_name Value -Spider_mon_table_cache_version 0 -Spider_mon_table_cache_version_req 1 -INSERT INTO ta_l2 (a, b, c) VALUES -(6, 'e', '2011-05-05 20:04:05'); -ERROR HY000: Table 'SYSTEM.ta_r4' get a problem -SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables -ORDER BY db_name, table_name, link_id; -db_name table_name link_id link_status -auto_test_local ta_l2#P#pt1 0 1 -auto_test_local ta_l2#P#pt1 1 1 -auto_test_local ta_l2#P#pt2 0 1 -auto_test_local ta_l2#P#pt2 1 3 -SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; -db_name table_name link_id -auto_test_local ta_l2#P#pt2 1 -SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; -Variable_name Value -Spider_mon_table_cache_version 1 -Spider_mon_table_cache_version_req 1 -INSERT INTO ta_l2 (a, b, c) VALUES -(6, 'e', '2011-05-05 20:04:05'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 -6 e 2011-05-05 20:04:05 - -recovery test -ALTER TABLE ta_l2 -PARTITION BY KEY(a) ( -PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', -PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 2"' - ); -SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables -ORDER BY db_name, table_name, link_id; -db_name table_name link_id link_status -auto_test_local ta_l2#P#pt1 0 1 -auto_test_local ta_l2#P#pt1 1 1 -auto_test_local ta_l2#P#pt2 0 1 -auto_test_local ta_l2#P#pt2 1 2 -SELECT spider_copy_tables('ta_l2#P#pt2', '0', '1'); -spider_copy_tables('ta_l2#P#pt2', '0', '1') -1 -ALTER TABLE ta_l2 -PARTITION BY KEY(a) ( -PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', -PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 1"' - ); -SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables -ORDER BY db_name, table_name, link_id; -db_name table_name link_id link_status -auto_test_local ta_l2#P#pt1 0 1 -auto_test_local ta_l2#P#pt1 1 1 -auto_test_local ta_l2#P#pt2 0 1 -auto_test_local ta_l2#P#pt2 1 1 -INSERT INTO ta_l2 (a, b, c) VALUES -(8, 'g', '2011-05-05 21:33:30'), -(9, 'h', '2011-05-05 22:32:10'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 -6 e 2011-05-05 20:04:05 -8 g 2011-05-05 21:33:30 -9 h 2011-05-05 22:32:10 -DROP TABLE ta_l2; - -create table with partition test -DROP TABLE IF EXISTS ta_l2; -CREATE TABLE ta_l2 ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_P_2_1 -INSERT INTO ta_l2 (a, b, c) VALUES -(1, 'a', '2008-08-01 10:21:39'), -(2, 'b', '2000-01-01 00:00:00'), -(3, 'e', '2007-06-04 20:03:11'), -(4, 'd', '2003-11-30 05:01:03'), -(5, 'c', '2001-12-31 23:59:59'); - -select test -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 - -fail-over test -SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; -Variable_name Value -Spider_mon_table_cache_version 1 -Spider_mon_table_cache_version_req 1 -INSERT INTO ta_l2 (a, b, c) VALUES -(6, 'e', '2011-05-05 20:04:05'); -ERROR HY000: Table 'SYSTEM.ta_r2' get a problem -SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables -ORDER BY db_name, table_name, link_id; -db_name table_name link_id link_status -auto_test_local ta_l2#P#pt1 0 1 -auto_test_local ta_l2#P#pt1 1 1 -auto_test_local ta_l2#P#pt2 0 3 -auto_test_local ta_l2#P#pt2 1 1 -SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; -db_name table_name link_id -auto_test_local ta_l2#P#pt2 1 -auto_test_local ta_l2#P#pt2 0 -SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%'; -Variable_name Value -Spider_mon_table_cache_version 1 -Spider_mon_table_cache_version_req 1 -INSERT INTO ta_l2 (a, b, c) VALUES -(6, 'e', '2011-05-05 20:04:05'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -3 e 2007-06-04 20:03:11 -5 c 2001-12-31 23:59:59 -6 e 2011-05-05 20:04:05 - -recovery test -ALTER TABLE ta_l2 -PARTITION BY KEY(a) ( -PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', -PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "1 0"' - ); -SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables -ORDER BY db_name, table_name, link_id; -db_name table_name link_id link_status -auto_test_local ta_l2#P#pt1 0 1 -auto_test_local ta_l2#P#pt1 1 1 -auto_test_local ta_l2#P#pt2 0 1 -auto_test_local ta_l2#P#pt2 1 1 -INSERT INTO ta_l2 (a, b, c) VALUES -(8, 'g', '2011-05-05 21:33:30'), -(9, 'h', '2011-05-05 22:32:10'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -3 e 2007-06-04 20:03:11 -5 c 2001-12-31 23:59:59 -8 g 2011-05-05 21:33:30 -9 h 2011-05-05 22:32:10 -DROP TABLE ta_l2; - -deinit -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -DROP DATABASE IF EXISTS auto_test_remote3; -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_local; -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -end of test diff --git a/storage/spider/mysql-test/spider/oracle2/r/spider3_fixes.result b/storage/spider/mysql-test/spider/oracle2/r/spider3_fixes.result deleted file mode 100644 index dd6c8715648..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/r/spider3_fixes.result +++ /dev/null @@ -1,210 +0,0 @@ -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 -for slave1_1 - -drop and create databases -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -CREATE DATABASE auto_test_remote; -USE auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -CREATE DATABASE auto_test_remote2; -USE auto_test_remote2; - -test select 1 -SELECT 1; -1 -1 - -3.1 -auto_increment -DROP TABLE IF EXISTS t1, t2; -CREATE TABLE t1 ( -id int(11) NOT NULL AUTO_INCREMENT, -PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1 -CREATE TABLE t2 ( -id int(11) NOT NULL AUTO_INCREMENT, -PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1 -MASTER_1_AUTO_INCREMENT_INCREMENT2 -MASTER_1_AUTO_INCREMENT_OFFSET2 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') -1 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') -1 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') -1 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') -1 -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -2 -SELECT MAX(id) FROM t1; -MAX(id) -2 -INSERT INTO t2 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -6 -SELECT MAX(id) FROM t2; -MAX(id) -6 -MASTER_1_AUTO_INCREMENT_OFFSET3 -INSERT INTO t1 (id) VALUES (null); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -10 -SELECT MAX(id) FROM t1; -MAX(id) -10 -MASTER_1_AUTO_INCREMENT_OFFSET4 -INSERT INTO t2 (id) VALUES (null); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -14 -SELECT MAX(id) FROM t2; -MAX(id) -14 -MASTER_1_AUTO_INCREMENT_OFFSET3 -INSERT INTO t1 () VALUES (),(),(),(); -Warnings: -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -18 -SELECT id FROM t1 ORDER BY id; -id -2 -6 -10 -14 -18 -22 -26 -30 -MASTER_1_AUTO_INCREMENT_OFFSET4 -INSERT INTO t2 () VALUES (),(),(),(); -Warnings: -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -34 -SELECT id FROM t2 ORDER BY id; -id -2 -6 -10 -14 -18 -22 -26 -30 -34 -38 -42 -46 -TRUNCATE TABLE t1; -TRUNCATE TABLE t2; -INSERT INTO t1 () VALUES (),(),(),(); -Warnings: -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -50 -SELECT id FROM t1 ORDER BY id; -id -50 -54 -58 -62 -INSERT INTO t2 () VALUES (),(),(),(); -Warnings: -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -66 -SELECT id FROM t2 ORDER BY id; -id -50 -54 -58 -62 -66 -70 -74 -78 -SET INSERT_ID=5000; -MASTER_1_AUTO_INCREMENT_OFFSET3 -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -82 -SELECT MAX(id) FROM t1; -MAX(id) -82 -MASTER_1_AUTO_INCREMENT_OFFSET4 -INSERT INTO t2 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -86 -SELECT MAX(id) FROM t2; -MAX(id) -86 -INSERT INTO t1 (id) VALUES (10000); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -90 -SELECT MAX(id) FROM t1; -MAX(id) -90 -INSERT INTO t2 (id) VALUES (1000); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -94 -SELECT MAX(id) FROM t2; -MAX(id) -94 - -deinit -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -for slave1_1 -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -end of test diff --git a/storage/spider/mysql-test/spider/oracle2/r/spider3_fixes_part.result b/storage/spider/mysql-test/spider/oracle2/r/spider3_fixes_part.result deleted file mode 100644 index 38875214eb8..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/r/spider3_fixes_part.result +++ /dev/null @@ -1,208 +0,0 @@ -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 -for slave1_1 - -drop and create databases -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -CREATE DATABASE auto_test_remote; -USE auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -CREATE DATABASE auto_test_remote2; -USE auto_test_remote2; - -test select 1 -SELECT 1; -1 -1 -auto_increment with partition -DROP TABLE IF EXISTS t1, t2; -CREATE TABLE t1 ( -id int(11) NOT NULL AUTO_INCREMENT, -PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1 -CREATE TABLE t2 ( -id int(11) NOT NULL AUTO_INCREMENT, -PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1 -MASTER_1_AUTO_INCREMENT_INCREMENT2 -MASTER_1_AUTO_INCREMENT_OFFSET2 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') -1 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') -1 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') -1 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') -1 -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -3 -SELECT MAX(id) FROM t1; -MAX(id) -3 -INSERT INTO t2 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -7 -SELECT MAX(id) FROM t2; -MAX(id) -7 -MASTER_1_AUTO_INCREMENT_OFFSET3 -INSERT INTO t1 (id) VALUES (null); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -2 -SELECT MAX(id) FROM t1; -MAX(id) -7 -MASTER_1_AUTO_INCREMENT_OFFSET4 -INSERT INTO t2 (id) VALUES (null); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -6 -SELECT MAX(id) FROM t2; -MAX(id) -7 -MASTER_1_AUTO_INCREMENT_OFFSET3 -INSERT INTO t1 () VALUES (),(),(),(); -Warnings: -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -10 -SELECT id FROM t1 ORDER BY id; -id -2 -3 -6 -7 -10 -11 -14 -15 -MASTER_1_AUTO_INCREMENT_OFFSET4 -INSERT INTO t2 () VALUES (),(),(),(); -Warnings: -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -18 -SELECT id FROM t2 ORDER BY id; -id -2 -3 -6 -7 -10 -11 -14 -15 -18 -19 -22 -23 -TRUNCATE TABLE t1; -TRUNCATE TABLE t2; -INSERT INTO t1 () VALUES (),(),(),(); -Warnings: -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -26 -SELECT id FROM t1 ORDER BY id; -id -26 -27 -30 -31 -INSERT INTO t2 () VALUES (),(),(),(); -Warnings: -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -34 -SELECT id FROM t2 ORDER BY id; -id -26 -27 -30 -31 -34 -35 -38 -39 -SET INSERT_ID=5000; -MASTER_1_AUTO_INCREMENT_OFFSET3 -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -42 -SELECT MAX(id) FROM t1; -MAX(id) -42 -MASTER_1_AUTO_INCREMENT_OFFSET4 -INSERT INTO t2 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -43 -SELECT MAX(id) FROM t2; -MAX(id) -43 -INSERT INTO t1 (id) VALUES (10000); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -46 -SELECT MAX(id) FROM t1; -MAX(id) -46 -INSERT INTO t2 (id) VALUES (1000); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -50 -SELECT MAX(id) FROM t2; -MAX(id) -50 - -deinit -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -for slave1_1 -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -end of test diff --git a/storage/spider/mysql-test/spider/oracle2/r/spider_fixes.result b/storage/spider/mysql-test/spider/oracle2/r/spider_fixes.result deleted file mode 100644 index 5a41603c746..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/r/spider_fixes.result +++ /dev/null @@ -1,556 +0,0 @@ -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 -for slave1_1 - -drop and create databases -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -CREATE DATABASE auto_test_remote; -USE auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -CREATE DATABASE auto_test_remote2; -USE auto_test_remote2; - -test select 1 -SELECT 1; -1 -1 - -create table and insert -DROP TABLE IF EXISTS tb_l; -CREATE TABLE tb_l ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE2 MASTER_1_CHARSET2 -INSERT INTO tb_l (a, b, c) VALUES -(1, 'a', '2008-08-01 10:21:39'), -(2, 'b', '2000-01-01 00:00:00'), -(3, 'e', '2007-06-04 20:03:11'), -(4, 'd', '2003-11-30 05:01:03'), -(5, 'c', '2001-12-31 23:59:59'); -DROP TABLE IF EXISTS ta_l; -CREATE TABLE ta_l ( -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 -INSERT INTO ta_l SELECT a, b, c FROM tb_l; - -2.13 -select table with "order by desc" and "<" -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -WHERE a < 5 ORDER BY a DESC LIMIT 3; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -4 d 2003-11-30 05:01:03 -3 e 2007-06-04 20:03:11 -2 b 2000-01-01 00:00:00 - -select table with "order by desc" and "<=" -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -WHERE a <= 5 ORDER BY a DESC LIMIT 3; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -5 c 2001-12-31 23:59:59 -4 d 2003-11-30 05:01:03 -3 e 2007-06-04 20:03:11 - -2.14 -update table with range scan and split_read -UPDATE ta_l SET c = '2000-02-02 00:00:00' WHERE a > 1; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-02-02 00:00:00 -3 e 2000-02-02 00:00:00 -4 d 2000-02-02 00:00:00 -5 c 2000-02-02 00:00:00 - -2.15 -select table with range scan -TRUNCATE TABLE ta_l; -DROP TABLE IF EXISTS ta_l; -CREATE TABLE ta_l ( -a int(11) NOT NULL DEFAULT '0', -b char(1) DEFAULT NULL, -c datetime DEFAULT NULL, -PRIMARY KEY (a, b, c) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1 -INSERT INTO ta_l SELECT a, b, c FROM tb_l; -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b' -AND c = '2003-11-30 05:01:03'; -a b c -4 d 2003-11-30 05:01:03 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b' -AND c = '2003-11-30 05:01:03'; -a b c -4 d 2003-11-30 05:01:03 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a >= 4 AND b = 'd' -AND c = '2003-11-30 05:01:03'; -a b c -4 d 2003-11-30 05:01:03 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a > 4 AND b = 'c' -AND c = '2001-12-31 23:59:59'; -a b c -5 c 2001-12-31 23:59:59 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b <= 'd' -AND c = '2003-11-30 05:01:03'; -a b c -4 d 2003-11-30 05:01:03 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b < 'e' -AND c = '2003-11-30 05:01:03'; -a b c -4 d 2003-11-30 05:01:03 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND b = 'b' -AND c = '2000-01-01 00:00:00'; -a b c -2 b 2000-01-01 00:00:00 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND b = 'b' -AND c = '2000-01-01 00:00:00'; -a b c -2 b 2000-01-01 00:00:00 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b' -AND b <= 'd' AND c = '2003-11-30 05:01:03'; -a b c -4 d 2003-11-30 05:01:03 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b' -AND b < 'e' AND c = '2003-11-30 05:01:03'; -a b c -4 d 2003-11-30 05:01:03 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND a >= 1 -AND b >= 'b' AND c = '2003-11-30 05:01:03'; -a b c -4 d 2003-11-30 05:01:03 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND a > 1 -AND b >= 'b' AND c = '2000-01-01 00:00:00'; -a b c -2 b 2000-01-01 00:00:00 - -2.16 -auto_increment insert with trigger -CREATE TABLE ta_l_auto_inc ( -a INT AUTO_INCREMENT, -b CHAR(1) DEFAULT 'c', -c DATETIME DEFAULT '1999-10-10 10:10:10', -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1 -CREATE TABLE tc_l ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE2 MASTER_1_CHARSET2 -CREATE TRIGGER ins_ta_l_auto_inc AFTER INSERT ON ta_l_auto_inc FOR EACH ROW BEGIN INSERT INTO tc_l (a, b, c) VALUES (NEW.a, NEW.b, NEW.c); END;; -INSERT INTO ta_l_auto_inc (a, b, c) VALUES -(NULL, 's', '2008-12-31 20:59:59'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM tc_l ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 s 2008-12-31 20:59:59 - -2.17 -engine-condition-pushdown with "or" and joining -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l WHERE a = 1 OR a IN (SELECT a FROM tb_l); -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 a 2008-08-01 10:21:39 -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 - -2.23 -index merge -CREATE TABLE ta_l_int ( -a INT AUTO_INCREMENT, -b INT DEFAULT 10, -c INT DEFAULT 11, -PRIMARY KEY(a), -KEY idx1(b), -KEY idx2(c) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1 -INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3); -INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int; -INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int; -INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int; -INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int; -SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2) -WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a; -a b c -3 4 5 -4 5 6 -5 6 7 - -2.24 -index scan update without PK -DROP TABLE IF EXISTS ta_l_int; -CREATE TABLE ta_l_int ( -a INT NOT NULL, -b INT DEFAULT 10, -c INT DEFAULT 11, -KEY idx1(b), -KEY idx2(c) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1 -SELECT a, b, c FROM ta_l_int ORDER BY a; -a b c -1 2 3 -2 3 4 -3 4 5 -4 5 6 -5 6 7 -6 7 8 -7 8 9 -8 9 10 -9 10 11 -10 11 12 -11 12 13 -12 13 14 -13 14 15 -14 15 16 -15 16 17 -16 17 18 -INSERT INTO ta_l_int (a, b, c) VALUES (0, 2, 3); -INSERT INTO ta_l_int (a, b, c) VALUES (18, 2, 3); -UPDATE ta_l_int SET c = 4 WHERE b = 2; -SELECT a, b, c FROM ta_l_int ORDER BY a; -a b c -0 2 4 -1 2 4 -2 3 4 -3 4 5 -4 5 6 -5 6 7 -6 7 8 -7 8 9 -8 9 10 -9 10 11 -10 11 12 -11 12 13 -12 13 14 -13 14 15 -14 15 16 -15 16 17 -16 17 18 -18 2 4 - -2.25 -direct order limit -SHOW GLOBAL STATUS LIKE 'Spider_direct_order_limit%'; -Variable_name Value -Spider_direct_order_limit 0 -SELECT a, b, c FROM ta_l_int ORDER BY a LIMIT 3; -a b c -1 2 4 -2 3 4 -3 4 5 -SHOW GLOBAL STATUS LIKE 'Spider_direct_order_limit%'; -Variable_name Value -Spider_direct_order_limit 0 - -2.26 -lock tables -DROP TABLE IF EXISTS t1; -DROP TABLE IF EXISTS t2; -CREATE TABLE t1 ( -id int(11) NOT NULL, -PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK1 -CREATE TABLE t2 ( -id int(11) NOT NULL, -PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK2 -LOCK TABLES t1 READ, t2 READ; -UNLOCK TABLES; - -auto_increment -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 ( -id int(11) NOT NULL AUTO_INCREMENT, -PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1 -MASTER_1_AUTO_INCREMENT_INCREMENT2 -MASTER_1_AUTO_INCREMENT_OFFSET2 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') -1 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') -1 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') -1 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') -1 -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -2 -SELECT MAX(id) FROM t1; -MAX(id) -2 -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -6 -SELECT MAX(id) FROM t1; -MAX(id) -6 -INSERT INTO t1 (id) VALUES (null); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -10 -SELECT MAX(id) FROM t1; -MAX(id) -10 -INSERT INTO t1 (id) VALUES (null); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -14 -SELECT MAX(id) FROM t1; -MAX(id) -14 -INSERT INTO t1 () VALUES (),(),(),(); -Warnings: -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -18 -SELECT id FROM t1 ORDER BY id; -id -2 -6 -10 -14 -18 -22 -26 -30 -SET INSERT_ID=5000; -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -34 -SELECT MAX(id) FROM t1; -MAX(id) -34 -INSERT INTO t1 (id) VALUES (10000); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -38 -SELECT MAX(id) FROM t1; -MAX(id) -38 -INSERT INTO t1 (id) VALUES (1000); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -42 -SELECT MAX(id) FROM t1; -MAX(id) -42 - -read only -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 ( -id int(11) NOT NULL, -PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_READONLY1_1 -SELECT id FROM t1 ORDER BY id; -id -2 -6 -10 -14 -18 -22 -26 -30 -34 -38 -42 -INSERT INTO t1 (id) VALUES (1); -ERROR HY000: Table 'auto_test_local.t1' is read only -UPDATE t1 SET id = 4 WHERE id = 2; -ERROR HY000: Table 'auto_test_local.t1' is read only -DELETE FROM t1 WHERE id = 2; -ERROR HY000: Table 'auto_test_local.t1' is read only -DELETE FROM t1; -ERROR HY000: Table 'auto_test_local.t1' is read only -TRUNCATE t1; -ERROR HY000: Table 'auto_test_local.t1' is read only - -2.27 -error mode -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 ( -id int(11) NOT NULL, -PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_ERROR_MODE1_1 -SELECT id FROM t1 ORDER BY id; -id -Warnings: -Error 12712 Error from Oracle -1 942 ORA-00942: ??????????????? - -Error 12712 Oracle error -Error 12712 Error from Oracle -1 942 ORA-00942: ??????????????? - -Error 12712 Oracle error -INSERT INTO t1 (id) VALUES (1); -Warnings: -Error 12712 Error from Oracle -1 942 ORA-00942: ??????????????? - -Error 12712 Oracle error -DELETE FROM t1; -Warnings: -Error 12712 Error from Oracle -1 942 ORA-00942: ??????????????? - -Error 12712 Oracle error -TRUNCATE t1; -Warnings: -Error 12712 Error from Oracle -1 942 ORA-00942: ??????????????? - -Error 12712 Oracle error - -3.0 -is null -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 ( -a VARCHAR(255), -b VARCHAR(255), -c VARCHAR(255), -KEY idx1(a,b), -KEY idx2(b), -PRIMARY KEY(c) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_TEXT_KEY1_1 -insert into t1 values (null, null, '2048'); -insert into t1 values ('1', '1', '1'); -insert into t1 select a + 1, b + 1, c + 1 from t1; -insert into t1 select a + 2, b + 2, c + 2 from t1; -insert into t1 select a + 4, b + 4, c + 4 from t1; -insert into t1 select a + 8, b + 8, c + 8 from t1; -insert into t1 select a + 16, b + 16, c + 16 from t1; -insert into t1 select a + 32, b + 32, c + 32 from t1; -insert into t1 select a + 64, b + 64, c + 64 from t1; -insert into t1 select a + 128, b + 128, c + 128 from t1; -insert into t1 select a + 256, b + 256, c + 256 from t1; -insert into t1 select a + 512, b + 512, c + 512 from t1; -flush tables; -select a from t1 where a is null order by a limit 30; -a -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -select b from t1 where b is null order by b limit 30; -b -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL -NULL - -direct_order_limit -TRUNCATE TABLE t1; -insert into t1 values ('1', '1', '1'); -insert into t1 select a + 1, b + 1, c + 1 from t1; -insert into t1 select a + 2, b + 2, c + 2 from t1; -insert into t1 select a + 4, b + 4, c + 4 from t1; -insert into t1 select a + 8, b + 8, c + 8 from t1; -insert into t1 select a + 16, b + 16, c + 16 from t1; -insert into t1 select a, b + 32, c + 32 from t1; -insert into t1 select a, b + 64, c + 64 from t1; -insert into t1 select a, b + 128, c + 128 from t1; -flush tables; -select a, b, c from t1 where a = '10' and b <> '100' order by c desc limit 5; -a b c -10 74 74 -10 42 42 -10 234 234 -10 202 202 -10 170 170 -select a, c from t1 where a = '10' order by b desc limit 5; -a c -10 74 -10 42 -10 234 -10 202 -10 170 - -deinit -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -for slave1_1 -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -end of test diff --git a/storage/spider/mysql-test/spider/oracle2/r/spider_fixes_part.result b/storage/spider/mysql-test/spider/oracle2/r/spider_fixes_part.result deleted file mode 100644 index 20a5ca1812b..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/r/spider_fixes_part.result +++ /dev/null @@ -1,203 +0,0 @@ -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 -for slave1_1 - -drop and create databases -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -CREATE DATABASE auto_test_remote; -USE auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -CREATE DATABASE auto_test_remote2; -USE auto_test_remote2; - -test select 1 -SELECT 1; -1 -1 -DROP TABLE IF EXISTS tb_l; -CREATE TABLE tb_l ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE2 MASTER_1_CHARSET2 -INSERT INTO tb_l (a, b, c) VALUES -(1, 'a', '2008-08-01 10:21:39'), -(2, 'b', '2000-01-01 00:00:00'), -(3, 'e', '2007-06-04 20:03:11'), -(4, 'd', '2003-11-30 05:01:03'), -(5, 'c', '2001-12-31 23:59:59'); - -2.17 -partition with sort -CREATE TABLE ta_l2 ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1 -INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 WHERE a > 1 -ORDER BY a; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -2 b 2000-01-01 00:00:00 -3 e 2007-06-04 20:03:11 -4 d 2003-11-30 05:01:03 -5 c 2001-12-31 23:59:59 - -2.23 -partition update with moving partition -DROP TABLE IF EXISTS ta_l2; -CREATE TABLE ta_l2 ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1 -INSERT INTO ta_l2 (a, b, c) VALUES (3, 'B', '2010-09-26 00:00:00'); -UPDATE ta_l2 SET a = 4 WHERE a = 3; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -4 B 2010-09-26 00:00:00 -index merge with partition -DROP TABLE IF EXISTS ta_l_int; -CREATE TABLE ta_l_int ( -a INT AUTO_INCREMENT, -b INT DEFAULT 10, -c INT DEFAULT 11, -PRIMARY KEY(a), -KEY idx1(b), -KEY idx2(c) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_P_2_1 -INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3); -INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int; -INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int; -INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int; -INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int; -SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2) -WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a; -a b c -3 4 5 -4 5 6 -5 6 7 - -2.26 -auto_increment with partition -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 ( -id int(11) NOT NULL AUTO_INCREMENT, -PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1 -MASTER_1_AUTO_INCREMENT_INCREMENT2 -MASTER_1_AUTO_INCREMENT_OFFSET2 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') -1 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') -1 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"') -1 -spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"') -1 -spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"') -1 -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -3 -SELECT MAX(id) FROM t1; -MAX(id) -3 -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -2 -SELECT MAX(id) FROM t1; -MAX(id) -3 -INSERT INTO t1 (id) VALUES (null); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -7 -SELECT MAX(id) FROM t1; -MAX(id) -7 -INSERT INTO t1 (id) VALUES (null); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -6 -SELECT MAX(id) FROM t1; -MAX(id) -7 -INSERT INTO t1 () VALUES (),(),(),(); -Warnings: -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -10 -SELECT id FROM t1 ORDER BY id; -id -2 -3 -6 -7 -10 -11 -14 -15 -SET INSERT_ID=5000; -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -18 -SELECT MAX(id) FROM t1; -MAX(id) -18 -INSERT INTO t1 (id) VALUES (10000); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -22 -SELECT MAX(id) FROM t1; -MAX(id) -22 -INSERT INTO t1 (id) VALUES (1000); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -26 -SELECT MAX(id) FROM t1; -MAX(id) -26 - -deinit -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -for slave1_1 -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -end of test diff --git a/storage/spider/mysql-test/spider/oracle2/r/vp_fixes.result b/storage/spider/mysql-test/spider/oracle2/r/vp_fixes.result deleted file mode 100644 index 15dd29aa4d3..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/r/vp_fixes.result +++ /dev/null @@ -1,80 +0,0 @@ -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -drop and create databases -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -CREATE DATABASE auto_test_remote; -USE auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -CREATE DATABASE auto_test_remote2; -USE auto_test_remote2; - -test select 1 -SELECT 1; -1 -1 - -create table and insert -DROP TABLE IF EXISTS tb_l; -CREATE TABLE tb_l ( -a INT, -b CHAR(1), -c DATETIME, -PRIMARY KEY(a) -) MASTER_1_ENGINE2 MASTER_1_CHARSET2 -INSERT INTO tb_l (a, b, c) VALUES -(1, 'a', '2008-08-01 10:21:39'), -(2, 'b', '2000-01-01 00:00:00'), -(3, 'e', '2007-06-04 20:03:11'), -(4, 'd', '2003-11-30 05:01:03'), -(5, 'c', '2001-12-31 23:59:59'); -DROP TABLE IF EXISTS ta_l; -CREATE TABLE ta_l ( -PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 -INSERT INTO ta_l SELECT a, b, c FROM tb_l; - -0.9 -create different primary key table -CREATE TABLE ta_l_int ( -a INT DEFAULT 10, -b INT AUTO_INCREMENT, -c INT DEFAULT 11, -PRIMARY KEY(b) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1 -INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); -create un-correspond primary key table -DROP TABLE IF EXISTS ta_l_int; -CREATE TABLE ta_l_int ( -a INT DEFAULT 10, -b INT DEFAULT 12, -c INT DEFAULT 11, -PRIMARY KEY(c) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1 -INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); - -deinit -DROP DATABASE IF EXISTS auto_test_local; -DROP DATABASE IF EXISTS auto_test_remote; -DROP DATABASE IF EXISTS auto_test_remote2; -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 -child3_1 -child3_2 -child3_3 - -end of test diff --git a/storage/spider/mysql-test/spider/oracle2/t/basic_sql.test b/storage/spider/mysql-test/spider/oracle2/t/basic_sql.test deleted file mode 100644 index 6421198fa95..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/basic_sql.test +++ /dev/null @@ -1,2701 +0,0 @@ -# This test tests by executing basic SQL ---disable_warnings ---disable_query_log ---disable_result_log ---source test_init.inc ---enable_result_log ---enable_query_log - ---echo ---echo drop and create databases ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - CREATE DATABASE auto_test_remote; - USE auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - CREATE DATABASE auto_test_remote2; - USE auto_test_remote2; -} ---enable_warnings - ---echo ---echo test select 1 ---connection master_1 -SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - SELECT 1; - --connection child2_2 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo create table select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS tb_l; ---enable_warnings ---disable_query_log -echo CREATE TABLE tb_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) MASTER_1_ENGINE2 MASTER_1_CHARSET2; -eval CREATE TABLE tb_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; ---enable_query_log -INSERT INTO tb_l (a, b, c) VALUES - (1, 'a', '2008-08-01 10:21:39'), - (2, 'b', '2000-01-01 00:00:00'), - (3, 'e', '2007-06-04 20:03:11'), - (4, 'd', '2003-11-30 05:01:03'), - (5, 'c', '2001-12-31 23:59:59'); ---disable_warnings -DROP TABLE IF EXISTS ta_l; ---enable_warnings ---disable_query_log -echo CREATE TABLE ta_l ( - PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 -SELECT a, b, c FROM tb_l; -if ($MASTER_1_MERGE) -{ - --error ER_WRONG_OBJECT - eval CREATE TABLE ta_l ( - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1 - SELECT a, b, c FROM tb_l; - eval CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; - INSERT INTO ta_l SELECT a, b, c FROM tb_l; -} -if (!$MASTER_1_MERGE) -{ - eval CREATE TABLE ta_l ( - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1 - SELECT a, b, c FROM tb_l; -} ---enable_query_log -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo create table ignore select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS ta_l; -DROP TABLE IF EXISTS tb_l; ---enable_warnings ---disable_query_log -echo CREATE TABLE tb_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) MASTER_1_ENGINE2 MASTER_1_CHARSET2; -eval CREATE TABLE tb_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; ---enable_query_log -INSERT INTO tb_l (a, b, c) VALUES - (1, 'f', '2008-07-01 10:21:39'), - (2, 'g', '2000-02-01 00:00:00'), - (3, 'j', '2007-05-04 20:03:11'), - (4, 'i', '2003-10-30 05:01:03'), - (5, 'h', '2001-10-31 23:59:59'); ---disable_query_log -echo CREATE TABLE ta_l ( - PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 -IGNORE SELECT a, b, c FROM tb_l; -if ($MASTER_1_MERGE) -{ - --error ER_WRONG_OBJECT - eval CREATE TABLE ta_l ( - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1 - IGNORE SELECT a, b, c FROM tb_l; - eval CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; - INSERT IGNORE INTO ta_l SELECT a, b, c FROM tb_l; -} -if (!$MASTER_1_MERGE) -{ - eval CREATE TABLE ta_l ( - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1 - IGNORE SELECT a, b, c FROM tb_l; -} ---enable_query_log -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo create table ignore select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS ta_l; ---enable_warnings ---disable_query_log -echo CREATE TABLE ta_l ( - PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 -REPLACE SELECT a, b, c FROM tb_l; -if ($MASTER_1_MERGE) -{ - --error ER_WRONG_OBJECT - eval CREATE TABLE ta_l ( - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1 - REPLACE SELECT a, b, c FROM tb_l; - eval CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; - REPLACE INTO ta_l SELECT a, b, c FROM tb_l; -} -if (!$MASTER_1_MERGE) -{ - eval CREATE TABLE ta_l ( - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1 - REPLACE SELECT a, b, c FROM tb_l; -} ---enable_query_log -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%replace %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo create no index table -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES3; - echo CHILD2_1_CREATE_TABLES3; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES3; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES3; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS ta_l_no_idx; ---enable_warnings ---disable_query_log -echo CREATE TABLE ta_l_no_idx -MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1 -SELECT a, b, c FROM tb_l; -if ($MASTER_1_NEEDPK) -{ - --error ER_REQUIRES_PRIMARY_KEY - eval CREATE TABLE ta_l_no_idx - $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1 - SELECT a, b, c FROM tb_l; - eval CREATE TABLE ta_l_no_idx ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1; - INSERT INTO ta_l_no_idx SELECT a, b, c FROM tb_l; -} -if (!$MASTER_1_NEEDPK) -{ - if ($MASTER_1_MERGE) - { - --error ER_WRONG_OBJECT - eval CREATE TABLE ta_l_no_idx - $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1 - SELECT a, b, c FROM tb_l; - eval CREATE TABLE ta_l_no_idx ( - a INT, - b CHAR(1), - c DATETIME - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1; - INSERT INTO ta_l_no_idx SELECT a, b, c FROM tb_l; - } - if (!$MASTER_1_MERGE) - { - eval CREATE TABLE ta_l_no_idx - $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1 - SELECT a, b, c FROM tb_l; - } -} ---enable_query_log -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_TABLES3; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l_no_idx ORDER BY a; - ---echo ---echo select table -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select table shared mode -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a -LOCK IN SHARE MODE; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select table for update -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a -FOR UPDATE; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select table join -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a, tb_l b -WHERE a.a = b.a ORDER BY a.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select table straight_join -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT STRAIGHT_JOIN a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s') -FROM ta_l a, tb_l b WHERE a.a = b.a ORDER BY a.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select sql_small_result -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT SQL_SMALL_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select sql_big_result -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT SQL_BIG_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select sql_buffer_result -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT SQL_BUFFER_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select sql_cache -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT SQL_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select sql_no_cache -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT SQL_NO_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select sql_calc_found_rows -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT SQL_CALC_FOUND_ROWS a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a LIMIT 4; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_ps2_protocol -SELECT found_rows(); ---enable_ps2_protocol - ---echo ---echo select high_priority -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT HIGH_PRIORITY a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select distinct -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT DISTINCT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select count -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT count(*) FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select table join not use index -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM tb_l a WHERE -EXISTS (SELECT * FROM ta_l b WHERE b.b = a.b) ORDER BY a.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select using pushdown -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE -a.b = 'g' ORDER BY a.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select using index and pushdown -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE -a.a > 0 AND a.b = 'g' ORDER BY a.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo insert ---connection master_1 -TRUNCATE TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE 'insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo insert select ---connection master_1 -TRUNCATE TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -INSERT INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE 'insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo insert select a ---connection master_1 -TRUNCATE TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -INSERT INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1), -'e', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE 'insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo insert low_priority ---connection master_1 -TRUNCATE TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -INSERT LOW_PRIORITY INTO ta_l (a, b, c) values (2, 'e', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE 'insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo insert high_priority ---connection master_1 -TRUNCATE TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -INSERT HIGH_PRIORITY INTO ta_l (a, b, c) VALUES (2, 'e', -'2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE 'insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo insert ignore -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -INSERT IGNORE INTO ta_l (a, b, c) VALUES (2, 'd', '2009-02-02 01:01:01'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE 'insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo insert update (insert) ---connection master_1 -TRUNCATE TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE -KEY UPDATE b = 'f', c = '2005-08-08 11:11:11'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'insert %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE '%update %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE '%delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo insert update (update) -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE -KEY UPDATE b = 'f', c = '2005-08-08 11:11:11'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'insert %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE '%update %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE '%delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo replace ---connection master_1 -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -REPLACE INTO ta_l (a, b, c) VALUES (2, 'f', '2008-02-02 02:02:02'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'replace %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'insert %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo replace select -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -REPLACE INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'replace %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'insert %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo replace select a -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -REPLACE INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1), -'e', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'replace %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'insert %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo replace low_priority -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -REPLACE LOW_PRIORITY INTO ta_l (a, b, c) VALUES (3, 'g', -'2009-03-03 03:03:03'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'replace %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'insert %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo update -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -UPDATE ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo update select -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a IN (SELECT a FROM -tb_l); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo update select a -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -UPDATE ta_l SET b = 'h', c = '2010-04-04 04:04:04' WHERE a = (SELECT a FROM -tb_l ORDER BY a LIMIT 1); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo update join -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -UPDATE ta_l a, tb_l b SET a.b = b.b, a.c = b.c WHERE a.a = b.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo update join a -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -UPDATE ta_l a, tb_l b SET a.b = 'g', a.c = '2009-03-03 03:03:03' WHERE -a.a = b.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo update low_priority -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -UPDATE LOW_PRIORITY ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo update ignore -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -UPDATE IGNORE ta_l SET a = 1, b = 'g', c = '2009-03-03 03:03:03' WHERE a = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo update pushdown -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -update ta_l set b = 'j', c = '2009-03-03 03:03:03' where b = 'f'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo update index pushdown -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'j'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo delete -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -DELETE FROM ta_l WHERE a = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo delete all -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -DELETE FROM ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo delete select -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -DELETE FROM ta_l WHERE a IN (SELECT a FROM tb_l); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo delete select a -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -DELETE FROM ta_l WHERE a = (SELECT a FROM tb_l ORDER BY a LIMIT 1); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo delete join -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -DELETE a FROM ta_l a, (SELECT a FROM tb_l ORDER BY a) b WHERE a.a = b.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo delete low_priority -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -DELETE LOW_PRIORITY FROM ta_l WHERE a = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo delete ignore -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -DELETE IGNORE FROM ta_l WHERE a = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo delete quick -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -DELETE QUICK FROM ta_l WHERE a = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo delete pushdown -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -DELETE FROM ta_l WHERE b = 'e'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo delete index pushdown -TRUNCATE TABLE ta_l; -INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), -(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'), -(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'), -(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), -(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), -(10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -DELETE FROM ta_l WHERE a > 0 AND b = 'e'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo truncate -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -TRUNCATE TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE 'truncate %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo deinit ---disable_warnings ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; -} ---disable_query_log ---disable_result_log ---source test_deinit.inc ---enable_result_log ---enable_query_log ---enable_warnings ---echo ---echo end of test diff --git a/storage/spider/mysql-test/spider/oracle2/t/basic_sql_part.test b/storage/spider/mysql-test/spider/oracle2/t/basic_sql_part.test deleted file mode 100644 index e1638642ab7..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/basic_sql_part.test +++ /dev/null @@ -1,571 +0,0 @@ -# This test tests by executing basic SQL ---disable_warnings ---disable_query_log ---disable_result_log ---source test_init.inc ---enable_result_log ---enable_query_log -if (!$HAVE_PARTITION) -{ - --disable_query_log - --disable_result_log - --source test_deinit.inc - --enable_result_log - --enable_query_log - --enable_warnings - skip Test requires partitioning; -} - ---echo ---echo drop and create databases ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - CREATE DATABASE auto_test_remote; - USE auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - CREATE DATABASE auto_test_remote2; - USE auto_test_remote2; -} ---enable_warnings - ---echo ---echo test select 1 ---connection master_1 -SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - SELECT 1; - --connection child2_2 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS tb_l; ---enable_warnings ---disable_query_log -echo CREATE TABLE tb_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) MASTER_1_ENGINE2 MASTER_1_CHARSET2; -eval CREATE TABLE tb_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; ---enable_query_log -INSERT INTO tb_l (a, b, c) VALUES - (1, 'f', '2008-07-01 10:21:39'), - (2, 'g', '2000-02-01 00:00:00'), - (3, 'j', '2007-05-04 20:03:11'), - (4, 'i', '2003-10-30 05:01:03'), - (5, 'h', '2001-10-31 23:59:59'); - ---echo ---echo create table with partition and select test -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_2_DROP_TABLES; - --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES2; - echo CHILD2_1_CREATE_TABLES2; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES2; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - --disable_query_log - echo CREATE TABLE ta_l2 ( - PRIMARY KEY(a) - ) MASTER_1_ENGINE MASTER_1_COMMENT_P_2_1 - SELECT a, b, c FROM tb_l; - if ($MASTER_1_MERGE) - { - --error ER_WRONG_OBJECT - eval CREATE TABLE ta_l2 ( - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1 - SELECT a, b, c FROM tb_l; - eval CREATE TABLE ta_l2 ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1; - INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; - } - if (!$MASTER_1_MERGE) - { - eval CREATE TABLE ta_l2 ( - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1 - SELECT a, b, c FROM tb_l; - } - --enable_query_log - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - } - eval $CHILD2_2_SELECT_TABLES; - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -} - ---echo ---echo select partition using pushdown -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE - a.b = 'g' ORDER BY a.a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } -} - ---echo ---echo select partition using index pushdown -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE - a.a > 0 AND a.b = 'g' ORDER BY a.a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } -} - ---echo ---echo update partition pushdown -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - UPDATE ta_l2 SET b = 'e', c = '2009-03-03 03:03:03' WHERE b = 'j'; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_2_SELECT_TABLES; - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -} - ---echo ---echo update partition index pushdown -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - UPDATE ta_l2 SET b = 'j', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'e'; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_2_SELECT_TABLES; - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -} - ---echo ---echo delete partition pushdown -if ($HAVE_PARTITION) -{ - TRUNCATE TABLE ta_l2; - INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - DELETE FROM ta_l2 WHERE b = 'g'; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'delete %'; - } - eval $CHILD2_2_SELECT_TABLES; - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -} - ---echo ---echo delete partition index pushdown -if ($HAVE_PARTITION) -{ - TRUNCATE TABLE ta_l2; - INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - DELETE FROM ta_l2 WHERE a > 0 AND b = 'g'; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'delete %'; - } - eval $CHILD2_2_SELECT_TABLES; - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -} - ---echo ---echo deinit ---disable_warnings ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; -} ---disable_query_log ---disable_result_log ---source test_deinit.inc ---enable_result_log ---enable_query_log ---enable_warnings ---echo ---echo end of test diff --git a/storage/spider/mysql-test/spider/oracle2/t/connect_child2_1.inc b/storage/spider/mysql-test/spider/oracle2/t/connect_child2_1.inc deleted file mode 100644 index cd9b0c9ca9b..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/connect_child2_1.inc +++ /dev/null @@ -1 +0,0 @@ ---connect (child2_1, localhost, root, , , $CHILD2_1_MYPORT, $CHILD2_1_MYSOCK) diff --git a/storage/spider/mysql-test/spider/oracle2/t/connect_child2_2.inc b/storage/spider/mysql-test/spider/oracle2/t/connect_child2_2.inc deleted file mode 100644 index e145f66b630..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/connect_child2_2.inc +++ /dev/null @@ -1 +0,0 @@ ---connect (child2_2, localhost, root, , , $CHILD2_2_MYPORT, $CHILD2_2_MYSOCK) diff --git a/storage/spider/mysql-test/spider/oracle2/t/connect_child2_3.inc b/storage/spider/mysql-test/spider/oracle2/t/connect_child2_3.inc deleted file mode 100644 index d356348d8ea..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/connect_child2_3.inc +++ /dev/null @@ -1 +0,0 @@ ---connect (child2_3, localhost, root, , , $CHILD2_3_MYPORT, $CHILD2_3_MYSOCK) diff --git a/storage/spider/mysql-test/spider/oracle2/t/connect_child3_1.inc b/storage/spider/mysql-test/spider/oracle2/t/connect_child3_1.inc deleted file mode 100644 index 03e5c188c89..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/connect_child3_1.inc +++ /dev/null @@ -1 +0,0 @@ ---connect (child3_1, localhost, root, , , $CHILD3_1_MYPORT, $CHILD3_1_MYSOCK) diff --git a/storage/spider/mysql-test/spider/oracle2/t/connect_child3_2.inc b/storage/spider/mysql-test/spider/oracle2/t/connect_child3_2.inc deleted file mode 100644 index d62a7ada824..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/connect_child3_2.inc +++ /dev/null @@ -1 +0,0 @@ ---connect (child3_2, localhost, root, , , $CHILD3_2_MYPORT, $CHILD3_2_MYSOCK) diff --git a/storage/spider/mysql-test/spider/oracle2/t/connect_child3_3.inc b/storage/spider/mysql-test/spider/oracle2/t/connect_child3_3.inc deleted file mode 100644 index fb49f5bfdac..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/connect_child3_3.inc +++ /dev/null @@ -1 +0,0 @@ ---connect (child3_3, localhost, root, , , $CHILD3_3_MYPORT, $CHILD3_3_MYSOCK) diff --git a/storage/spider/mysql-test/spider/oracle2/t/connect_master_1.inc b/storage/spider/mysql-test/spider/oracle2/t/connect_master_1.inc deleted file mode 100644 index 0c129ce5775..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/connect_master_1.inc +++ /dev/null @@ -1 +0,0 @@ ---connect (master_1, localhost, root, , , $MASTER_1_MYPORT, $MASTER_1_MYSOCK) diff --git a/storage/spider/mysql-test/spider/oracle2/t/connect_slave1_1.inc b/storage/spider/mysql-test/spider/oracle2/t/connect_slave1_1.inc deleted file mode 100644 index 45a822743e0..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/connect_slave1_1.inc +++ /dev/null @@ -1 +0,0 @@ ---connect (slave1_1, localhost, root, , , $SLAVE1_1_MYPORT, $SLAVE1_1_MYSOCK) diff --git a/storage/spider/mysql-test/spider/oracle2/t/direct_aggregate.test b/storage/spider/mysql-test/spider/oracle2/t/direct_aggregate.test deleted file mode 100644 index ca96d4bd41f..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/direct_aggregate.test +++ /dev/null @@ -1,181 +0,0 @@ ---disable_warnings ---disable_query_log ---disable_result_log ---source test_init.inc ---enable_result_log ---enable_query_log - ---echo ---echo drop and create databases ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - CREATE DATABASE auto_test_remote; - USE auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - CREATE DATABASE auto_test_remote2; - USE auto_test_remote2; -} ---enable_warnings - ---echo ---echo test select 1 ---connection master_1 -SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - SELECT 1; - --connection child2_2 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo create table select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS ta_l; ---enable_warnings ---disable_query_log -echo CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; ---enable_query_log -INSERT INTO ta_l (a, b, c) VALUES - (1, 'a', '2008-08-01 10:21:39'), - (2, 'b', '2000-01-01 00:00:00'), - (3, 'e', '2007-06-04 20:03:11'), - (4, 'd', '2003-11-30 05:01:03'), - (5, 'c', '2001-12-31 23:59:59'); - ---echo ---echo direct_aggregating test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_ps2_protocol -eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; -SELECT COUNT(*) FROM ta_l; -eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; -SELECT MAX(a) FROM ta_l; -eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; -SELECT MIN(a) FROM ta_l; -eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; -SELECT MAX(a) FROM ta_l WHERE a < 5; -eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; -SELECT MIN(a) FROM ta_l WHERE a > 1; -eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; ---enable_ps2_protocol -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo deinit ---disable_warnings ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; -} ---disable_query_log ---disable_result_log ---source test_deinit.inc ---enable_result_log ---enable_query_log ---enable_warnings ---echo ---echo end of test diff --git a/storage/spider/mysql-test/spider/oracle2/t/direct_aggregate_part.test b/storage/spider/mysql-test/spider/oracle2/t/direct_aggregate_part.test deleted file mode 100644 index d6d4623afc5..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/direct_aggregate_part.test +++ /dev/null @@ -1,194 +0,0 @@ ---disable_warnings ---disable_query_log ---disable_result_log ---source test_init.inc ---enable_result_log ---enable_query_log -if (!$HAVE_PARTITION) -{ - --disable_query_log - --disable_result_log - --source test_deinit.inc - --enable_result_log - --enable_query_log - --enable_warnings - skip Test requires partitioning; -} - ---echo ---echo drop and create databases ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - CREATE DATABASE auto_test_remote; - USE auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - CREATE DATABASE auto_test_remote2; - USE auto_test_remote2; -} ---enable_warnings - ---echo ---echo test select 1 ---connection master_1 -SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - SELECT 1; - --connection child2_2 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo with partition test -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_2_DROP_TABLES; - --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES2; - echo CHILD2_1_CREATE_TABLES2; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES2; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - --disable_query_log - echo CREATE TABLE ta_l2 ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1; - eval CREATE TABLE ta_l2 ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1; - INSERT INTO ta_l2 (a, b, c) VALUES - (1, 'a', '2008-08-01 10:21:39'), - (2, 'b', '2000-01-01 00:00:00'), - (3, 'e', '2007-06-04 20:03:11'), - (4, 'd', '2003-11-30 05:01:03'), - (5, 'c', '2001-12-31 23:59:59'); - --enable_query_log - --disable_ps2_protocol - eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; - SELECT COUNT(*) FROM ta_l2; - eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; - SELECT MAX(a) FROM ta_l2; - eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; - SELECT MIN(a) FROM ta_l2; - eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; - SELECT MAX(a) FROM ta_l2 WHERE a < 5; - eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; - SELECT MIN(a) FROM ta_l2 WHERE a > 1; - eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; - --enable_ps2_protocol - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %'; - } - eval $CHILD2_2_SELECT_TABLES; - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } -} - ---echo ---echo deinit ---disable_warnings ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; -} ---disable_query_log ---disable_result_log ---source test_deinit.inc ---enable_result_log ---enable_query_log ---enable_warnings ---echo ---echo end of test diff --git a/storage/spider/mysql-test/spider/oracle2/t/direct_update.test b/storage/spider/mysql-test/spider/oracle2/t/direct_update.test deleted file mode 100644 index e0901062201..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/direct_update.test +++ /dev/null @@ -1,198 +0,0 @@ ---disable_warnings ---disable_query_log ---disable_result_log ---source test_init.inc ---enable_result_log ---enable_query_log - ---echo ---echo drop and create databases ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - CREATE DATABASE auto_test_remote; - USE auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - CREATE DATABASE auto_test_remote2; - USE auto_test_remote2; -} ---enable_warnings - ---echo ---echo test select 1 ---connection master_1 -SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - SELECT 1; - --connection child2_2 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo create table select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS ta_l; ---enable_warnings ---disable_query_log -echo CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; ---enable_query_log -INSERT INTO ta_l (a, b, c) VALUES - (1, 'a', '2008-08-01 10:21:39'), - (2, 'b', '2000-01-01 00:00:00'), - (3, 'e', '2007-06-04 20:03:11'), - (4, 'd', '2003-11-30 05:01:03'), - (5, 'c', '2001-12-31 23:59:59'); - ---echo ---echo direct_updating test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; ---echo update all rows with function -UPDATE ta_l SET c = ADDDATE(c, 1); -eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; ---echo update by primary key -UPDATE ta_l SET b = 'x' WHERE a = 3; -eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; ---echo update by a column without index -UPDATE ta_l SET c = '2011-10-17' WHERE b = 'x'; -eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; ---echo update by primary key with order and limit -UPDATE ta_l SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1; -eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; ---echo delete by primary key with order and limit -DELETE FROM ta_l WHERE a < 4 ORDER BY c LIMIT 1; -eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; ---echo delete by a column without index -DELETE FROM ta_l WHERE b = 'c'; -eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; ---echo delete by primary key -DELETE FROM ta_l WHERE a = 3; -eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS; -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo deinit ---disable_warnings ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; -} ---disable_query_log ---disable_result_log ---source test_deinit.inc ---enable_result_log ---enable_query_log ---enable_warnings ---echo ---echo end of test diff --git a/storage/spider/mysql-test/spider/oracle2/t/direct_update_part.test b/storage/spider/mysql-test/spider/oracle2/t/direct_update_part.test deleted file mode 100644 index 95e2e2ab0d5..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/direct_update_part.test +++ /dev/null @@ -1,211 +0,0 @@ ---disable_warnings ---disable_query_log ---disable_result_log ---source test_init.inc ---enable_result_log ---enable_query_log -if (!$HAVE_PARTITION) -{ - --disable_query_log - --disable_result_log - --source test_deinit.inc - --enable_result_log - --enable_query_log - --enable_warnings - skip Test requires partitioning; -} - ---echo ---echo drop and create databases ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - CREATE DATABASE auto_test_remote; - USE auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - CREATE DATABASE auto_test_remote2; - USE auto_test_remote2; -} ---enable_warnings - ---echo ---echo test select 1 ---connection master_1 -SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - SELECT 1; - --connection child2_2 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo with partition test -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_2_DROP_TABLES; - --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES2; - echo CHILD2_1_CREATE_TABLES2; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES2; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - --disable_query_log - echo CREATE TABLE ta_l2 ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1; - eval CREATE TABLE ta_l2 ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1; - INSERT INTO ta_l2 (a, b, c) VALUES - (1, 'a', '2008-08-01 10:21:39'), - (2, 'b', '2000-01-01 00:00:00'), - (3, 'e', '2007-06-04 20:03:11'), - (4, 'd', '2003-11-30 05:01:03'), - (5, 'c', '2001-12-31 23:59:59'); - --enable_query_log - eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - --echo update all rows with function - UPDATE ta_l2 SET c = ADDDATE(c, 1); - eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - --echo update by primary key - UPDATE ta_l2 SET b = 'x' WHERE a = 3; - eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - --echo update by a column without index - UPDATE ta_l2 SET c = '2011-10-17' WHERE b = 'x'; - eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - --echo update by primary key with order and limit - UPDATE ta_l2 SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1; - eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - --echo delete by primary key with order and limit - DELETE FROM ta_l2 WHERE a < 4 ORDER BY c LIMIT 1; - eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS; - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - --echo delete by a column without index - DELETE FROM ta_l2 WHERE b = 'c'; - eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS; - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - --echo delete by primary key - DELETE FROM ta_l2 WHERE a = 3; - eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS; - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %'; - } - eval $CHILD2_2_SELECT_TABLES; - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%handler %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } -} - ---echo ---echo deinit ---disable_warnings ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; -} ---disable_query_log ---disable_result_log ---source test_deinit.inc ---enable_result_log ---enable_query_log ---enable_warnings ---echo ---echo end of test diff --git a/storage/spider/mysql-test/spider/oracle2/t/function.test b/storage/spider/mysql-test/spider/oracle2/t/function.test deleted file mode 100644 index ec2eeab9c94..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/function.test +++ /dev/null @@ -1,253 +0,0 @@ -# This test tests for using functions ---disable_warnings ---disable_query_log ---disable_result_log ---source test_init.inc ---enable_result_log ---enable_query_log - ---echo ---echo drop and create databases ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - CREATE DATABASE auto_test_remote; - USE auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - CREATE DATABASE auto_test_remote2; - USE auto_test_remote2; -} ---enable_warnings - ---echo ---echo test select 1 ---connection master_1 -SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - SELECT 1; - --connection child2_2 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo in() -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_result_log - } - --disable_query_log - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_1_DROP_TEXT_PK_TABLES1; - echo CHILD2_1_CREATE_TEXT_PK_TABLES1; - } - --disable_warnings - eval $CHILD2_1_DROP_TEXT_PK_TABLES1; - --enable_warnings - eval $CHILD2_1_CREATE_TEXT_PK_TABLES1; - --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_result_log - } -} ---connection master_1 ---disable_query_log -echo CREATE TABLE t1 ( - a VARCHAR(255), - PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET3 MASTER_1_COMMENT_TEXT_PK1_1; -eval CREATE TABLE t1 ( - a VARCHAR(255), - PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET3 $MASTER_1_COMMENT_TEXT_PK1_1; ---enable_query_log -insert into t1 values ('1'); -insert into t1 select a + 1 from t1; -insert into t1 select a + 2 from t1; -insert into t1 select a + 4 from t1; -insert into t1 select a + 8 from t1; -insert into t1 select a + 16 from t1; -insert into t1 select a + 32 from t1; -insert into t1 select a + 64 from t1; -insert into t1 select a + 128 from t1; -insert into t1 select a + 256 from t1; -insert into t1 select a + 512 from t1; -flush tables; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -select a from t1 where a in ('15', '120'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TEXT_PK_TABLES1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo date_sub() -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS ta_l; ---enable_warnings ---disable_query_log -echo CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; ---enable_query_log -INSERT INTO ta_l (a, b, c) VALUES - (1, 'a', '2008-08-01 10:21:39'), - (2, 'b', '2000-01-01 00:00:00'), - (3, 'e', '2007-06-04 20:03:11'), - (4, 'd', '2003-11-30 05:01:03'), - (5, 'c', '2001-12-31 23:59:59'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 YEAR); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 QUARTER); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 MONTH); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 WEEK); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 DAY); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 HOUR); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 MINUTE); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 SECOND); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo deinit ---disable_warnings ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; -} ---disable_query_log ---disable_result_log ---source test_deinit.inc ---enable_result_log ---enable_query_log ---enable_warnings ---echo ---echo end of test diff --git a/storage/spider/mysql-test/spider/oracle2/t/ha.test b/storage/spider/mysql-test/spider/oracle2/t/ha.test deleted file mode 100644 index 00dcf776836..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/ha.test +++ /dev/null @@ -1,882 +0,0 @@ -# This test tests for ha features -if ($USE_HA_TEST) -{ ---disable_warnings ---disable_query_log ---disable_result_log ---source test_init.inc ---source ha_test_init.inc ---enable_result_log ---enable_query_log - ---echo ---echo drop and create databases ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - CREATE DATABASE auto_test_remote; - USE auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - CREATE DATABASE auto_test_remote2; - USE auto_test_remote2; - --connection child2_3 - DROP DATABASE IF EXISTS auto_test_remote3; - CREATE DATABASE auto_test_remote3; - USE auto_test_remote3; -} -if ($USE_CHILD_GROUP3) -{ - --connection child3_1 - DROP DATABASE IF EXISTS auto_test_local; - CREATE DATABASE auto_test_local; - USE auto_test_local; - --connection child3_2 - DROP DATABASE IF EXISTS auto_test_local; - CREATE DATABASE auto_test_local; - USE auto_test_local; - --connection child3_3 - DROP DATABASE IF EXISTS auto_test_local; - CREATE DATABASE auto_test_local; - USE auto_test_local; -} ---enable_warnings - ---echo ---echo test select 1 ---connection master_1 -SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - SELECT 1; - --connection child2_2 - SELECT 1; - --connection child2_3 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - SELECT 1; - --connection child3_2 - SELECT 1; - --connection child3_3 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo create table test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_2_DROP_TABLES; - --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_2_1; - --enable_warnings - eval $CHILD3_1_CREATE_TABLES_HA_2_1; - --connection child3_2 - --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_2_1; - --enable_warnings - eval $CHILD3_2_CREATE_TABLES_HA_2_1; - --connection child3_3 - --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_2_1; - --enable_warnings - eval $CHILD3_3_CREATE_TABLES_HA_2_1; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS ta_l; ---enable_warnings ---disable_query_log -echo CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_2_1; -eval CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_2_1; ---enable_query_log -INSERT INTO ta_l (a, b, c) VALUES - (1, 'a', '2008-08-01 10:21:39'), - (2, 'b', '2000-01-01 00:00:00'), - (3, 'e', '2007-06-04 20:03:11'), - (4, 'd', '2003-11-30 05:01:03'), - (5, 'c', '2001-12-31 23:59:59'); - ---echo ---echo select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo fail-over test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_HA_DROP_TABLES; - } - --disable_warnings - eval $CHILD2_2_HA_DROP_TABLES; - --enable_warnings - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -eval $MASTER_1_CHECK_HA_STATUS; ---error 12511 -INSERT INTO ta_l (a, b, c) VALUES - (6, 'e', '2011-05-05 20:04:05'); -eval $MASTER_1_CHECK_LINK_STATUS; -eval $MASTER_1_CHECK_LINK_FAILED_LOG; -eval $MASTER_1_CHECK_HA_STATUS; -INSERT INTO ta_l (a, b, c) VALUES - (6, 'e', '2011-05-05 20:04:05'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - eval $CHILD3_1_CHECK_LINK_STATUS; - eval $CHILD3_1_CHECK_LINK_FAILED_LOG; - --connection child3_2 - eval $CHILD3_2_CHECK_LINK_STATUS; - eval $CHILD3_2_CHECK_LINK_FAILED_LOG; - --connection child3_3 - eval $CHILD3_3_CHECK_LINK_STATUS; - eval $CHILD3_3_CHECK_LINK_FAILED_LOG; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo recovery test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_HA_CREATE_TABLES; - } - eval $CHILD2_2_HA_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - eval $CHILD3_1_SET_RECOVERY_STATUS_2_1; - eval $CHILD3_1_CHECK_LINK_STATUS; - --connection child3_2 - eval $CHILD3_2_SET_RECOVERY_STATUS_2_1; - eval $CHILD3_2_CHECK_LINK_STATUS; - --connection child3_3 - eval $CHILD3_3_SET_RECOVERY_STATUS_2_1; - eval $CHILD3_3_CHECK_LINK_STATUS; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -eval $MASTER_1_SET_RECOVERY_STATUS_2_1; -eval $MASTER_1_CHECK_LINK_STATUS; -eval $MASTER_1_COPY_TABLES_2_1; -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - eval $CHILD3_1_SET_OK_STATUS_2_1; - eval $CHILD3_1_CHECK_LINK_STATUS; - --connection child3_2 - eval $CHILD3_2_SET_OK_STATUS_2_1; - eval $CHILD3_2_CHECK_LINK_STATUS; - --connection child3_3 - eval $CHILD3_3_SET_OK_STATUS_2_1; - eval $CHILD3_3_CHECK_LINK_STATUS; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -eval $MASTER_1_SET_OK_STATUS_2_1; -eval $MASTER_1_CHECK_LINK_STATUS; -INSERT INTO ta_l (a, b, c) VALUES - (8, 'g', '2011-05-05 21:33:30'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -DROP TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_2_1; - --enable_warnings - --connection child3_2 - --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_2_1; - --enable_warnings - --connection child3_3 - --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_2_1; - --enable_warnings - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } -} - ---connection master_1 ---disable_ps2_protocol -eval $MASTER_1_CHANGE_HA_MON; ---enable_ps2_protocol - ---echo ---echo active standby test ---echo create table test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_2_DROP_TABLES; - --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_2_1; - --enable_warnings - eval $CHILD3_1_CREATE_TABLES_HA_AS_2_1; - --connection child3_2 - --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_2_1; - --enable_warnings - eval $CHILD3_2_CREATE_TABLES_HA_AS_2_1; - --connection child3_3 - --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_2_1; - --enable_warnings - eval $CHILD3_3_CREATE_TABLES_HA_AS_2_1; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS ta_l; ---enable_warnings ---disable_query_log -echo CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_2_1; -eval CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_AS_2_1; ---enable_query_log -INSERT INTO ta_l (a, b, c) VALUES - (1, 'a', '2008-08-01 10:21:39'), - (2, 'b', '2000-01-01 00:00:00'), - (3, 'e', '2007-06-04 20:03:11'), - (4, 'd', '2003-11-30 05:01:03'), - (5, 'c', '2001-12-31 23:59:59'); - ---echo ---echo select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo fail-over test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_HA_AS_DROP_TABLES; - } - --disable_warnings - eval $CHILD2_1_HA_AS_DROP_TABLES; - --enable_warnings - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -eval $MASTER_1_CHECK_HA_STATUS; ---error 12511 -INSERT INTO ta_l (a, b, c) VALUES - (6, 'e', '2011-05-05 20:04:05'); -eval $MASTER_1_CHECK_LINK_STATUS; -eval $MASTER_1_CHECK_LINK_FAILED_LOG; -eval $MASTER_1_CHECK_HA_STATUS; -INSERT INTO ta_l (a, b, c) VALUES - (6, 'e', '2011-05-05 20:04:05'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - eval $CHILD3_1_CHECK_LINK_STATUS; - eval $CHILD3_1_CHECK_LINK_FAILED_LOG; - --connection child3_2 - eval $CHILD3_2_CHECK_LINK_STATUS; - eval $CHILD3_2_CHECK_LINK_FAILED_LOG; - --connection child3_3 - eval $CHILD3_3_CHECK_LINK_STATUS; - eval $CHILD3_3_CHECK_LINK_FAILED_LOG; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo recovery test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_HA_AS_CREATE_TABLES; - } - eval $CHILD2_1_HA_AS_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - eval $CHILD3_1_SET_OK_STATUS_AS_2_1; - eval $CHILD3_1_CHECK_LINK_STATUS; - --connection child3_2 - eval $CHILD3_2_SET_OK_STATUS_AS_2_1; - eval $CHILD3_2_CHECK_LINK_STATUS; - --connection child3_3 - eval $CHILD3_3_SET_OK_STATUS_AS_2_1; - eval $CHILD3_3_CHECK_LINK_STATUS; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -eval $MASTER_1_SET_OK_STATUS_AS_2_1; -eval $MASTER_1_CHECK_LINK_STATUS; -INSERT INTO ta_l (a, b, c) VALUES - (8, 'g', '2011-05-05 21:33:30'); -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -DROP TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_2_1; - --enable_warnings - --connection child3_2 - --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_2_1; - --enable_warnings - --connection child3_3 - --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_2_1; - --enable_warnings - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } -} - ---connection master_1 ---disable_ps2_protocol -eval $MASTER_1_CHANGE_HA_MON; ---enable_ps2_protocol - ---echo ---echo deinit ---disable_warnings ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - --connection child2_3 - DROP DATABASE IF EXISTS auto_test_remote3; -} -if ($USE_CHILD_GROUP3) -{ - --connection child3_1 - DROP DATABASE IF EXISTS auto_test_local; - --connection child3_2 - DROP DATABASE IF EXISTS auto_test_local; - --connection child3_3 - DROP DATABASE IF EXISTS auto_test_local; -} ---disable_query_log ---disable_result_log ---source ha_test_deinit.inc ---source test_deinit.inc ---enable_result_log ---enable_query_log ---enable_warnings -} ---echo ---echo end of test diff --git a/storage/spider/mysql-test/spider/oracle2/t/ha_part.test b/storage/spider/mysql-test/spider/oracle2/t/ha_part.test deleted file mode 100644 index 72ddcfd1f10..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/ha_part.test +++ /dev/null @@ -1,1017 +0,0 @@ -# This test tests for ha features -if ($USE_HA_TEST) -{ ---disable_warnings ---disable_query_log ---disable_result_log ---source test_init.inc ---source ha_test_init.inc ---enable_result_log ---enable_query_log -if (!$HAVE_PARTITION) -{ - --disable_query_log - --disable_result_log - --source ha_test_deinit.inc - --source test_deinit.inc - --enable_result_log - --enable_query_log - --enable_warnings - skip Test requires partitioning; -} - ---echo ---echo drop and create databases ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - CREATE DATABASE auto_test_remote; - USE auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - CREATE DATABASE auto_test_remote2; - USE auto_test_remote2; - --connection child2_3 - DROP DATABASE IF EXISTS auto_test_remote3; - CREATE DATABASE auto_test_remote3; - USE auto_test_remote3; -} -if ($USE_CHILD_GROUP3) -{ - --connection child3_1 - DROP DATABASE IF EXISTS auto_test_local; - CREATE DATABASE auto_test_local; - USE auto_test_local; - --connection child3_2 - DROP DATABASE IF EXISTS auto_test_local; - CREATE DATABASE auto_test_local; - USE auto_test_local; - --connection child3_3 - DROP DATABASE IF EXISTS auto_test_local; - CREATE DATABASE auto_test_local; - USE auto_test_local; -} ---enable_warnings - ---echo ---echo test select 1 ---connection master_1 -SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - SELECT 1; - --connection child2_2 - SELECT 1; - --connection child2_3 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - SELECT 1; - --connection child3_2 - SELECT 1; - --connection child3_3 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } -} - -if ($HAVE_PARTITION) -{ - --echo - --echo create table with partition test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_DROP_TABLES2; - echo CHILD2_1_CREATE_TABLES; - echo CHILD2_1_CREATE_TABLES2; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES; - eval $CHILD2_1_DROP_TABLES2; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - eval $CHILD2_1_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_2_DROP_TABLES; - --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_3 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_3_DROP_TABLES; - echo CHILD2_3_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_3_DROP_TABLES; - --enable_warnings - eval $CHILD2_3_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_P_2_1; - --enable_warnings - eval $CHILD3_1_CREATE_TABLES_HA_P_2_1; - --connection child3_2 - --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_P_2_1; - --enable_warnings - eval $CHILD3_2_CREATE_TABLES_HA_P_2_1; - --connection child3_3 - --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_P_2_1; - --enable_warnings - eval $CHILD3_3_CREATE_TABLES_HA_P_2_1; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - --disable_warnings - DROP TABLE IF EXISTS ta_l2; - --enable_warnings - --disable_query_log - echo CREATE TABLE ta_l2 ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_P_2_1; - eval CREATE TABLE ta_l2 ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_P_2_1; - --enable_query_log - INSERT INTO ta_l2 (a, b, c) VALUES - (1, 'a', '2008-08-01 10:21:39'), - (2, 'b', '2000-01-01 00:00:00'), - (3, 'e', '2007-06-04 20:03:11'), - (4, 'd', '2003-11-30 05:01:03'), - (5, 'c', '2001-12-31 23:59:59'); - - --echo - --echo select test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_3 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - eval $CHILD2_1_SELECT_TABLES2; - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - --connection child2_3 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_3_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - - --echo - --echo fail-over test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_3 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_3_HA_DROP_TABLES; - } - --disable_warnings - eval $CHILD2_3_HA_DROP_TABLES; - --enable_warnings - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - eval $MASTER_1_CHECK_HA_STATUS; - --error 12511 - INSERT INTO ta_l2 (a, b, c) VALUES - (6, 'e', '2011-05-05 20:04:05'); - eval $MASTER_1_CHECK_LINK_STATUS; - eval $MASTER_1_CHECK_LINK_FAILED_LOG; - eval $MASTER_1_CHECK_HA_STATUS; - INSERT INTO ta_l2 (a, b, c) VALUES - (6, 'e', '2011-05-05 20:04:05'); - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - eval $CHILD2_1_SELECT_TABLES2; - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - eval $CHILD3_1_CHECK_LINK_STATUS; - eval $CHILD3_1_CHECK_LINK_FAILED_LOG; - --connection child3_2 - eval $CHILD3_2_CHECK_LINK_STATUS; - eval $CHILD3_2_CHECK_LINK_FAILED_LOG; - --connection child3_3 - eval $CHILD3_3_CHECK_LINK_STATUS; - eval $CHILD3_3_CHECK_LINK_FAILED_LOG; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } - } - - --echo - --echo recovery test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_3 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_3_HA_CREATE_TABLES; - } - eval $CHILD2_3_HA_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - eval $CHILD3_1_SET_RECOVERY_STATUS_P_2_1; - eval $CHILD3_1_CHECK_LINK_STATUS; - --connection child3_2 - eval $CHILD3_2_SET_RECOVERY_STATUS_P_2_1; - eval $CHILD3_2_CHECK_LINK_STATUS; - --connection child3_3 - eval $CHILD3_3_SET_RECOVERY_STATUS_P_2_1; - eval $CHILD3_3_CHECK_LINK_STATUS; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - eval $MASTER_1_SET_RECOVERY_STATUS_P_2_1; - eval $MASTER_1_CHECK_LINK_STATUS; - eval $MASTER_1_COPY_TABLES_P_2_1; - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - eval $CHILD3_1_SET_OK_STATUS_P_2_1; - eval $CHILD3_1_CHECK_LINK_STATUS; - --connection child3_2 - eval $CHILD3_2_SET_OK_STATUS_P_2_1; - eval $CHILD3_2_CHECK_LINK_STATUS; - --connection child3_3 - eval $CHILD3_3_SET_OK_STATUS_P_2_1; - eval $CHILD3_3_CHECK_LINK_STATUS; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - eval $MASTER_1_SET_OK_STATUS_P_2_1; - eval $MASTER_1_CHECK_LINK_STATUS; - INSERT INTO ta_l2 (a, b, c) VALUES - (8, 'g', '2011-05-05 21:33:30'), - (9, 'h', '2011-05-05 22:32:10'); - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - DROP TABLE ta_l2; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - eval $CHILD2_1_SELECT_TABLES2; - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - --connection child2_3 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_3_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_P_2_1; - --enable_warnings - --connection child3_2 - --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_P_2_1; - --enable_warnings - --connection child3_3 - --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_P_2_1; - --enable_warnings - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } - } -} - -if ($HAVE_PARTITION) -{ - --echo - --echo create table with partition test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_DROP_TABLES2; - echo CHILD2_1_CREATE_TABLES; - echo CHILD2_1_CREATE_TABLES2; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES; - eval $CHILD2_1_DROP_TABLES2; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - eval $CHILD2_1_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_2_DROP_TABLES; - --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_3 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_3_DROP_TABLES; - echo CHILD2_3_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_3_DROP_TABLES; - --enable_warnings - eval $CHILD2_3_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_P_2_1; - --enable_warnings - eval $CHILD3_1_CREATE_TABLES_HA_AS_P_2_1; - --connection child3_2 - --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_P_2_1; - --enable_warnings - eval $CHILD3_2_CREATE_TABLES_HA_AS_P_2_1; - --connection child3_3 - --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_P_2_1; - --enable_warnings - eval $CHILD3_3_CREATE_TABLES_HA_AS_P_2_1; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - --disable_warnings - DROP TABLE IF EXISTS ta_l2; - --enable_warnings - --disable_query_log - echo CREATE TABLE ta_l2 ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_P_2_1; - eval CREATE TABLE ta_l2 ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_AS_P_2_1; - --enable_query_log - INSERT INTO ta_l2 (a, b, c) VALUES - (1, 'a', '2008-08-01 10:21:39'), - (2, 'b', '2000-01-01 00:00:00'), - (3, 'e', '2007-06-04 20:03:11'), - (4, 'd', '2003-11-30 05:01:03'), - (5, 'c', '2001-12-31 23:59:59'); - - --echo - --echo select test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_3 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - eval $CHILD2_1_SELECT_TABLES2; - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - --connection child2_3 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_3_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - - --echo - --echo fail-over test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_HA_AS_DROP_TABLES2; - } - --disable_warnings - eval $CHILD2_1_HA_AS_DROP_TABLES2; - --enable_warnings - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_3 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - eval $MASTER_1_CHECK_HA_STATUS; - --error 12511 - INSERT INTO ta_l2 (a, b, c) VALUES - (6, 'e', '2011-05-05 20:04:05'); - eval $MASTER_1_CHECK_LINK_STATUS; - eval $MASTER_1_CHECK_LINK_FAILED_LOG; - eval $MASTER_1_CHECK_HA_STATUS; - INSERT INTO ta_l2 (a, b, c) VALUES - (6, 'e', '2011-05-05 20:04:05'); - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - --connection child2_3 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_3_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - eval $CHILD3_1_CHECK_LINK_STATUS; - eval $CHILD3_1_CHECK_LINK_FAILED_LOG; - --connection child3_2 - eval $CHILD3_2_CHECK_LINK_STATUS; - eval $CHILD3_2_CHECK_LINK_FAILED_LOG; - --connection child3_3 - eval $CHILD3_3_CHECK_LINK_STATUS; - eval $CHILD3_3_CHECK_LINK_FAILED_LOG; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } - } - - --echo - --echo recovery test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_HA_AS_CREATE_TABLES2; - } - eval $CHILD2_1_HA_AS_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_3 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - eval $CHILD3_1_SET_OK_STATUS_AS_P_2_1; - eval $CHILD3_1_CHECK_LINK_STATUS; - --connection child3_2 - eval $CHILD3_2_SET_OK_STATUS_AS_P_2_1; - eval $CHILD3_2_CHECK_LINK_STATUS; - --connection child3_3 - eval $CHILD3_3_SET_OK_STATUS_AS_P_2_1; - eval $CHILD3_3_CHECK_LINK_STATUS; - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - eval $MASTER_1_SET_OK_STATUS_AS_P_2_1; - eval $MASTER_1_CHECK_LINK_STATUS; - INSERT INTO ta_l2 (a, b, c) VALUES - (8, 'g', '2011-05-05 21:33:30'), - (9, 'h', '2011-05-05 22:32:10'); - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - DROP TABLE ta_l2; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - eval $CHILD2_1_SELECT_TABLES2; - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - --connection child2_3 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_3_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { - --disable_query_log - --disable_result_log - } - --connection child3_1 - --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_P_2_1; - --enable_warnings - --connection child3_2 - --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_P_2_1; - --enable_warnings - --connection child3_3 - --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_P_2_1; - --enable_warnings - if (!$OUTPUT_CHILD_GROUP3) - { - --enable_query_log - --enable_result_log - } - } -} - ---echo ---echo deinit ---disable_warnings ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - --connection child2_3 - DROP DATABASE IF EXISTS auto_test_remote3; -} -if ($USE_CHILD_GROUP3) -{ - --connection child3_1 - DROP DATABASE IF EXISTS auto_test_local; - --connection child3_2 - DROP DATABASE IF EXISTS auto_test_local; - --connection child3_3 - DROP DATABASE IF EXISTS auto_test_local; -} ---disable_query_log ---disable_result_log ---source ha_test_deinit.inc ---source test_deinit.inc ---enable_result_log ---enable_query_log ---enable_warnings -} ---echo ---echo end of test diff --git a/storage/spider/mysql-test/spider/oracle2/t/ha_test_deinit.inc b/storage/spider/mysql-test/spider/oracle2/t/ha_test_deinit.inc deleted file mode 100644 index 53d0409d066..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/ha_test_deinit.inc +++ /dev/null @@ -1,30 +0,0 @@ -# get connection and exist engine test ---echo for master_1 ---connection master_1 ---source ../include/ha_deinit_master_1.inc ---echo for child2 -if ($USE_CHILD_GROUP2) -{ - --echo child2_1 - --connection child2_1 - --source ../include/ha_deinit_child2_1.inc - --echo child2_2 - --connection child2_2 - --source ../include/ha_deinit_child2_2.inc - --echo child2_3 - --connection child2_3 - --source ../include/ha_deinit_child2_3.inc -} ---echo for child3 -if ($USE_CHILD_GROUP3) -{ - --echo child3_1 - --connection child3_1 - --source ../include/ha_deinit_child3_1.inc - --echo child3_2 - --connection child3_2 - --source ../include/ha_deinit_child3_2.inc - --echo child3_3 - --connection child3_3 - --source ../include/ha_deinit_child3_3.inc -} diff --git a/storage/spider/mysql-test/spider/oracle2/t/ha_test_init.inc b/storage/spider/mysql-test/spider/oracle2/t/ha_test_init.inc deleted file mode 100644 index 70576ab16dc..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/ha_test_init.inc +++ /dev/null @@ -1,30 +0,0 @@ -# get connection and exist engine test ---echo for master_1 ---connection master_1 ---source ../include/ha_init_master_1.inc ---echo for child2 -if ($USE_CHILD_GROUP2) -{ - --echo child2_1 - --connection child2_1 - --source ../include/ha_init_child2_1.inc - --echo child2_2 - --connection child2_2 - --source ../include/ha_init_child2_2.inc - --echo child2_3 - --connection child2_3 - --source ../include/ha_init_child2_3.inc -} ---echo for child3 -if ($USE_CHILD_GROUP3) -{ - --echo child3_1 - --connection child3_1 - --source ../include/ha_init_child3_1.inc - --echo child3_2 - --connection child3_2 - --source ../include/ha_init_child3_2.inc - --echo child3_3 - --connection child3_3 - --source ../include/ha_init_child3_3.inc -} diff --git a/storage/spider/mysql-test/spider/oracle2/t/have_engine.inc b/storage/spider/mysql-test/spider/oracle2/t/have_engine.inc deleted file mode 100644 index 64bef7499cb..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/have_engine.inc +++ /dev/null @@ -1,7 +0,0 @@ -if (!`SELECT count(*) FROM information_schema.engines WHERE - (support = 'YES' OR support = 'DEFAULT') AND - engine = '$TEST_ENGINE_TYPE'`) -{ - SELECT engine, support FROM information_schema.engines; - --let $SKIP_REASON= "Need $TEST_ENGINE_TYPE engine" -} diff --git a/storage/spider/mysql-test/spider/oracle2/t/have_func.inc b/storage/spider/mysql-test/spider/oracle2/t/have_func.inc deleted file mode 100644 index e0823e73fc8..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/have_func.inc +++ /dev/null @@ -1,5 +0,0 @@ -if (!`SELECT count(*) FROM mysql.func WHERE name = '$TEST_FUNC_NAME'`) -{ - SELECT name FROM mysql.func; - --let $SKIP_REASON= "Need $TEST_FUNC_NAME function" -} diff --git a/storage/spider/mysql-test/spider/oracle2/t/have_partition.inc b/storage/spider/mysql-test/spider/oracle2/t/have_partition.inc deleted file mode 100644 index b6e699475db..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/have_partition.inc +++ /dev/null @@ -1,7 +0,0 @@ -let $HAVE_PARTITION= 0; -if (`SELECT count(*) FROM information_schema.plugins WHERE - plugin_status = 'ACTIVE' AND - plugin_name = 'partition'`) -{ - let $HAVE_PARTITION= 1; -} diff --git a/storage/spider/mysql-test/spider/oracle2/t/have_trigger.inc b/storage/spider/mysql-test/spider/oracle2/t/have_trigger.inc deleted file mode 100644 index 32de484b388..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/have_trigger.inc +++ /dev/null @@ -1,2 +0,0 @@ -let $HAVE_TRIGGER= `SELECT COUNT(*) FROM information_schema.tables - WHERE TABLE_SCHEMA = 'information_schema' AND TABLE_NAME = 'TRIGGERS'`; diff --git a/storage/spider/mysql-test/spider/oracle2/t/hs_test_deinit.inc b/storage/spider/mysql-test/spider/oracle2/t/hs_test_deinit.inc deleted file mode 100644 index 7ec2e981fd2..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/hs_test_deinit.inc +++ /dev/null @@ -1,17 +0,0 @@ -# get connection and exist engine test ---echo for master_1 ---connection master_1 ---source ../include/hs_deinit_master_1.inc ---echo for child2 -if ($USE_CHILD_GROUP2) -{ - --echo child2_1 - --connection child2_1 - --source ../include/hs_deinit_child2_1.inc - --echo child2_2 - --connection child2_2 - --source ../include/hs_deinit_child2_2.inc - --echo child2_3 - --connection child2_3 - --source ../include/hs_deinit_child2_3.inc -} diff --git a/storage/spider/mysql-test/spider/oracle2/t/hs_test_init.inc b/storage/spider/mysql-test/spider/oracle2/t/hs_test_init.inc deleted file mode 100644 index 831bf479524..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/hs_test_init.inc +++ /dev/null @@ -1,17 +0,0 @@ -# get connection and exist engine test ---echo for master_1 ---connection master_1 ---source ../include/hs_init_master_1.inc ---echo for child2 -if ($USE_CHILD_GROUP2) -{ - --echo child2_1 - --connection child2_1 - --source ../include/hs_init_child2_1.inc - --echo child2_2 - --connection child2_2 - --source ../include/hs_init_child2_2.inc - --echo child2_3 - --connection child2_3 - --source ../include/hs_init_child2_3.inc -} diff --git a/storage/spider/mysql-test/spider/oracle2/t/slave_test_deinit.inc b/storage/spider/mysql-test/spider/oracle2/t/slave_test_deinit.inc deleted file mode 100644 index e9d99b7a960..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/slave_test_deinit.inc +++ /dev/null @@ -1,6 +0,0 @@ -# get connection and exist engine test ---echo for slave1_1 ---connection slave1_1 -STOP SLAVE; ---source ../include/deinit_slave1_1.inc ---disconnect slave1_1 diff --git a/storage/spider/mysql-test/spider/oracle2/t/slave_test_init.inc b/storage/spider/mysql-test/spider/oracle2/t/slave_test_init.inc deleted file mode 100644 index 739d88970c5..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/slave_test_init.inc +++ /dev/null @@ -1,44 +0,0 @@ -# get connection and exist engine test ---echo for slave1_1 ---source connect_slave1_1.inc ---connection slave1_1 -SET SESSION sql_log_bin= 0; ---let $SLAVE1_1_SERVER_ID=`SELECT @@global.server_id` ---let $TEST_ENGINE_TYPE= $SLAVE1_1_ENGINE_TYPE ---source have_partition.inc ---source have_trigger.inc ---source ../include/init_slave1_1.inc ---source have_engine.inc ---let $SLAVE1_1_SLAVE_STATUS=`SHOW SLAVE STATUS` -if (!$SLAVE1_1_SLAVE_STATUS) -{ - eval CHANGE MASTER TO - MASTER_HOST = '127.0.0.1', - MASTER_USER = 'root', - MASTER_PASSWORD = '', - MASTER_PORT = $MASTER_1_MYPORT - ; -} -START SLAVE; ---connection master_1 -call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); ---connection slave1_1 -call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); - --connection child2_2 - call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); - --connection child2_3 - call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); -} -if ($USE_CHILD_GROUP3) -{ - --connection child3_1 - call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); - --connection child3_2 - call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); - --connection child3_3 - call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); -} diff --git a/storage/spider/mysql-test/spider/oracle2/t/spider3_fixes.test b/storage/spider/mysql-test/spider/oracle2/t/spider3_fixes.test deleted file mode 100644 index 13fa6f5fa39..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/spider3_fixes.test +++ /dev/null @@ -1,292 +0,0 @@ -# This test tests for Spider 3.0's bug fixes -source include/have_log_bin.inc; ---disable_warnings ---disable_query_log ---disable_result_log ---source test_init.inc ---source slave_test_init.inc ---enable_result_log ---enable_query_log - ---echo ---echo drop and create databases ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -if ($USE_REPLICATION) -{ - --connection slave1_1 - DROP DATABASE IF EXISTS auto_test_local; - CREATE DATABASE auto_test_local; - USE auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - CREATE DATABASE auto_test_remote; - USE auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - CREATE DATABASE auto_test_remote2; - USE auto_test_remote2; -} ---enable_warnings - ---echo ---echo test select 1 ---connection master_1 -SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - SELECT 1; - --connection child2_2 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - - ---echo ---echo 3.1 ---echo auto_increment -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_INCREMENT_TABLES1; - echo CHILD2_1_CREATE_INCREMENT_TABLES1; - echo CHILD2_1_AUTO_INCREMENT_INCREMENT2; - echo CHILD2_1_AUTO_INCREMENT_OFFSET2; - } - --disable_warnings - eval $CHILD2_1_DROP_INCREMENT_TABLES1; - --enable_warnings - eval $CHILD2_1_CREATE_INCREMENT_TABLES1; - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -if ($USE_REPLICATION) -{ - save_master_pos; - --connection slave1_1 - sync_with_master; - --connection master_1 - --disable_query_log - SET SESSION sql_log_bin= 0; - --enable_query_log -} ---disable_warnings -DROP TABLE IF EXISTS t1, t2; ---enable_warnings ---disable_query_log -echo CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1; -echo CREATE TABLE t2 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1; -echo MASTER_1_AUTO_INCREMENT_INCREMENT2; -echo MASTER_1_AUTO_INCREMENT_OFFSET2; -eval CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1; -eval CREATE TABLE t2 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1; -eval $MASTER_1_AUTO_INCREMENT_INCREMENT2; -eval $MASTER_1_AUTO_INCREMENT_OFFSET2; -if ($USE_REPLICATION) -{ - SET SESSION sql_log_bin= 1; - --connection slave1_1 - --disable_warnings - DROP TABLE IF EXISTS t1, t2; - --enable_warnings - echo CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1; - echo CREATE TABLE t2 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1; - eval CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1; - eval CREATE TABLE t2 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1; - --connection master_1 -} ---enable_query_log -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -SELECT MAX(id) FROM t1; -INSERT INTO t2 () VALUES (); -SELECT LAST_INSERT_ID(); -SELECT MAX(id) FROM t2; ---disable_query_log -echo MASTER_1_AUTO_INCREMENT_OFFSET3; -eval $MASTER_1_AUTO_INCREMENT_OFFSET3; ---enable_query_log -INSERT INTO t1 (id) VALUES (null); -SELECT LAST_INSERT_ID(); -SELECT MAX(id) FROM t1; ---disable_query_log -echo MASTER_1_AUTO_INCREMENT_OFFSET4; -eval $MASTER_1_AUTO_INCREMENT_OFFSET4; ---enable_query_log -INSERT INTO t2 (id) VALUES (null); -SELECT LAST_INSERT_ID(); -SELECT MAX(id) FROM t2; ---disable_query_log -echo MASTER_1_AUTO_INCREMENT_OFFSET3; -eval $MASTER_1_AUTO_INCREMENT_OFFSET3; ---enable_query_log -INSERT INTO t1 () VALUES (),(),(),(); -SELECT LAST_INSERT_ID(); -SELECT id FROM t1 ORDER BY id; ---disable_query_log -echo MASTER_1_AUTO_INCREMENT_OFFSET4; -eval $MASTER_1_AUTO_INCREMENT_OFFSET4; ---enable_query_log -INSERT INTO t2 () VALUES (),(),(),(); -SELECT LAST_INSERT_ID(); -SELECT id FROM t2 ORDER BY id; -TRUNCATE TABLE t1; -TRUNCATE TABLE t2; -INSERT INTO t1 () VALUES (),(),(),(); -SELECT LAST_INSERT_ID(); -SELECT id FROM t1 ORDER BY id; -INSERT INTO t2 () VALUES (),(),(),(); -SELECT LAST_INSERT_ID(); -SELECT id FROM t2 ORDER BY id; -SET INSERT_ID=5000; ---disable_query_log -echo MASTER_1_AUTO_INCREMENT_OFFSET3; -eval $MASTER_1_AUTO_INCREMENT_OFFSET3; ---enable_query_log -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -SELECT MAX(id) FROM t1; ---disable_query_log -echo MASTER_1_AUTO_INCREMENT_OFFSET4; -eval $MASTER_1_AUTO_INCREMENT_OFFSET4; ---enable_query_log -INSERT INTO t2 () VALUES (); -SELECT LAST_INSERT_ID(); -SELECT MAX(id) FROM t2; -INSERT INTO t1 (id) VALUES (10000); -SELECT LAST_INSERT_ID(); -SELECT MAX(id) FROM t1; -INSERT INTO t2 (id) VALUES (1000); -SELECT LAST_INSERT_ID(); -SELECT MAX(id) FROM t2; -if ($USE_REPLICATION) -{ - save_master_pos; - --connection slave1_1 - sync_with_master; - SELECT id FROM t1 ORDER BY id; - --connection master_1 - --disable_query_log - SET SESSION sql_log_bin= 0; - --enable_query_log -} -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_INCREMENT_TABLES1; - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_AUTO_INCREMENT_INCREMENT1; - echo CHILD2_1_AUTO_INCREMENT_OFFSET1; - } - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET1; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - - ---echo ---echo deinit ---disable_warnings ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -if ($USE_REPLICATION) -{ - --connection slave1_1 - DROP DATABASE IF EXISTS auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; -} ---disable_query_log ---disable_result_log ---source slave_test_deinit.inc ---source test_deinit.inc ---enable_result_log ---enable_query_log ---enable_warnings ---echo ---echo end of test diff --git a/storage/spider/mysql-test/spider/oracle2/t/spider3_fixes_part.test b/storage/spider/mysql-test/spider/oracle2/t/spider3_fixes_part.test deleted file mode 100644 index 3288c490a46..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/spider3_fixes_part.test +++ /dev/null @@ -1,345 +0,0 @@ -# This test tests for Spider 3.0's bug fixes -source include/have_log_bin.inc; ---disable_warnings ---disable_query_log ---disable_result_log ---source test_init.inc ---source slave_test_init.inc ---enable_result_log ---enable_query_log -if (!$HAVE_PARTITION) -{ - --disable_query_log - --disable_result_log - --source slave_test_deinit.inc - --source test_deinit.inc - --enable_result_log - --enable_query_log - --enable_warnings - skip Test requires partitioning; -} - ---echo ---echo drop and create databases ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -if ($USE_REPLICATION) -{ - --connection slave1_1 - DROP DATABASE IF EXISTS auto_test_local; - CREATE DATABASE auto_test_local; - USE auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - CREATE DATABASE auto_test_remote; - USE auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - CREATE DATABASE auto_test_remote2; - USE auto_test_remote2; -} ---enable_warnings - ---echo ---echo test select 1 ---connection master_1 -SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - SELECT 1; - --connection child2_2 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - - ---echo auto_increment with partition -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_INCREMENT_TABLES1; - echo CHILD2_1_CREATE_INCREMENT_TABLES1; - echo CHILD2_1_AUTO_INCREMENT_INCREMENT2; - echo CHILD2_1_AUTO_INCREMENT_OFFSET2; - } - --disable_warnings - eval $CHILD2_1_DROP_INCREMENT_TABLES1; - --enable_warnings - eval $CHILD2_1_CREATE_INCREMENT_TABLES1; - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_INCREMENT_TABLES1; - echo CHILD2_2_CREATE_INCREMENT_TABLES1; - echo CHILD2_2_AUTO_INCREMENT_INCREMENT2; - echo CHILD2_2_AUTO_INCREMENT_OFFSET2; - } - --disable_warnings - eval $CHILD2_2_DROP_INCREMENT_TABLES1; - --enable_warnings - eval $CHILD2_2_CREATE_INCREMENT_TABLES1; - eval $CHILD2_2_AUTO_INCREMENT_INCREMENT2; - eval $CHILD2_2_AUTO_INCREMENT_OFFSET2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - if ($USE_REPLICATION) - { - save_master_pos; - --connection slave1_1 - sync_with_master; - --connection master_1 - --disable_query_log - SET SESSION sql_log_bin= 0; - --enable_query_log - } - --disable_warnings - DROP TABLE IF EXISTS t1, t2; - --enable_warnings - --disable_query_log - echo CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1; - echo CREATE TABLE t2 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1; - echo MASTER_1_AUTO_INCREMENT_INCREMENT2; - echo MASTER_1_AUTO_INCREMENT_OFFSET2; - eval CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1; - eval CREATE TABLE t2 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1; - eval $MASTER_1_AUTO_INCREMENT_INCREMENT2; - eval $MASTER_1_AUTO_INCREMENT_OFFSET2; - if ($USE_REPLICATION) - { - SET SESSION sql_log_bin= 1; - --connection slave1_1 - --disable_warnings - DROP TABLE IF EXISTS t1, t2; - --enable_warnings - echo CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1; - echo CREATE TABLE t2 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1; - eval CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1; - eval CREATE TABLE t2 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1; - --connection master_1 - } - --enable_query_log - INSERT INTO t1 () VALUES (); - SELECT LAST_INSERT_ID(); - SELECT MAX(id) FROM t1; - INSERT INTO t2 () VALUES (); - SELECT LAST_INSERT_ID(); - SELECT MAX(id) FROM t2; - --disable_query_log - echo MASTER_1_AUTO_INCREMENT_OFFSET3; - eval $MASTER_1_AUTO_INCREMENT_OFFSET3; - --enable_query_log - INSERT INTO t1 (id) VALUES (null); - SELECT LAST_INSERT_ID(); - SELECT MAX(id) FROM t1; - --disable_query_log - echo MASTER_1_AUTO_INCREMENT_OFFSET4; - eval $MASTER_1_AUTO_INCREMENT_OFFSET4; - --enable_query_log - INSERT INTO t2 (id) VALUES (null); - SELECT LAST_INSERT_ID(); - SELECT MAX(id) FROM t2; - --disable_query_log - echo MASTER_1_AUTO_INCREMENT_OFFSET3; - eval $MASTER_1_AUTO_INCREMENT_OFFSET3; - --enable_query_log - INSERT INTO t1 () VALUES (),(),(),(); - SELECT LAST_INSERT_ID(); - SELECT id FROM t1 ORDER BY id; - --disable_query_log - echo MASTER_1_AUTO_INCREMENT_OFFSET4; - eval $MASTER_1_AUTO_INCREMENT_OFFSET4; - --enable_query_log - INSERT INTO t2 () VALUES (),(),(),(); - SELECT LAST_INSERT_ID(); - SELECT id FROM t2 ORDER BY id; - TRUNCATE TABLE t1; - TRUNCATE TABLE t2; - INSERT INTO t1 () VALUES (),(),(),(); - SELECT LAST_INSERT_ID(); - SELECT id FROM t1 ORDER BY id; - INSERT INTO t2 () VALUES (),(),(),(); - SELECT LAST_INSERT_ID(); - SELECT id FROM t2 ORDER BY id; - SET INSERT_ID=5000; - --disable_query_log - echo MASTER_1_AUTO_INCREMENT_OFFSET3; - eval $MASTER_1_AUTO_INCREMENT_OFFSET3; - --enable_query_log - INSERT INTO t1 () VALUES (); - SELECT LAST_INSERT_ID(); - SELECT MAX(id) FROM t1; - --disable_query_log - echo MASTER_1_AUTO_INCREMENT_OFFSET4; - eval $MASTER_1_AUTO_INCREMENT_OFFSET4; - --enable_query_log - INSERT INTO t2 () VALUES (); - SELECT LAST_INSERT_ID(); - SELECT MAX(id) FROM t2; - INSERT INTO t1 (id) VALUES (10000); - SELECT LAST_INSERT_ID(); - SELECT MAX(id) FROM t1; - INSERT INTO t2 (id) VALUES (1000); - SELECT LAST_INSERT_ID(); - SELECT MAX(id) FROM t2; - if ($USE_REPLICATION) - { - save_master_pos; - --connection slave1_1 - sync_with_master; - SELECT id FROM t1 ORDER BY id; - --connection master_1 - --disable_query_log - SET SESSION sql_log_bin= 0; - --enable_query_log - } - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_INCREMENT_TABLES1; - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_AUTO_INCREMENT_INCREMENT1; - echo CHILD2_1_AUTO_INCREMENT_OFFSET1; - } - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET1; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - } - eval $CHILD2_2_SELECT_INCREMENT_TABLES1; - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_AUTO_INCREMENT_INCREMENT1; - echo CHILD2_2_AUTO_INCREMENT_OFFSET1; - } - eval $CHILD2_2_AUTO_INCREMENT_INCREMENT1; - eval $CHILD2_2_AUTO_INCREMENT_OFFSET1; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } -} - - ---echo ---echo deinit ---disable_warnings ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -if ($USE_REPLICATION) -{ - --connection slave1_1 - DROP DATABASE IF EXISTS auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; -} ---disable_query_log ---disable_result_log ---source slave_test_deinit.inc ---source test_deinit.inc ---enable_result_log ---enable_query_log ---enable_warnings ---echo ---echo end of test diff --git a/storage/spider/mysql-test/spider/oracle2/t/spider_fixes.test b/storage/spider/mysql-test/spider/oracle2/t/spider_fixes.test deleted file mode 100644 index cfca9a04e6b..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/spider_fixes.test +++ /dev/null @@ -1,1425 +0,0 @@ -# This test tests for Spider's bug fixes -source include/have_log_bin.inc; ---disable_warnings ---disable_query_log ---disable_result_log ---source test_init.inc ---source slave_test_init.inc ---enable_result_log ---enable_query_log - ---echo ---echo drop and create databases ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -if ($USE_REPLICATION) -{ - --connection slave1_1 - DROP DATABASE IF EXISTS auto_test_local; - CREATE DATABASE auto_test_local; - USE auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - CREATE DATABASE auto_test_remote; - USE auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - CREATE DATABASE auto_test_remote2; - USE auto_test_remote2; -} ---enable_warnings - ---echo ---echo test select 1 ---connection master_1 -SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - SELECT 1; - --connection child2_2 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo create table and insert -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS tb_l; ---enable_warnings ---disable_query_log -echo CREATE TABLE tb_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) MASTER_1_ENGINE2 MASTER_1_CHARSET2; -eval CREATE TABLE tb_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; ---enable_query_log -INSERT INTO tb_l (a, b, c) VALUES - (1, 'a', '2008-08-01 10:21:39'), - (2, 'b', '2000-01-01 00:00:00'), - (3, 'e', '2007-06-04 20:03:11'), - (4, 'd', '2003-11-30 05:01:03'), - (5, 'c', '2001-12-31 23:59:59'); ---disable_warnings -DROP TABLE IF EXISTS ta_l; ---enable_warnings ---disable_query_log -echo CREATE TABLE ta_l ( - PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; ---enable_query_log -INSERT INTO ta_l SELECT a, b, c FROM tb_l; - ---echo ---echo 2.13 ---echo select table with "order by desc" and "<" -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_ps2_protocol -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -WHERE a < 5 ORDER BY a DESC LIMIT 3; ---enable_ps2_protocol -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo select table with "order by desc" and "<=" -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_ps2_protocol -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -WHERE a <= 5 ORDER BY a DESC LIMIT 3; ---enable_ps2_protocol -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo 2.14 ---echo update table with range scan and split_read -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -UPDATE ta_l SET c = '2000-02-02 00:00:00' WHERE a > 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; - ---echo ---echo 2.15 ---echo select table with range scan -TRUNCATE TABLE ta_l; ---disable_warnings -DROP TABLE IF EXISTS ta_l; ---enable_warnings -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES6; - echo CHILD2_1_CREATE_TABLES6; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES6; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES6; - --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_result_log - } -} ---connection master_1 ---disable_query_log -echo CREATE TABLE ta_l ( - a int(11) NOT NULL DEFAULT '0', - b char(1) DEFAULT NULL, - c datetime DEFAULT NULL, - PRIMARY KEY (a, b, c) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1; -eval CREATE TABLE ta_l ( - a int(11) NOT NULL DEFAULT '0', - b char(1) DEFAULT NULL, - c datetime DEFAULT NULL, - PRIMARY KEY (a, b, c) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1; ---enable_query_log -INSERT INTO ta_l SELECT a, b, c FROM tb_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b' -AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b' -AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a >= 4 AND b = 'd' -AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a > 4 AND b = 'c' -AND c = '2001-12-31 23:59:59'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b <= 'd' -AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b < 'e' -AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND b = 'b' -AND c = '2000-01-01 00:00:00'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND b = 'b' -AND c = '2000-01-01 00:00:00'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b' -AND b <= 'd' AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b' -AND b < 'e' AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND a >= 1 -AND b >= 'b' AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND a > 1 -AND b >= 'b' AND c = '2000-01-01 00:00:00'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo 2.16 ---echo auto_increment insert with trigger -if ($HAVE_TRIGGER) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_result_log - } - --disable_query_log - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_1_DROP_TABLES4; - echo CHILD2_1_CREATE_TABLES4; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES4; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES4; - --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_result_log - } - } - --connection master_1 - --disable_query_log - echo CREATE TABLE ta_l_auto_inc ( - a INT AUTO_INCREMENT, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1; - eval CREATE TABLE ta_l_auto_inc ( - a INT AUTO_INCREMENT, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1; - echo CREATE TABLE tc_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) MASTER_1_ENGINE2 MASTER_1_CHARSET2; - eval CREATE TABLE tc_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; - --enable_query_log - --eval CREATE TRIGGER ins_ta_l_auto_inc AFTER INSERT ON ta_l_auto_inc FOR EACH ROW BEGIN INSERT INTO tc_l (a, b, c) VALUES (NEW.a, NEW.b, NEW.c); END; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - INSERT INTO ta_l_auto_inc (a, b, c) VALUES - (NULL, 's', '2008-12-31 20:59:59'); - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_TABLES4; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM tc_l ORDER BY a; -} - ---echo ---echo 2.17 ---echo engine-condition-pushdown with "or" and joining -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l WHERE a = 1 OR a IN (SELECT a FROM tb_l); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo 2.23 ---echo index merge -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_result_log - } - --disable_query_log - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_1_DROP_TABLES5; - echo CHILD2_1_CREATE_TABLES5; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES5; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES5; - --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_result_log - } -} ---connection master_1 ---disable_query_log -echo CREATE TABLE ta_l_int ( - a INT AUTO_INCREMENT, - b INT DEFAULT 10, - c INT DEFAULT 11, - PRIMARY KEY(a), - KEY idx1(b), - KEY idx2(c) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1; -eval CREATE TABLE ta_l_int ( - a INT AUTO_INCREMENT, - b INT DEFAULT 10, - c INT DEFAULT 11, - PRIMARY KEY(a), - KEY idx1(b), - KEY idx2(c) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; ---enable_query_log -INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3); -INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int; -INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int; -INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int; -INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2) -WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo 2.24 ---echo index scan update without PK ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS ta_l_int; ---enable_warnings ---disable_query_log -echo CREATE TABLE ta_l_int ( - a INT NOT NULL, - b INT DEFAULT 10, - c INT DEFAULT 11, - KEY idx1(b), - KEY idx2(c) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1; -if ($MASTER_1_NEEDPK) -{ - --error ER_REQUIRES_PRIMARY_KEY - eval CREATE TABLE ta_l_int ( - a INT NOT NULL, - b INT DEFAULT 10, - c INT DEFAULT 11, - KEY idx1(b), - KEY idx2(c) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; - eval CREATE TABLE ta_l_int ( - a INT NOT NULL, - b INT DEFAULT 10, - c INT DEFAULT 11, - PRIMARY KEY(a), - KEY idx1(b), - KEY idx2(c) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; -} -if (!$MASTER_1_NEEDPK) -{ - eval CREATE TABLE ta_l_int ( - a INT NOT NULL, - b INT DEFAULT 10, - c INT DEFAULT 11, - KEY idx1(b), - KEY idx2(c) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; -} ---enable_query_log -SELECT a, b, c FROM ta_l_int ORDER BY a; -INSERT INTO ta_l_int (a, b, c) VALUES (0, 2, 3); -INSERT INTO ta_l_int (a, b, c) VALUES (18, 2, 3); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -UPDATE ta_l_int SET c = 4 WHERE b = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE '%update %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT a, b, c FROM ta_l_int ORDER BY a; - - ---echo ---echo 2.25 ---echo direct order limit ---connection master_1 -eval $MASTER_1_CHECK_DIRECT_ORDER_LIMIT_STATUS; ---disable_ps2_protocol -SELECT a, b, c FROM ta_l_int ORDER BY a LIMIT 3; ---enable_ps2_protocol -eval $MASTER_1_CHECK_DIRECT_ORDER_LIMIT_STATUS; - - ---echo ---echo 2.26 ---echo lock tables -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_LOCK_TABLES1; - echo CHILD2_1_DROP_LOCK_TABLES2; - echo CHILD2_1_CREATE_LOCK_TABLES1; - echo CHILD2_1_CREATE_LOCK_TABLES2; - } - --disable_warnings - eval $CHILD2_1_DROP_LOCK_TABLES1; - eval $CHILD2_1_DROP_LOCK_TABLES2; - --enable_warnings - eval $CHILD2_1_CREATE_LOCK_TABLES1; - eval $CHILD2_1_CREATE_LOCK_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_LOCK_TABLES1; - echo CHILD2_2_DROP_LOCK_TABLES2; - echo CHILD2_2_CREATE_LOCK_TABLES1; - echo CHILD2_2_CREATE_LOCK_TABLES2; - } - --disable_warnings - eval $CHILD2_2_DROP_LOCK_TABLES1; - eval $CHILD2_2_DROP_LOCK_TABLES2; - --enable_warnings - eval $CHILD2_2_CREATE_LOCK_TABLES1; - eval $CHILD2_2_CREATE_LOCK_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS t1; -DROP TABLE IF EXISTS t2; ---enable_warnings ---disable_query_log -echo CREATE TABLE t1 ( - id int(11) NOT NULL, - PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK1; -eval CREATE TABLE t1 ( - id int(11) NOT NULL, - PRIMARY KEY (id) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_LOCK1; -echo CREATE TABLE t2 ( - id int(11) NOT NULL, - PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK2; -eval CREATE TABLE t2 ( - id int(11) NOT NULL, - PRIMARY KEY (id) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_LOCK2; ---enable_query_log -LOCK TABLES t1 READ, t2 READ; -UNLOCK TABLES; - - ---echo ---echo auto_increment -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_INCREMENT_TABLES1; - echo CHILD2_1_CREATE_INCREMENT_TABLES1; - echo CHILD2_1_AUTO_INCREMENT_INCREMENT2; - echo CHILD2_1_AUTO_INCREMENT_OFFSET2; - } - --disable_warnings - eval $CHILD2_1_DROP_INCREMENT_TABLES1; - --enable_warnings - eval $CHILD2_1_CREATE_INCREMENT_TABLES1; - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -if ($USE_REPLICATION) -{ - save_master_pos; - --connection slave1_1 - sync_with_master; - --connection master_1 - --disable_query_log - SET SESSION sql_log_bin= 0; - --enable_query_log -} ---disable_warnings -DROP TABLE IF EXISTS t1; ---enable_warnings ---disable_query_log -echo CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1; -echo MASTER_1_AUTO_INCREMENT_INCREMENT2; -echo MASTER_1_AUTO_INCREMENT_OFFSET2; -eval CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1; -eval $MASTER_1_AUTO_INCREMENT_INCREMENT2; -eval $MASTER_1_AUTO_INCREMENT_OFFSET2; -if ($USE_REPLICATION) -{ - SET SESSION sql_log_bin= 1; - --connection slave1_1 - --disable_warnings - DROP TABLE IF EXISTS t1; - --enable_warnings - echo CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1; - eval CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1; - --connection master_1 -} ---enable_query_log -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -SELECT MAX(id) FROM t1; -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -SELECT MAX(id) FROM t1; -INSERT INTO t1 (id) VALUES (null); -SELECT LAST_INSERT_ID(); -SELECT MAX(id) FROM t1; -INSERT INTO t1 (id) VALUES (null); -SELECT LAST_INSERT_ID(); -SELECT MAX(id) FROM t1; -INSERT INTO t1 () VALUES (),(),(),(); -SELECT LAST_INSERT_ID(); -SELECT id FROM t1 ORDER BY id; -SET INSERT_ID=5000; -INSERT INTO t1 () VALUES (); -SELECT LAST_INSERT_ID(); -SELECT MAX(id) FROM t1; -INSERT INTO t1 (id) VALUES (10000); -SELECT LAST_INSERT_ID(); -SELECT MAX(id) FROM t1; -INSERT INTO t1 (id) VALUES (1000); -SELECT LAST_INSERT_ID(); -SELECT MAX(id) FROM t1; -if ($USE_REPLICATION) -{ - save_master_pos; - --connection slave1_1 - sync_with_master; - SELECT id FROM t1 ORDER BY id; - --connection master_1 - --disable_query_log - SET SESSION sql_log_bin= 0; - --enable_query_log -} -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_INCREMENT_TABLES1; - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_AUTO_INCREMENT_INCREMENT1; - echo CHILD2_1_AUTO_INCREMENT_OFFSET1; - } - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET1; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - - ---echo ---echo read only -let $MASTER_1_ENGINE_IS_SPIDER= - `SELECT IF('$MASTER_1_ENGINE_TYPE' = 'Spider' OR - '$MASTER_1_HIDDEN_ENGINE_TYPE' = 'Spider', 1, 0)`; -if ($MASTER_1_ENGINE_IS_SPIDER) -{ - --connection master_1 - --disable_warnings - DROP TABLE IF EXISTS t1; - --enable_warnings - --disable_query_log - echo CREATE TABLE t1 ( - id int(11) NOT NULL, - PRIMARY KEY (id) - ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_READONLY1_1; - eval CREATE TABLE t1 ( - id int(11) NOT NULL, - PRIMARY KEY (id) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_READONLY1_1; - --let $MIN_VAL= `SELECT MIN(id) FROM t1` - --enable_query_log - SELECT id FROM t1 ORDER BY id; - --error 12518 - INSERT INTO t1 (id) VALUES (1); - --error 12518 - eval UPDATE t1 SET id = 4 WHERE id = $MIN_VAL; - --error 12518 - eval DELETE FROM t1 WHERE id = $MIN_VAL; - --error 12518 - DELETE FROM t1; - --error 12518 - TRUNCATE t1; -} -if (!$MASTER_1_ENGINE_IS_SPIDER) -{ - --echo skipped -} - - ---echo ---echo 2.27 ---echo error mode -if ($MASTER_1_ENGINE_IS_SPIDER) -{ - --connection master_1 - --disable_warnings - DROP TABLE IF EXISTS t1; - --enable_warnings - --disable_query_log - echo CREATE TABLE t1 ( - id int(11) NOT NULL, - PRIMARY KEY (id) - ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_ERROR_MODE1_1; - eval CREATE TABLE t1 ( - id int(11) NOT NULL, - PRIMARY KEY (id) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_ERROR_MODE1_1; - --enable_query_log - SELECT id FROM t1 ORDER BY id; - INSERT INTO t1 (id) VALUES (1); - DELETE FROM t1; - TRUNCATE t1; -} -if (!$MASTER_1_ENGINE_IS_SPIDER) -{ - --echo skipped -} - - ---echo ---echo 3.0 ---echo is null -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_result_log - } - --disable_query_log - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_1_DROP_TEXT_KEY_TABLES1; - echo CHILD2_1_CREATE_TEXT_KEY_TABLES1; - } - --disable_warnings - eval $CHILD2_1_DROP_TEXT_KEY_TABLES1; - --enable_warnings - eval $CHILD2_1_CREATE_TEXT_KEY_TABLES1; - --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_result_log - } -} ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS t1; ---enable_warnings ---disable_query_log -echo CREATE TABLE t1 ( - a VARCHAR(255), - b VARCHAR(255), - c VARCHAR(255), - KEY idx1(a,b), - KEY idx2(b), - PRIMARY KEY(c) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_TEXT_KEY1_1; -eval CREATE TABLE t1 ( - a VARCHAR(255), - b VARCHAR(255), - c VARCHAR(255), - KEY idx1(a,b), - KEY idx2(b), - PRIMARY KEY(c) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_TEXT_KEY1_1; ---enable_query_log -insert into t1 values (null, null, '2048'); -insert into t1 values ('1', '1', '1'); -insert into t1 select a + 1, b + 1, c + 1 from t1; -insert into t1 select a + 2, b + 2, c + 2 from t1; -insert into t1 select a + 4, b + 4, c + 4 from t1; -insert into t1 select a + 8, b + 8, c + 8 from t1; -insert into t1 select a + 16, b + 16, c + 16 from t1; -insert into t1 select a + 32, b + 32, c + 32 from t1; -insert into t1 select a + 64, b + 64, c + 64 from t1; -insert into t1 select a + 128, b + 128, c + 128 from t1; -insert into t1 select a + 256, b + 256, c + 256 from t1; -insert into t1 select a + 512, b + 512, c + 512 from t1; -flush tables; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -select a from t1 where a is null order by a limit 30; -select b from t1 where b is null order by b limit 30; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TEXT_PK_TABLES1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - - ---echo ---echo direct_order_limit ---connection master_1 -TRUNCATE TABLE t1; -insert into t1 values ('1', '1', '1'); -insert into t1 select a + 1, b + 1, c + 1 from t1; -insert into t1 select a + 2, b + 2, c + 2 from t1; -insert into t1 select a + 4, b + 4, c + 4 from t1; -insert into t1 select a + 8, b + 8, c + 8 from t1; -insert into t1 select a + 16, b + 16, c + 16 from t1; -insert into t1 select a, b + 32, c + 32 from t1; -insert into t1 select a, b + 64, c + 64 from t1; -insert into t1 select a, b + 128, c + 128 from t1; -flush tables; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -select a, b, c from t1 where a = '10' and b <> '100' order by c desc limit 5; -select a, c from t1 where a = '10' order by b desc limit 5; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TEXT_PK_TABLES1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - - ---echo ---echo deinit ---disable_warnings ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -if ($USE_REPLICATION) -{ - --connection slave1_1 - DROP DATABASE IF EXISTS auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; -} ---disable_query_log ---disable_result_log ---source slave_test_deinit.inc ---source test_deinit.inc ---enable_result_log ---enable_query_log ---enable_warnings ---echo ---echo end of test diff --git a/storage/spider/mysql-test/spider/oracle2/t/spider_fixes_part.test b/storage/spider/mysql-test/spider/oracle2/t/spider_fixes_part.test deleted file mode 100644 index ef5a8026c02..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/spider_fixes_part.test +++ /dev/null @@ -1,645 +0,0 @@ -# This test tests for Spider's bug fixes -source include/have_log_bin.inc; ---disable_warnings ---disable_query_log ---disable_result_log ---source test_init.inc ---source slave_test_init.inc ---enable_result_log ---enable_query_log -if (!$HAVE_PARTITION) -{ - --disable_query_log - --disable_result_log - --source slave_test_deinit.inc - --source test_deinit.inc - --enable_result_log - --enable_query_log - --enable_warnings - skip Test requires partitioning; -} - ---echo ---echo drop and create databases ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -if ($USE_REPLICATION) -{ - --connection slave1_1 - DROP DATABASE IF EXISTS auto_test_local; - CREATE DATABASE auto_test_local; - USE auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - CREATE DATABASE auto_test_remote; - USE auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - CREATE DATABASE auto_test_remote2; - USE auto_test_remote2; -} ---enable_warnings - ---echo ---echo test select 1 ---connection master_1 -SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - SELECT 1; - --connection child2_2 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS tb_l; ---enable_warnings ---disable_query_log -echo CREATE TABLE tb_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) MASTER_1_ENGINE2 MASTER_1_CHARSET2; -eval CREATE TABLE tb_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; ---enable_query_log -INSERT INTO tb_l (a, b, c) VALUES - (1, 'a', '2008-08-01 10:21:39'), - (2, 'b', '2000-01-01 00:00:00'), - (3, 'e', '2007-06-04 20:03:11'), - (4, 'd', '2003-11-30 05:01:03'), - (5, 'c', '2001-12-31 23:59:59'); - ---echo ---echo 2.17 ---echo partition with sort -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_2_DROP_TABLES; - --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES2; - echo CHILD2_1_CREATE_TABLES2; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES2; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - --disable_query_log - echo CREATE TABLE ta_l2 ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1; - eval CREATE TABLE ta_l2 ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1; - --enable_query_log - INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 WHERE a > 1 - ORDER BY a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } -} - ---echo ---echo 2.23 ---echo partition update with moving partition -if ($HAVE_PARTITION) -{ - --connection master_1 - --disable_warnings - DROP TABLE IF EXISTS ta_l2; - --enable_warnings - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_2_DROP_TABLES; - --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES2; - echo CHILD2_1_CREATE_TABLES2; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES2; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - --disable_query_log - echo CREATE TABLE ta_l2 ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1; - eval CREATE TABLE ta_l2 ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1; - --enable_query_log - INSERT INTO ta_l2 (a, b, c) VALUES (3, 'B', '2010-09-26 00:00:00'); - UPDATE ta_l2 SET a = 4 WHERE a = 3; - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE '%update %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE '%delete %'; - } - eval $CHILD2_2_SELECT_TABLES; - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE '%update %'; - SELECT argument FROM mysql.general_log WHERE argument LIKE '%delete %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } -} - ---echo index merge with partition -if ($HAVE_PARTITION) -{ - --connection master_1 - --disable_warnings - DROP TABLE IF EXISTS ta_l_int; - --enable_warnings - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_result_log - } - --disable_query_log - --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_2_DROP_TABLES5; - echo CHILD2_2_CREATE_TABLES5; - } - --disable_warnings - eval $CHILD2_2_DROP_TABLES5; - --enable_warnings - eval $CHILD2_2_CREATE_TABLES5; - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_1_DROP_TABLES5; - echo CHILD2_1_CREATE_TABLES5; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES5; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES5; - --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_result_log - } - } - --connection master_1 - --disable_query_log - echo CREATE TABLE ta_l_int ( - a INT AUTO_INCREMENT, - b INT DEFAULT 10, - c INT DEFAULT 11, - PRIMARY KEY(a), - KEY idx1(b), - KEY idx2(c) - ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_P_2_1; - eval CREATE TABLE ta_l_int ( - a INT AUTO_INCREMENT, - b INT DEFAULT 10, - c INT DEFAULT 11, - PRIMARY KEY(a), - KEY idx1(b), - KEY idx2(c) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_P_2_1; - --enable_query_log - INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3); - INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int; - INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int; - INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int; - INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2) - WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } -} - - ---echo ---echo 2.26 ---echo auto_increment with partition -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_INCREMENT_TABLES1; - echo CHILD2_1_CREATE_INCREMENT_TABLES1; - echo CHILD2_1_AUTO_INCREMENT_INCREMENT2; - echo CHILD2_1_AUTO_INCREMENT_OFFSET2; - } - --disable_warnings - eval $CHILD2_1_DROP_INCREMENT_TABLES1; - --enable_warnings - eval $CHILD2_1_CREATE_INCREMENT_TABLES1; - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_INCREMENT_TABLES1; - echo CHILD2_2_CREATE_INCREMENT_TABLES1; - echo CHILD2_2_AUTO_INCREMENT_INCREMENT2; - echo CHILD2_2_AUTO_INCREMENT_OFFSET2; - } - --disable_warnings - eval $CHILD2_2_DROP_INCREMENT_TABLES1; - --enable_warnings - eval $CHILD2_2_CREATE_INCREMENT_TABLES1; - eval $CHILD2_2_AUTO_INCREMENT_INCREMENT2; - eval $CHILD2_2_AUTO_INCREMENT_OFFSET2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } - --connection master_1 - if ($USE_REPLICATION) - { - save_master_pos; - --connection slave1_1 - sync_with_master; - --connection master_1 - --disable_query_log - SET SESSION sql_log_bin= 0; - --enable_query_log - } - --disable_warnings - DROP TABLE IF EXISTS t1; - --enable_warnings - --disable_query_log - echo CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1; - echo MASTER_1_AUTO_INCREMENT_INCREMENT2; - echo MASTER_1_AUTO_INCREMENT_OFFSET2; - eval CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1; - eval $MASTER_1_AUTO_INCREMENT_INCREMENT2; - eval $MASTER_1_AUTO_INCREMENT_OFFSET2; - if ($USE_REPLICATION) - { - SET SESSION sql_log_bin= 1; - --connection slave1_1 - --disable_warnings - DROP TABLE IF EXISTS t1; - --enable_warnings - echo CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1; - eval CREATE TABLE t1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1; - --connection master_1 - } - --enable_query_log - INSERT INTO t1 () VALUES (); - SELECT LAST_INSERT_ID(); - SELECT MAX(id) FROM t1; - INSERT INTO t1 () VALUES (); - SELECT LAST_INSERT_ID(); - SELECT MAX(id) FROM t1; - INSERT INTO t1 (id) VALUES (null); - SELECT LAST_INSERT_ID(); - SELECT MAX(id) FROM t1; - INSERT INTO t1 (id) VALUES (null); - SELECT LAST_INSERT_ID(); - SELECT MAX(id) FROM t1; - INSERT INTO t1 () VALUES (),(),(),(); - SELECT LAST_INSERT_ID(); - SELECT id FROM t1 ORDER BY id; - SET INSERT_ID=5000; - INSERT INTO t1 () VALUES (); - SELECT LAST_INSERT_ID(); - SELECT MAX(id) FROM t1; - INSERT INTO t1 (id) VALUES (10000); - SELECT LAST_INSERT_ID(); - SELECT MAX(id) FROM t1; - INSERT INTO t1 (id) VALUES (1000); - SELECT LAST_INSERT_ID(); - SELECT MAX(id) FROM t1; - if ($USE_REPLICATION) - { - save_master_pos; - --connection slave1_1 - sync_with_master; - SELECT id FROM t1 ORDER BY id; - --connection master_1 - --disable_query_log - SET SESSION sql_log_bin= 0; - --enable_query_log - } - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_INCREMENT_TABLES1; - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_AUTO_INCREMENT_INCREMENT1; - echo CHILD2_1_AUTO_INCREMENT_OFFSET1; - } - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET1; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - --connection child2_2 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - } - eval $CHILD2_2_SELECT_INCREMENT_TABLES1; - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_AUTO_INCREMENT_INCREMENT1; - echo CHILD2_2_AUTO_INCREMENT_OFFSET1; - } - eval $CHILD2_2_AUTO_INCREMENT_INCREMENT1; - eval $CHILD2_2_AUTO_INCREMENT_OFFSET1; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } - } -} - - ---echo ---echo deinit ---disable_warnings ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -if ($USE_REPLICATION) -{ - --connection slave1_1 - DROP DATABASE IF EXISTS auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; -} ---disable_query_log ---disable_result_log ---source slave_test_deinit.inc ---source test_deinit.inc ---enable_result_log ---enable_query_log ---enable_warnings ---echo ---echo end of test diff --git a/storage/spider/mysql-test/spider/oracle2/t/test_deinit.inc b/storage/spider/mysql-test/spider/oracle2/t/test_deinit.inc deleted file mode 100644 index 989bde26d3c..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/test_deinit.inc +++ /dev/null @@ -1,37 +0,0 @@ -# get connection and exist engine test ---echo for master_1 ---connection master_1 ---source ../include/deinit_master_1.inc ---disconnect master_1 ---echo for child2 -if ($USE_CHILD_GROUP2) -{ - --echo child2_1 - --connection child2_1 - --source ../include/deinit_child2_1.inc - --disconnect child2_1 - --echo child2_2 - --connection child2_2 - --source ../include/deinit_child2_2.inc - --disconnect child2_2 - --echo child2_3 - --connection child2_3 - --source ../include/deinit_child2_3.inc - --disconnect child2_3 -} ---echo for child3 -if ($USE_CHILD_GROUP3) -{ - --echo child3_1 - --connection child3_1 - --source ../include/deinit_child3_1.inc - --disconnect child3_1 - --echo child3_2 - --connection child3_2 - --source ../include/deinit_child3_2.inc - --disconnect child3_2 - --echo child3_3 - --connection child3_3 - --source ../include/deinit_child3_3.inc - --disconnect child3_3 -} diff --git a/storage/spider/mysql-test/spider/oracle2/t/test_init.inc b/storage/spider/mysql-test/spider/oracle2/t/test_init.inc deleted file mode 100644 index f2cd6c0269f..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/test_init.inc +++ /dev/null @@ -1,74 +0,0 @@ -# get connection and exist engine test ---echo for master_1 ---source connect_master_1.inc ---connection master_1 -CALL mtr.add_suppression("unknown variable"); -SET SESSION sql_log_bin= 0; ---let $MASTER_1_SERVER_ID=`SELECT @@global.server_id` ---let $TEST_ENGINE_TYPE= $MASTER_1_ENGINE_TYPE ---source have_partition.inc ---source have_trigger.inc ---source ../include/init_master_1.inc ---source have_engine.inc ---echo for child2 -if ($USE_CHILD_GROUP2) -{ - --echo child2_1 - --source connect_child2_1.inc - --connection child2_1 - CALL mtr.add_suppression("unknown variable *"); - SET SESSION sql_log_bin= 0; - --let $CHILD2_1_SERVER_ID=`SELECT @@global.server_id` - --let $TEST_ENGINE_TYPE= $CHILD2_1_ENGINE_TYPE - --source ../include/init_child2_1.inc - --source have_engine.inc - --echo child2_2 - --source connect_child2_2.inc - --connection child2_2 - CALL mtr.add_suppression("unknown variable *"); - SET SESSION sql_log_bin= 0; - --let $CHILD2_2_SERVER_ID=`SELECT @@global.server_id` - --let $TEST_ENGINE_TYPE= $CHILD2_2_ENGINE_TYPE - --source ../include/init_child2_2.inc - --source have_engine.inc - --echo child2_3 - --source connect_child2_3.inc - --connection child2_3 - CALL mtr.add_suppression("unknown variable *"); - SET SESSION sql_log_bin= 0; - --let $CHILD2_3_SERVER_ID=`SELECT @@global.server_id` - --let $TEST_ENGINE_TYPE= $CHILD2_3_ENGINE_TYPE - --source ../include/init_child2_3.inc - --source have_engine.inc -} ---echo for child3 -if ($USE_CHILD_GROUP3) -{ - --echo child3_1 - --source connect_child3_1.inc - --connection child3_1 - CALL mtr.add_suppression("unknown variable *"); - SET SESSION sql_log_bin= 0; - --let $CHILD3_1_SERVER_ID=`SELECT @@global.server_id` - --let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE - --source ../include/init_child3_1.inc - --source have_engine.inc - --echo child3_2 - --source connect_child3_2.inc - --connection child3_2 - CALL mtr.add_suppression("unknown variable *"); - SET SESSION sql_log_bin= 0; - --let $CHILD3_2_SERVER_ID=`SELECT @@global.server_id` - --let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE - --source ../include/init_child3_2.inc - --source have_engine.inc - --echo child3_3 - --source connect_child3_3.inc - --connection child3_3 - CALL mtr.add_suppression("unknown variable *"); - SET SESSION sql_log_bin= 0; - --let $CHILD3_3_SERVER_ID=`SELECT @@global.server_id` - --let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE - --source ../include/init_child3_3.inc - --source have_engine.inc -} diff --git a/storage/spider/mysql-test/spider/oracle2/t/vp_fixes.test b/storage/spider/mysql-test/spider/oracle2/t/vp_fixes.test deleted file mode 100644 index 90380227040..00000000000 --- a/storage/spider/mysql-test/spider/oracle2/t/vp_fixes.test +++ /dev/null @@ -1,335 +0,0 @@ -# This test tests for VP's bug fixes ---disable_warnings ---disable_query_log ---disable_result_log ---source test_init.inc ---enable_result_log ---enable_query_log - ---echo ---echo drop and create databases ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -CREATE DATABASE auto_test_local; -USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - CREATE DATABASE auto_test_remote; - USE auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; - CREATE DATABASE auto_test_remote2; - USE auto_test_remote2; -} ---enable_warnings - ---echo ---echo test select 1 ---connection master_1 -SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - SELECT 1; - --connection child2_2 - SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo create table and insert -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS tb_l; ---enable_warnings ---disable_query_log -echo CREATE TABLE tb_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) MASTER_1_ENGINE2 MASTER_1_CHARSET2; -eval CREATE TABLE tb_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; ---enable_query_log -INSERT INTO tb_l (a, b, c) VALUES - (1, 'a', '2008-08-01 10:21:39'), - (2, 'b', '2000-01-01 00:00:00'), - (3, 'e', '2007-06-04 20:03:11'), - (4, 'd', '2003-11-30 05:01:03'), - (5, 'c', '2001-12-31 23:59:59'); ---disable_warnings -DROP TABLE IF EXISTS ta_l; ---enable_warnings ---disable_query_log -echo CREATE TABLE ta_l ( - PRIMARY KEY(a) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; ---enable_query_log -INSERT INTO ta_l SELECT a, b, c FROM tb_l; - ---echo ---echo 0.9 ---echo create different primary key table -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_result_log - } - --disable_query_log - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_1_DROP_TABLES5; - echo CHILD2_1_CREATE_TABLES5; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES5; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES5; - --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_result_log - } -} ---connection master_1 ---disable_query_log -echo CREATE TABLE ta_l_int ( - a INT DEFAULT 10, - b INT AUTO_INCREMENT, - c INT DEFAULT 11, - PRIMARY KEY(b) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1; -eval CREATE TABLE ta_l_int ( - a INT DEFAULT 10, - b INT AUTO_INCREMENT, - c INT DEFAULT 11, - PRIMARY KEY(b) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; ---enable_query_log -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---let $MASTER_1_IS_VP= `SELECT IF('$MASTER_1_ENGINE_TYPE' = 'VP', 1, 0)` -if ($MASTER_1_IS_VP) -{ - --error 14514 - INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); -} -if (!$MASTER_1_IS_VP) -{ - INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); - --disable_query_log - --disable_result_log - TRUNCATE TABLE ta_l_int; - --enable_query_log - --enable_result_log -} -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_TABLES5; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo create un-correspond primary key table ---connection master_1 ---disable_warnings -DROP TABLE IF EXISTS ta_l_int; ---enable_warnings -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_result_log - } - --disable_query_log - --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_1_DROP_TABLES5; - echo CHILD2_1_CREATE_TABLES5; - } - --disable_warnings - eval $CHILD2_1_DROP_TABLES5; - --enable_warnings - eval $CHILD2_1_CREATE_TABLES5; - --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_result_log - } -} ---connection master_1 ---disable_query_log -echo CREATE TABLE ta_l_int ( - a INT DEFAULT 10, - b INT DEFAULT 12, - c INT DEFAULT 11, - PRIMARY KEY(c) -) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1; -eval CREATE TABLE ta_l_int ( - a INT DEFAULT 10, - b INT DEFAULT 12, - c INT DEFAULT 11, - PRIMARY KEY(c) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; ---enable_query_log -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -if ($MASTER_1_IS_VP) -{ - --error 14514 - INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); -} -if (!$MASTER_1_IS_VP) -{ - INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); - --disable_query_log - --disable_result_log - TRUNCATE TABLE ta_l_int; - --enable_query_log - --enable_result_log -} -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_TABLES5; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} - ---echo ---echo deinit ---disable_warnings ---connection master_1 -DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ - --connection child2_1 - DROP DATABASE IF EXISTS auto_test_remote; - --connection child2_2 - DROP DATABASE IF EXISTS auto_test_remote2; -} ---disable_query_log ---disable_result_log ---source test_deinit.inc ---enable_result_log ---enable_query_log ---enable_warnings ---echo ---echo end of test diff --git a/storage/spider/spd_db_oracle.cc b/storage/spider/spd_db_oracle.cc deleted file mode 100644 index 19295d40c5f..00000000000 --- a/storage/spider/spd_db_oracle.cc +++ /dev/null @@ -1,13404 +0,0 @@ -/* Copyright (C) 2012-2018 Kentoku Shiba - Copyright (c) 2020, MariaDB Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -#define MYSQL_SERVER 1 -#include -#include "mysql_version.h" -#include "sql_priv.h" -#include "probes_mysql.h" -#include "sql_partition.h" -#include "sql_analyse.h" -#include "sql_select.h" - -#ifdef HAVE_ORACLE_OCI -#if (defined(WIN32) || defined(_WIN32) || defined(WINDOWS) || defined(_WINDOWS)) -#include -#define strcasestr StrStr -#endif -#include -#include "spd_err.h" -#include "spd_param.h" -#include "spd_db_include.h" -#include "spd_include.h" -#include "spd_db_oracle.h" -#include "ha_spider.h" -#include "spd_conn.h" -#include "spd_db_conn.h" -#include "spd_malloc.h" -#include "spd_sys_table.h" -#include "spd_table.h" - -extern struct charset_info_st *spd_charset_utf8mb3_bin; - -extern handlerton *spider_hton_ptr; -extern pthread_mutex_t spider_open_conn_mutex; -extern HASH spider_open_connections; -extern HASH spider_ipport_conns; -extern SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE]; -extern const char spider_dig_upper[]; - -#define SPIDER_DB_WRAPPER_ORACLE "oracle" - -#define SPIDER_SQL_NAME_QUOTE_STR "\"" -#define SPIDER_SQL_NAME_QUOTE_LEN (sizeof(SPIDER_SQL_NAME_QUOTE_STR) - 1) -static const char *name_quote_str = SPIDER_SQL_NAME_QUOTE_STR; - -#define SPIDER_SQL_ISO_READ_COMMITTED_STR "set transaction isolation level read committed" -#define SPIDER_SQL_ISO_READ_COMMITTED_LEN sizeof(SPIDER_SQL_ISO_READ_COMMITTED_STR) - 1 -#define SPIDER_SQL_ISO_SERIALIZABLE_STR "set transaction isolation level serializable" -#define SPIDER_SQL_ISO_SERIALIZABLE_LEN sizeof(SPIDER_SQL_ISO_SERIALIZABLE_STR) - 1 - -#define SPIDER_SQL_START_TRANSACTION_STR "set transaction read write" -#define SPIDER_SQL_START_TRANSACTION_LEN sizeof(SPIDER_SQL_START_TRANSACTION_STR) - 1 - -#define SPIDER_SQL_AUTOCOMMIT_OFF_STR "set autocommit off" -#define SPIDER_SQL_AUTOCOMMIT_OFF_LEN sizeof(SPIDER_SQL_AUTOCOMMIT_OFF_STR) - 1 -#define SPIDER_SQL_AUTOCOMMIT_ON_STR "set autocommit on" -#define SPIDER_SQL_AUTOCOMMIT_ON_LEN sizeof(SPIDER_SQL_AUTOCOMMIT_ON_STR) - 1 - -#define SPIDER_SQL_LOCK_TABLE_STR "lock table " -#define SPIDER_SQL_LOCK_TABLE_LEN (sizeof(SPIDER_SQL_LOCK_TABLE_STR) - 1) -#define SPIDER_SQL_UNLOCK_TABLE_STR "unlock tables" -#define SPIDER_SQL_UNLOCK_TABLE_LEN (sizeof(SPIDER_SQL_UNLOCK_TABLE_STR) - 1) -#define SPIDER_SQL_LOCK_TABLE_SHARE_MODE_STR " in share mode" -#define SPIDER_SQL_LOCK_TABLE_SHARE_MODE_LEN (sizeof(SPIDER_SQL_LOCK_TABLE_SHARE_MODE_STR) - 1) -#define SPIDER_SQL_LOCK_TABLE_EXCLUSIVE_MODE_STR " in exclusive mode" -#define SPIDER_SQL_LOCK_TABLE_EXCLUSIVE_MODE_LEN (sizeof(SPIDER_SQL_LOCK_TABLE_EXCLUSIVE_MODE_STR) - 1) - -#define SPIDER_SQL_COMMIT_STR "commit" -#define SPIDER_SQL_COMMIT_LEN sizeof(SPIDER_SQL_COMMIT_STR) - 1 - -#define SPIDER_SQL_SET_NLS_DATE_FORMAT_STR "alter session set nls_date_format='YYYY-MM-DD HH24:MI:SS'" -#define SPIDER_SQL_SET_NLS_DATE_FORMAT_LEN sizeof(SPIDER_SQL_SET_NLS_DATE_FORMAT_STR) - 1 -#define SPIDER_SQL_SET_NLS_TIME_FORMAT_STR "alter session set nls_time_format='HH24:MI:SSXFF'" -#define SPIDER_SQL_SET_NLS_TIME_FORMAT_LEN sizeof(SPIDER_SQL_SET_NLS_TIME_FORMAT_STR) - 1 -#define SPIDER_SQL_SET_NLS_TIMESTAMP_FORMAT_STR "alter session set nls_timestamp_format='YYYY-MM-DD HH24:MI:SSXFF'" -#define SPIDER_SQL_SET_NLS_TIMESTAMP_FORMAT_LEN sizeof(SPIDER_SQL_SET_NLS_TIMESTAMP_FORMAT_STR) - 1 - -#define SPIDER_SQL_SELECT_WRAPPER_HEAD_STR "select * from (" -#define SPIDER_SQL_SELECT_WRAPPER_HEAD_LEN sizeof(SPIDER_SQL_SELECT_WRAPPER_HEAD_STR) - 1 -#define SPIDER_SQL_UPDATE_WRAPPER_HEAD_STR " where rowid in (select rowid from (select rowid, row_number() over (order by " -#define SPIDER_SQL_UPDATE_WRAPPER_HEAD_LEN sizeof(SPIDER_SQL_UPDATE_WRAPPER_HEAD_STR) - 1 -#define SPIDER_SQL_ROW_NUMBER_HEAD_STR ", row_number() over (order by " -#define SPIDER_SQL_ROW_NUMBER_HEAD_LEN sizeof(SPIDER_SQL_ROW_NUMBER_HEAD_STR) - 1 -#define SPIDER_SQL_ROW_NUMBER_TAIL_STR "rowid) row_num" -#define SPIDER_SQL_ROW_NUMBER_TAIL_LEN sizeof(SPIDER_SQL_ROW_NUMBER_TAIL_STR) - 1 -#define SPIDER_SQL_ROW_NUMBER_DESC_TAIL_STR "rowid desc) row_num" -#define SPIDER_SQL_ROW_NUMBER_DESC_TAIL_LEN sizeof(SPIDER_SQL_ROW_NUMBER_DESC_TAIL_STR) - 1 -#define SPIDER_SQL_SELECT_WRAPPER_TAIL_STR ") where row_num " -#define SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN sizeof(SPIDER_SQL_SELECT_WRAPPER_TAIL_STR) - 1 -#define SPIDER_SQL_ROW_NUM_STR "row_num" -#define SPIDER_SQL_ROW_NUM_LEN sizeof(SPIDER_SQL_ROW_NUM_STR) - 1 -#define SPIDER_SQL_ROWNUM_STR "rownum" -#define SPIDER_SQL_ROWNUM_LEN sizeof(SPIDER_SQL_ROWNUM_STR) - 1 -#define SPIDER_SQL_NEXTVAL_STR ".nextval" -#define SPIDER_SQL_NEXTVAL_LEN sizeof(SPIDER_SQL_NEXTVAL_STR) - 1 -#define SPIDER_SQL_CURRVAL_STR ".currval" -#define SPIDER_SQL_CURRVAL_LEN sizeof(SPIDER_SQL_CURRVAL_STR) - 1 -#define SPIDER_SQL_FROM_DUAL_STR " from dual" -#define SPIDER_SQL_FROM_DUAL_LEN sizeof(SPIDER_SQL_FROM_DUAL_STR) - 1 - -#define SPIDER_SQL_SHOW_TABLE_STATUS_STR "show table status from " -#define SPIDER_SQL_SHOW_TABLE_STATUS_LEN sizeof(SPIDER_SQL_SHOW_TABLE_STATUS_STR) - 1 -#define SPIDER_SQL_SELECT_TABLES_STATUS_STR "select `table_rows`,`avg_row_length`,`data_length`,`max_data_length`,`index_length`,`auto_increment`,`create_time`,`update_time`,`check_time` from `information_schema`.`tables` where `table_schema` = " -#define SPIDER_SQL_SELECT_TABLES_STATUS_LEN sizeof(SPIDER_SQL_SELECT_TABLES_STATUS_STR) - 1 - -#define SPIDER_SQL_LIKE_STR " like " -#define SPIDER_SQL_LIKE_LEN (sizeof(SPIDER_SQL_LIKE_STR) - 1) -#define SPIDER_SQL_LIMIT1_STR "rownum = 1" -#define SPIDER_SQL_LIMIT1_LEN (sizeof(SPIDER_SQL_LIMIT1_STR) - 1) - -#define SPIDER_SQL_ADD_MONTHS_STR "add_months" -#define SPIDER_SQL_ADD_MONTHS_LEN (sizeof(SPIDER_SQL_ADD_MONTHS_STR) - 1) - -#define SPIDER_ORACLE_ERR_BUF_LEN 512 - -static uchar SPIDER_SQL_LINESTRING_HEAD_STR[] = - {0x00,0x00,0x00,0x00,0x01,0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00}; -#define SPIDER_SQL_LINESTRING_HEAD_LEN sizeof(SPIDER_SQL_LINESTRING_HEAD_STR) - -static const char *spider_db_table_lock_str[] = -{ - " in share mode", - " in share mode", - " in exclusive mode", - " in exclusive mode" -}; -static const int spider_db_table_lock_len[] = -{ - sizeof(" in share mode") - 1, - sizeof(" in share mode") - 1, - sizeof(" in exclusive mode") - 1, - sizeof(" in exclusive mode") - 1 -}; - -/* UTC time zone for timestamp columns */ -extern Time_zone *UTC; - -int spider_db_oracle_get_error( - sword res, - dvoid *hndlp, - int error_num, - const char *error1, - const char *error2, - CHARSET_INFO *access_charset, - char *stored_error_msg -) { - sb4 error_code; - char buf[SPIDER_ORACLE_ERR_BUF_LEN]; - char buf2[SPIDER_ORACLE_ERR_BUF_LEN]; - spider_string tmp_str(buf2, SPIDER_ORACLE_ERR_BUF_LEN, system_charset_info); - DBUG_ENTER("spider_db_oracle_get_error"); - tmp_str.init_calc_mem(SPD_MID_DB_ORACLE_GET_ERROR_1); - tmp_str.length(0); - - switch (res) - { - case OCI_SUCCESS: - DBUG_PRINT("info",("spider res=OCI_SUCCESS")); - break; - case OCI_SUCCESS_WITH_INFO: - DBUG_PRINT("info",("spider res=OCI_SUCCESS_WITH_INFO")); - OCIErrorGet(hndlp, 1, NULL, &error_code, (OraText *) buf, sizeof(buf), - OCI_HTYPE_ERROR); - DBUG_PRINT("info",("spider error_code=%d error='%s'",error_code ,buf)); - if (access_charset && access_charset->cset != system_charset_info->cset) - { - tmp_str.append(buf, strlen(buf), access_charset); - } else { - tmp_str.set(buf, strlen(buf), system_charset_info); - } - push_warning_printf(current_thd, SPIDER_WARN_LEVEL_WARN, - ER_SPIDER_ORACLE_NUM, ER_SPIDER_ORACLE_STR, res, error_code, - tmp_str.c_ptr_safe()); - break; - case OCI_NO_DATA: - DBUG_PRINT("info",("spider res=OCI_NO_DATA")); - DBUG_RETURN(HA_ERR_END_OF_FILE); - case OCI_ERROR: - DBUG_PRINT("info",("spider res=OCI_ERROR")); - OCIErrorGet(hndlp, 1, NULL, &error_code, (OraText *) buf, sizeof(buf), - OCI_HTYPE_ERROR); - DBUG_PRINT("info",("spider error_code=%d error='%s'",error_code ,buf)); - if (error_code == 1) - { - DBUG_PRINT("info",("spider found dupp key")); - if (stored_error_msg) - strmov(stored_error_msg, buf); - DBUG_RETURN(HA_ERR_FOUND_DUPP_KEY); - } - if (error_num) - { - if (error1) - { - if (error2) - { - my_printf_error(error_num, error1, MYF(0), error2); - } else { - my_printf_error(error_num, error1, MYF(0)); - } - } else if (error2) { - my_error(error_num, MYF(0), error2); - } else { - my_error(error_num, MYF(0)); - } - } - if (access_charset && access_charset->cset != system_charset_info->cset) - { - tmp_str.append(buf, strlen(buf), access_charset); - } else { - tmp_str.set(buf, strlen(buf), system_charset_info); - } - my_printf_error(ER_SPIDER_ORACLE_NUM, ER_SPIDER_ORACLE_STR, MYF(0), - res, error_code, tmp_str.c_ptr_safe()); - if (error_num) - { - DBUG_RETURN(error_num); - } else { - DBUG_RETURN(ER_SPIDER_ORACLE_NUM); - } - case OCI_INVALID_HANDLE: - case OCI_NEED_DATA: - if (res == OCI_INVALID_HANDLE) - DBUG_PRINT("info",("spider res=OCI_INVALID_HANDLE")); - else - DBUG_PRINT("info",("spider res=OCI_NEED_DATA")); - default: - DBUG_PRINT("info",("spider res=%d", res)); - if (error_num) - { - if (error1) - { - if (error2) - { - my_printf_error(error_num, error1, MYF(0), error2); - } else { - my_printf_error(error_num, error1, MYF(0)); - } - } else if (error2) { - my_error(error_num, MYF(0), error2); - } else { - my_error(error_num, MYF(0)); - } - } - my_printf_error(ER_SPIDER_ORACLE_NUM, ER_SPIDER_ORACLE_STR, MYF(0), - res, 0, ""); - if (error_num) - { - DBUG_RETURN(error_num); - } else { - DBUG_RETURN(ER_SPIDER_ORACLE_NUM); - } - } - DBUG_RETURN(0); -} - -int spider_oracle_init() -{ - DBUG_ENTER("spider_oracle_init"); - DBUG_RETURN(0); -} - -int spider_oracle_deinit() -{ - DBUG_ENTER("spider_oracle_deinit"); - DBUG_RETURN(0); -} - -spider_db_share *spider_oracle_create_share( - SPIDER_SHARE *share -) { - DBUG_ENTER("spider_oracle_create_share"); - DBUG_RETURN(new spider_oracle_share(share)); -} - -spider_db_handler *spider_oracle_create_handler( - ha_spider *spider, - spider_db_share *db_share -) { - DBUG_ENTER("spider_oracle_create_handler"); - DBUG_RETURN(new spider_oracle_handler(spider, - (spider_oracle_share *) db_share)); -} - -spider_db_copy_table *spider_oracle_create_copy_table( - spider_db_share *db_share -) { - DBUG_ENTER("spider_oracle_create_copy_table"); - DBUG_RETURN(new spider_oracle_copy_table( - (spider_oracle_share *) db_share)); -} - -SPIDER_DB_CONN *spider_oracle_create_conn( - SPIDER_CONN *conn -) { - DBUG_ENTER("spider_oracle_create_conn"); - DBUG_RETURN(new spider_db_oracle(conn)); -} - -bool spider_oracle_support_direct_join( -) { - DBUG_ENTER("spider_oracle_support_direct_join"); - DBUG_RETURN(FALSE); -} - -spider_db_oracle_util spider_db_oracle_utility; - -SPIDER_DBTON spider_dbton_oracle = { - 0, - SPIDER_DB_WRAPPER_ORACLE, - SPIDER_DB_ACCESS_TYPE_SQL, - spider_oracle_init, - spider_oracle_deinit, - spider_oracle_create_share, - spider_oracle_create_handler, - spider_oracle_create_copy_table, - spider_oracle_create_conn, - spider_oracle_support_direct_join, - &spider_db_oracle_utility, - "For communication with Oracle using the native protocol", - "1.0.0", - SPIDER_MATURITY_BETA -}; - -spider_db_oracle_row::spider_db_oracle_row() : - spider_db_row(spider_dbton_oracle.dbton_id), - db_conn(NULL), result(NULL), - ind(NULL), val(NULL), rlen(NULL), ind_first(NULL), val_first(NULL), - rlen_first(NULL), val_str(NULL), val_str_first(NULL), defnp(NULL), - lobhp(NULL), colhp(NULL), coltp(NULL), colsz(NULL), field_count(0), - row_size(NULL), row_size_first(NULL), access_charset(NULL), cloned(FALSE) -{ - DBUG_ENTER("spider_db_oracle_row::spider_db_oracle_row"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_VOID_RETURN; -} - -spider_db_oracle_row::~spider_db_oracle_row() -{ - DBUG_ENTER("spider_db_oracle_row::~spider_db_oracle_row"); - DBUG_PRINT("info",("spider this=%p", this)); - deinit(); - DBUG_VOID_RETURN; -} - -int spider_db_oracle_row::store_to_field( - Field *field, - CHARSET_INFO *access_charset -) { - DBUG_ENTER("spider_db_oracle_row::store_to_field"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_PRINT("info",("spider ind=%d", *ind)); - if (*ind == -1) - { - DBUG_PRINT("info", ("spider field is null")); - field->set_null(); - field->reset(); - } else { - DBUG_PRINT("info", ("spider field->type()=%u", field->type())); - field->set_notnull(); - if (field->type() == MYSQL_TYPE_YEAR) - { - field->store(val_str->ptr(), 4, - field->table->s->table_charset); - } else if (field->type() == MYSQL_TYPE_DATE) - { - field->store(val_str->ptr(), 10, - field->table->s->table_charset); - } else if (field->type() == MYSQL_TYPE_TIME) - { - field->store(val_str->ptr() + 11, 8, - field->table->s->table_charset); - } else { - DBUG_PRINT("info", ("spider val_str->length()=%u", val_str->length())); - if (field->flags & BLOB_FLAG) - { - DBUG_PRINT("info", ("spider blob field")); - ((Field_blob *)field)->set_ptr( - val_str->length(), (uchar *) val_str->ptr()); - } else { - field->store(val_str->ptr(), val_str->length(), - field->table->s->table_charset); - } - } - } - DBUG_RETURN(0); -} - -int spider_db_oracle_row::append_to_str( - spider_string *str -) { - DBUG_ENTER("spider_db_oracle_row::append_to_str"); - DBUG_PRINT("info",("spider this=%p", this)); - if (str->reserve(val_str->length())) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(val_str->ptr(), val_str->length()); - DBUG_RETURN(0); -} - -int spider_db_oracle_row::append_escaped_to_str( - spider_string *str, - uint dbton_id -) { - DBUG_ENTER("spider_db_oracle_row::append_escaped_to_str"); - DBUG_PRINT("info",("spider this=%p", this)); -/* - spider_string tmp_str(*val, *rlen, str->charset()); - tmp_str.init_calc_mem(SPD_MID_DB_ORACLE_ROW_APPEND_ESCAPED_TO_STR_1); - tmp_str.length(*rlen); -#ifndef DBUG_OFF - tmp_str.c_ptr_safe(); -#endif - if (str->reserve(*rlen * 2)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - util.append_escaped(str, tmp_str.get_str()); -*/ - if (str->reserve(val_str->length() * 2)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - spider_dbton[dbton_id].db_util->append_escaped_util(str, val_str->get_str()); - DBUG_RETURN(0); -} - -void spider_db_oracle_row::first() -{ - DBUG_ENTER("spider_db_oracle_row::first"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_PRINT("info",("spider ind_first=%p", ind_first)); - ind = ind_first; - DBUG_PRINT("info",("spider val_first=%p", val_first)); - val = val_first; - DBUG_PRINT("info",("spider rlen_first=%p", rlen_first)); - rlen = rlen_first; - DBUG_PRINT("info",("spider row_size_first=%p", row_size_first)); - row_size = row_size_first; - DBUG_PRINT("info",("spider val_str_first=%p", val_str_first)); - val_str = val_str_first; - DBUG_VOID_RETURN; -} - -void spider_db_oracle_row::next() -{ - DBUG_ENTER("spider_db_oracle_row::next"); - DBUG_PRINT("info",("spider this=%p", this)); - ind++; - val++; - rlen++; - row_size++; - val_str++; - DBUG_VOID_RETURN; -} - -bool spider_db_oracle_row::is_null() -{ - DBUG_ENTER("spider_db_oracle_row::is_null"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN((*ind == -1)); -} - -int spider_db_oracle_row::val_int() -{ - DBUG_ENTER("spider_db_oracle_row::val_int"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN((*ind != -1) ? atoi(*val) : 0); -} - -double spider_db_oracle_row::val_real() -{ - DBUG_ENTER("spider_db_oracle_row::val_real"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN((*ind != -1) ? my_atof(*val) : 0.0); -} - -my_decimal *spider_db_oracle_row::val_decimal( - my_decimal *decimal_value, - CHARSET_INFO *access_charset -) { - DBUG_ENTER("spider_db_oracle_row::val_decimal"); - DBUG_PRINT("info",("spider this=%p", this)); - if (*ind == -1) - DBUG_RETURN(NULL); - -#ifdef SPIDER_HAS_DECIMAL_OPERATION_RESULTS_VALUE_TYPE - decimal_operation_results(str2my_decimal(0, *val, *rlen, access_charset, - decimal_value), "", ""); -#else - decimal_operation_results(str2my_decimal(0, *val, *rlen, access_charset, - decimal_value)); -#endif - - DBUG_RETURN(decimal_value); -} - -SPIDER_DB_ROW *spider_db_oracle_row::clone() -{ - uint i; - spider_db_oracle_row *clone_row; - DBUG_ENTER("spider_db_oracle_row::clone"); - DBUG_PRINT("info",("spider this=%p", this)); - if (!(clone_row = new spider_db_oracle_row(dbton_id))) - { - DBUG_RETURN(NULL); - } - clone_row->db_conn = db_conn; - clone_row->result = result; - clone_row->field_count = field_count; - clone_row->record_size = record_size; - clone_row->access_charset = access_charset; - clone_row->cloned = TRUE; - if (clone_row->init()) - { - delete clone_row; - DBUG_RETURN(NULL); - } - memcpy(clone_row->ind, ind_first, sizeof(ub2) * field_count * 4 + - sizeof(ulong) * field_count); - for (i = 0; i < field_count; i++) - { - if (clone_row->val_str[i].copy(val_str_first[i])) - { - delete clone_row; - DBUG_RETURN(NULL); - } - } - DBUG_RETURN((SPIDER_DB_ROW *) clone_row); -} - -int spider_db_oracle_row::store_to_tmp_table( - TABLE *tmp_table, - spider_string *str -) { - uint i; - DBUG_ENTER("spider_db_oracle_row::store_to_tmp_table"); - DBUG_PRINT("info",("spider this=%p", this)); - str->length(0); - for (i = 0; i < field_count; i++) - { - if (row_size_first[i]) - { - if (str->reserve(val_str_first[i].length())) - { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - str->q_append(val_str_first[i].ptr(), val_str_first[i].length()); - } - } - tmp_table->field[0]->set_notnull(); - tmp_table->field[0]->store( - (const char *) row_size_first, - sizeof(ulong) * field_count, &my_charset_bin); - tmp_table->field[1]->set_notnull(); - tmp_table->field[1]->store( - str->ptr(), str->length(), &my_charset_bin); - tmp_table->field[2]->set_notnull(); - tmp_table->field[2]->store( - (char *) ind_first, (uint) (sizeof(sb2) * field_count), &my_charset_bin); - DBUG_RETURN(tmp_table->file->ha_write_row(tmp_table->record[0])); -} - -uint spider_db_oracle_row::get_byte_size() -{ - DBUG_ENTER("spider_db_oracle_row::get_byte_size"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(record_size); -} - -int spider_db_oracle_row::init() -{ - char *tmp_val; - uint i; - DBUG_ENTER("spider_db_oracle_row::init"); - DBUG_PRINT("info",("spider this=%p", this)); - if ( - !(ind = (sb2 *) - spider_bulk_malloc(spider_current_trx, SPD_MID_DB_ORACLE_ROW_INIT_1, MYF(MY_WME | MY_ZEROFILL), - &ind, (uint) (sizeof(sb2) * field_count), - &rlen, (uint) (sizeof(ub2) * field_count), - &coltp, (uint) (sizeof(ub2) * field_count), - &colsz, (uint) (sizeof(ub2) * field_count), - &row_size, (uint) (sizeof(ulong) * field_count), - &val, (uint) (sizeof(char *) * field_count), - &tmp_val, (uint) (MAX_FIELD_WIDTH * field_count), - &defnp, (uint) (sizeof(OCIDefine *) * field_count), - &lobhp, (uint) (sizeof(OCILobLocator *) * field_count), - &colhp, (uint) (sizeof(OCIParam *) * field_count), - NullS) - ) || - !(val_str = new spider_string[field_count]) - ) { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - ind_first = ind; - val_first = val; - rlen_first = rlen; - row_size_first = row_size; - val_str_first = val_str; - for (i = 0; i < field_count; i++) - { - val[i] = tmp_val; - val_str[i].init_calc_mem(SPD_MID_DB_ORACLE_ROW_INIT_2); - val_str[i].set(tmp_val, MAX_FIELD_WIDTH, access_charset); - tmp_val += MAX_FIELD_WIDTH; - } - DBUG_RETURN(0); -} - -void spider_db_oracle_row::deinit() -{ - uint i; - DBUG_ENTER("spider_db_oracle_row::deinit"); - DBUG_PRINT("info",("spider this=%p", this)); - if (!cloned) - { - for (i = 0; i < field_count; i++) - { - if (defnp && defnp[i]) - { - OCIHandleFree(defnp[i], OCI_HTYPE_DEFINE); - defnp[i] = NULL; - } - if (lobhp && lobhp[i]) - { - OCIDescriptorFree(lobhp[i], OCI_DTYPE_LOB); - lobhp[i] = NULL; - } - } - } - if (val_str_first) - { - delete [] val_str_first; - val_str_first = NULL; - } - if (ind_first) - { - spider_free(spider_current_trx, ind_first, MYF(0)); - ind_first = NULL; - } - DBUG_VOID_RETURN; -} - -int spider_db_oracle_row::define() -{ - sword res; - uint i; - DBUG_ENTER("spider_db_oracle_row::define"); - DBUG_PRINT("info",("spider this=%p", this)); - for (i = 0; i < field_count; i++) - { - if (coltp[i] == SQLT_BLOB) - { - res = OCIDescriptorAlloc(db_conn->envhp, (dvoid **) &lobhp[i], - OCI_DTYPE_LOB, 0, 0); - if (res != OCI_SUCCESS) - { - DBUG_RETURN( - spider_db_oracle_get_error(res, db_conn->errhp, 0, NULL, NULL, - access_charset, NULL)); - } - res = OCIDefineByPos(result->stmtp, &defnp[i], db_conn->errhp, i + 1, - &lobhp[i], 0, SQLT_BLOB, &ind[i], &rlen[i], NULL, - OCI_DEFAULT); - } else if (coltp[i] == SQLT_DAT) - { - res = OCIDefineByPos(result->stmtp, &defnp[i], db_conn->errhp, i + 1, - (char *) val_str[i].ptr() + 20, sizeof(ub1) * 7, SQLT_DAT, &ind[i], - &rlen[i], NULL, OCI_DEFAULT); - } else { - if (val_str[i].alloc(colsz[i])) - { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - res = OCIDefineByPos(result->stmtp, &defnp[i], db_conn->errhp, i + 1, - (char *) val_str[i].ptr(), colsz[i], SQLT_CHR, &ind[i], &rlen[i], NULL, - OCI_DEFAULT); - } - if (res != OCI_SUCCESS) - { - DBUG_RETURN( - spider_db_oracle_get_error(res, db_conn->errhp, 0, NULL, NULL, - access_charset, NULL)); - } - } - DBUG_RETURN(0); -} - -int spider_db_oracle_row::fetch() -{ - sword res; - uint i; - DBUG_ENTER("spider_db_oracle_row::fetch"); - DBUG_PRINT("info",("spider this=%p", this)); - record_size = 0; - for (i = 0; i < field_count; i++) - { - if (ind[i] == -1) - { - DBUG_PRINT("info",("spider NULL")); - val_str[i].length(0); - } else { - if (coltp[i] == SQLT_BLOB) - { - DBUG_PRINT("info",("spider SQLT_BLOB")); - oraub8 len; - res = OCILobGetLength2(db_conn->svchp, db_conn->errhp, lobhp[i], &len); - if (res != OCI_SUCCESS) - { - DBUG_RETURN( - spider_db_oracle_get_error(res, db_conn->errhp, 0, NULL, NULL, - access_charset, NULL)); - } -#ifndef DBUG_OFF - { - ulonglong print_len = len; - DBUG_PRINT("info",("spider len=%llu", print_len)); - } -#endif - if (val_str[i].alloc(len)) - { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - res = OCILobRead2(db_conn->svchp, db_conn->errhp, lobhp[i], &len, - NULL, 1, (char *) val_str[i].ptr(), len, OCI_ONE_PIECE, NULL, NULL, - 0, 0); - if (res != OCI_SUCCESS) - { - DBUG_RETURN( - spider_db_oracle_get_error(res, db_conn->errhp, 0, NULL, NULL, - access_charset, NULL)); - } -#ifndef DBUG_OFF - { - ulonglong print_len = len; - DBUG_PRINT("info",("spider lenb=%llu", print_len)); - } -#endif - val_str[i].length(len); - } else if (coltp[i] == SQLT_DAT) - { - DBUG_PRINT("info",("spider SQLT_DAT")); - char *val = (char *) val_str[i].ptr(); - ub1 *src = (ub1 *) val + 20; - val_str[i].length(19); - if (src[0] < 100) - my_sprintf(val, (val, "0000-00-00 00:00:00")); - else - my_sprintf(val, (val, "%02u%02u-%02u-%02u %02u:%02u:%02u", - src[0] - 100, src[1] - 100, src[2], src[3], - src[4] - 1, src[5] - 1, src[6] - 1)); - } else { - val_str[i].length(rlen[i]); - } - } - row_size[i] = val_str[i].length(); - record_size += row_size[i]; - } - DBUG_RETURN(0); -} - -spider_db_oracle_result::spider_db_oracle_result(SPIDER_DB_CONN *in_db_conn) : - spider_db_result(in_db_conn), - db_conn(NULL), stmtp(NULL), field_count(0), access_charset(NULL), - fetched(FALSE), row(in_db_conn->dbton_id) -{ - DBUG_ENTER("spider_db_oracle_result::spider_db_oracle_result"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_VOID_RETURN; -} - -spider_db_oracle_result::~spider_db_oracle_result() -{ - DBUG_ENTER("spider_db_oracle_result::~spider_db_oracle_result"); - DBUG_PRINT("info",("spider this=%p", this)); - free_result(); - DBUG_VOID_RETURN; -} - -bool spider_db_oracle_result::has_result() -{ - DBUG_ENTER("spider_db_oracle_result::has_result"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(stmtp); -} - -void spider_db_oracle_result::free_result() -{ - DBUG_ENTER("spider_db_oracle_result::free_result"); - DBUG_PRINT("info",("spider this=%p", this)); - if (stmtp) - { - OCIHandleFree(stmtp, OCI_HTYPE_STMT); - stmtp = NULL; - } - DBUG_VOID_RETURN; -} - -SPIDER_DB_ROW *spider_db_oracle_result::current_row() -{ - DBUG_ENTER("spider_db_oracle_result::current_row"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN((SPIDER_DB_ROW *) row.clone()); -} - -SPIDER_DB_ROW *spider_db_oracle_result::fetch_row() -{ - sword res; - DBUG_ENTER("spider_db_oracle_result::fetch_row"); - DBUG_PRINT("info",("spider this=%p", this)); - row.ind = row.ind_first; - row.val = row.val_first; - row.rlen = row.rlen_first; - row.row_size = row.row_size_first; - row.val_str = row.val_str_first; - if (fetched) - { - /* already fetched */ - fetched = FALSE; - } else { - res = OCIStmtFetch2(stmtp, db_conn->errhp, 1, OCI_FETCH_NEXT, 0, - OCI_DEFAULT); - if (res != OCI_SUCCESS) - { - store_error_num = spider_db_oracle_get_error(res, db_conn->errhp, 0, - NULL, NULL, access_charset, NULL); - DBUG_RETURN(NULL); - } - } - if ((store_error_num = row.fetch())) - { - DBUG_RETURN(NULL); - } - DBUG_RETURN((SPIDER_DB_ROW *) &row); -} - -SPIDER_DB_ROW *spider_db_oracle_result::fetch_row_from_result_buffer( - spider_db_result_buffer *spider_res_buf -) { - sword res; - DBUG_ENTER("spider_db_oracle_result::fetch_row_from_result_buffer"); - DBUG_PRINT("info",("spider this=%p", this)); - row.ind = row.ind_first; - row.val = row.val_first; - row.rlen = row.rlen_first; - row.row_size = row.row_size_first; - row.val_str = row.val_str_first; - if (fetched) - { - /* already fetched */ - fetched = FALSE; - } else { - res = OCIStmtFetch2(stmtp, db_conn->errhp, 1, OCI_FETCH_NEXT, 0, - OCI_DEFAULT); - if (res != OCI_SUCCESS) - { - store_error_num = spider_db_oracle_get_error(res, db_conn->errhp, 0, - NULL, NULL, access_charset, NULL); - DBUG_RETURN(NULL); - } - } - if ((store_error_num = row.fetch())) - { - DBUG_RETURN(NULL); - } - DBUG_RETURN((SPIDER_DB_ROW *) &row); -} - -SPIDER_DB_ROW *spider_db_oracle_result::fetch_row_from_tmp_table( - TABLE *tmp_table -) { - uint i; - const char *str; - spider_string tmp_str1, tmp_str2, tmp_str3; - DBUG_ENTER("spider_db_oracle_result::fetch_row_from_tmp_table"); - DBUG_PRINT("info",("spider this=%p", this)); - tmp_str1.init_calc_mem(SPD_MID_DB_ORACLE_RESULT_FETCH_ROW_FROM_TMP_TABLE_1); - tmp_str2.init_calc_mem(SPD_MID_DB_ORACLE_RESULT_FETCH_ROW_FROM_TMP_TABLE_2); - tmp_str3.init_calc_mem(SPD_MID_DB_ORACLE_RESULT_FETCH_ROW_FROM_TMP_TABLE_3); - tmp_table->field[0]->val_str(tmp_str1.get_str()); - tmp_table->field[1]->val_str(tmp_str2.get_str()); - tmp_table->field[2]->val_str(tmp_str3.get_str()); - tmp_str1.mem_calc(); - tmp_str2.mem_calc(); - tmp_str3.mem_calc(); - row.ind = row.ind_first; - row.val = row.val_first; - row.rlen = row.rlen_first; - row.row_size = row.row_size_first; - row.val_str = row.val_str_first; - DBUG_PRINT("info",("spider tmp_str1.length()=%u", tmp_str1.length())); - DBUG_PRINT("info",("spider tmp_str2.length()=%u", tmp_str2.length())); - DBUG_PRINT("info",("spider tmp_str3.length()=%u", tmp_str3.length())); - memcpy(row.ind, tmp_str3.ptr(), tmp_str3.length()); - memcpy(row.row_size, tmp_str1.ptr(), tmp_str1.length()); - row.field_count = tmp_str1.length() / sizeof(ulong); - str = tmp_str2.ptr(); - for (i = 0; i < row.field_count; i++) - { - row.val_str[i].length(0); - if (row.row_size[i]) - { - if (row.val_str[i].reserve(row.row_size[i])) - { - store_error_num = HA_ERR_OUT_OF_MEM; - DBUG_RETURN(NULL); - } - row.val_str[i].q_append(str, row.row_size[i]); - str += row.row_size[i]; - } - } - row.record_size = tmp_str2.length(); - DBUG_RETURN((SPIDER_DB_ROW *) &row); -} - -int spider_db_oracle_result::fetch_table_status( - int mode, - ha_statistics &stat -) { - DBUG_ENTER("spider_db_oracle_result::fetch_table_status"); - DBUG_PRINT("info",("spider this=%p", this)); - /* TODO: develop later */ - stat.records = 2; - stat.mean_rec_length = 65535; - stat.data_file_length = 65535; - stat.max_data_file_length = 65535; - stat.index_file_length = 65535; -/* - auto_increment_value = 0; -*/ - stat.create_time = (time_t) 0; - stat.update_time = (time_t) 0; - stat.check_time = (time_t) 0; - DBUG_RETURN(0); -} - -int spider_db_oracle_result::fetch_table_records( - int mode, - ha_rows &records -) { - DBUG_ENTER("spider_db_oracle_result::fetch_table_records"); - DBUG_PRINT("info",("spider this=%p", this)); - if (!fetch_row()) - { - records = 0; - } else { - records = row.val_int(); - } - DBUG_RETURN(0); -} - -int spider_db_oracle_result::fetch_table_cardinality( - int mode, - TABLE *table, - longlong *cardinality, - uchar *cardinality_upd, - int bitmap_size -) { - DBUG_ENTER("spider_db_oracle_result::fetch_table_cardinality"); - DBUG_PRINT("info",("spider this=%p", this)); - /* TODO: develop later */ - DBUG_RETURN(0); -} - -int spider_db_oracle_result::fetch_table_mon_status( - int &status -) { - DBUG_ENTER("spider_db_oracle_result::fetch_table_mon_status"); - DBUG_PRINT("info",("spider this=%p", this)); - /* TODO: develop later */ - status = SPIDER_LINK_MON_OK; - DBUG_RETURN(0); -} - -longlong spider_db_oracle_result::num_rows() -{ - sword res; - ub4 rowcnt; - DBUG_ENTER("spider_db_oracle_result::num_rows"); - DBUG_PRINT("info",("spider this=%p", this)); - res = OCIAttrGet(stmtp, OCI_HTYPE_STMT, &rowcnt, 0, - OCI_ATTR_ROW_COUNT, db_conn->errhp); - if (res != OCI_SUCCESS) - { - spider_db_oracle_get_error(res, db_conn->errhp, 0, NULL, NULL, - access_charset, NULL); - DBUG_RETURN(0); - } - DBUG_PRINT("info",("spider rowcnt=%u", rowcnt)); - DBUG_RETURN((longlong) rowcnt); -} - -uint spider_db_oracle_result::num_fields() -{ - sword res; - ub4 parmcnt; - DBUG_ENTER("spider_db_oracle_result::num_fields"); - DBUG_PRINT("info",("spider this=%p", this)); - res = OCIAttrGet(stmtp, OCI_HTYPE_STMT, &parmcnt, 0, - OCI_ATTR_PARAM_COUNT, db_conn->errhp); - if (res != OCI_SUCCESS) - { - spider_db_oracle_get_error(res, db_conn->errhp, 0, NULL, NULL, - access_charset, NULL); - DBUG_RETURN(0); - } - DBUG_RETURN((uint) parmcnt); -} - -void spider_db_oracle_result::move_to_pos( - longlong pos -) { - sword res; - DBUG_ENTER("spider_db_oracle_result::move_to_pos"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_PRINT("info",("spider pos=%lld", pos)); - res = OCIStmtFetch2(stmtp, db_conn->errhp, 1, OCI_FETCH_ABSOLUTE, pos, - OCI_DEFAULT); - if (res != OCI_SUCCESS) - { - spider_db_oracle_get_error(res, db_conn->errhp, 0, NULL, NULL, - access_charset, NULL); - } - DBUG_VOID_RETURN; -} - -int spider_db_oracle_result::set_column_info() -{ - sword res; - uint i; - DBUG_ENTER("spider_db_oracle_result::set_column_info"); - DBUG_PRINT("info",("spider this=%p", this)); - for (i = 0; i < field_count; i++) - { - res = OCIParamGet(stmtp, OCI_HTYPE_STMT, db_conn->errhp, - (dvoid **) &row.colhp[i], i + 1); - if (res != OCI_SUCCESS) - { - DBUG_RETURN(spider_db_oracle_get_error(res, db_conn->errhp, 0, NULL, - NULL, access_charset, NULL)); - } - res = OCIAttrGet(row.colhp[i], OCI_DTYPE_PARAM, &row.coltp[i], NULL, - OCI_ATTR_DATA_TYPE, db_conn->errhp); - if (res != OCI_SUCCESS) - { - DBUG_RETURN(spider_db_oracle_get_error(res, db_conn->errhp, 0, NULL, - NULL, access_charset, NULL)); - } - res = OCIAttrGet(row.colhp[i], OCI_DTYPE_PARAM, &row.colsz[i], NULL, - OCI_ATTR_DATA_SIZE, db_conn->errhp); - if (res != OCI_SUCCESS) - { - DBUG_RETURN(spider_db_oracle_get_error(res, db_conn->errhp, 0, NULL, - NULL, access_charset, NULL)); - } - } - DBUG_RETURN(0); -} - -int spider_db_oracle_result::get_errno() -{ - DBUG_ENTER("spider_db_oracle_result::get_errno"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_PRINT("info",("spider store_error_num=%d", store_error_num)); - DBUG_RETURN(store_error_num); -} - -#ifdef SPIDER_HAS_DISCOVER_TABLE_STRUCTURE -int spider_db_oracle_result::fetch_columns_for_discover_table_structure( - spider_string *str, - CHARSET_INFO *access_charset -) { - DBUG_ENTER("spider_db_oracle_result::fetch_columns_for_discover_table_structure"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(HA_ERR_WRONG_COMMAND); -} - -int spider_db_oracle_result::fetch_index_for_discover_table_structure( - spider_string *str, - CHARSET_INFO *access_charset -) { - DBUG_ENTER("spider_db_oracle_result::fetch_index_for_discover_table_structure"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(HA_ERR_WRONG_COMMAND); -} - -int spider_db_oracle_result::fetch_table_for_discover_table_structure( - spider_string *str, - SPIDER_SHARE *spider_share, - CHARSET_INFO *access_charset -) { - DBUG_ENTER("spider_db_oracle_result::fetch_table_for_discover_table_structure"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(HA_ERR_WRONG_COMMAND); -} -#endif - -spider_db_oracle::spider_db_oracle( - SPIDER_CONN *conn -) : spider_db_conn(conn), envhp(NULL), errhp(NULL), srvhp(NULL), svchp(NULL), - usrhp(NULL), stmtp(NULL), txnhp(NULL), result(NULL), table_lock_mode(0), - lock_table_hash_inited(FALSE), handler_open_array_inited(FALSE) -{ - DBUG_ENTER("spider_db_oracle::spider_db_oracle"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_VOID_RETURN; -} - -spider_db_oracle::~spider_db_oracle() -{ - DBUG_ENTER("spider_db_oracle::~spider_db_oracle"); - DBUG_PRINT("info",("spider this=%p", this)); - if (handler_open_array_inited) - { - reset_opened_handler(); - spider_free_mem_calc(spider_current_trx, - handler_open_array_id, - handler_open_array.max_element * - handler_open_array.size_of_element); - delete_dynamic(&handler_open_array); - } - if (lock_table_hash_inited) - { - spider_free_mem_calc(spider_current_trx, - lock_table_hash_id, - lock_table_hash.array.max_element * - lock_table_hash.array.size_of_element); - my_hash_free(&lock_table_hash); - } - disconnect(); - DBUG_VOID_RETURN; -} - -int spider_db_oracle::init() -{ - DBUG_ENTER("spider_db_oracle::init"); - DBUG_PRINT("info",("spider this=%p", this)); - if ( - my_hash_init(&lock_table_hash, spd_charset_utf8mb3_bin, 32, 0, 0, - (my_hash_get_key) spider_link_get_key, 0, 0) - ) { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - spider_alloc_calc_mem_init(lock_table_hash, SPD_MID_DB_ORACLE_INIT_1); - spider_alloc_calc_mem(spider_current_trx, - lock_table_hash, - lock_table_hash.array.max_element * - lock_table_hash.array.size_of_element); - lock_table_hash_inited = TRUE; - - if ( - SPD_INIT_DYNAMIC_ARRAY2(&handler_open_array, - sizeof(SPIDER_LINK_FOR_HASH *), NULL, 16, 16, MYF(MY_WME)) - ) { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - spider_alloc_calc_mem_init(handler_open_array, SPD_MID_DB_ORACLE_INIT_2); - spider_alloc_calc_mem(spider_current_trx, - handler_open_array, - handler_open_array.max_element * - handler_open_array.size_of_element); - handler_open_array_inited = TRUE; - DBUG_RETURN(0); -} - -bool spider_db_oracle::is_connected() -{ - DBUG_ENTER("spider_db_oracle::is_connected"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(svchp); -} - -void spider_db_oracle::bg_connect() -{ - sword res; - DBUG_ENTER("spider_db_oracle::bg_connect"); - DBUG_PRINT("info",("spider this=%p", this)); - res = OCIEnvNlsCreate(&envhp, OCI_DEFAULT, 0, 0, 0, 0, 0, 0, 0, 0); -/* - res = OCIEnvCreate(&envhp, OCI_THREADED, 0, 0, 0, 0, 0, 0); -*/ - if (res != OCI_SUCCESS) - { - DBUG_PRINT("info",("spider create environment error")); - stored_error_num = set_error(res, errhp, 0, NULL, NULL); - goto error; - } - DBUG_PRINT("info",("spider OCI init envhp=%p", envhp)); - - res = OCIHandleAlloc(envhp, (dvoid **) &errhp, OCI_HTYPE_ERROR, 0, 0); - if (res != OCI_SUCCESS) - { - DBUG_PRINT("info",("spider create error handler error")); - stored_error_num = set_error(res, errhp, 0, NULL, NULL); - bg_disconnect(); - goto error; - } - DBUG_PRINT("info",("spider OCI init errhp=%p", errhp)); - - res = OCIHandleAlloc(envhp, (dvoid **) &srvhp, OCI_HTYPE_SERVER, 0, 0); - if (res != OCI_SUCCESS) - { - DBUG_PRINT("info",("spider create server handler error")); - stored_error_num = set_error(res, errhp, 0, NULL, NULL); - bg_disconnect(); - goto error; - } - DBUG_PRINT("info",("spider OCI init srvhp=%p", srvhp)); - - res = OCIServerAttach(srvhp, errhp, (OraText *) tgt_host, strlen(tgt_host), - OCI_DEFAULT); - if (res != OCI_SUCCESS) - { - DBUG_PRINT("info",("spider attach server error")); - stored_error_num = set_error(res, errhp, 0, NULL, NULL); - bg_disconnect(); - goto error; - } - - res = OCIHandleAlloc(envhp, (dvoid **) &svchp, OCI_HTYPE_SVCCTX, 0, 0); - if (res != OCI_SUCCESS) - { - DBUG_PRINT("info",("spider create service context error")); - stored_error_num = set_error(res, errhp, 0, NULL, NULL); - bg_disconnect(); - goto error; - } - DBUG_PRINT("info",("spider OCI init svchp=%p", svchp)); - - res = OCIAttrSet(svchp, OCI_HTYPE_SVCCTX, srvhp, 0, OCI_ATTR_SERVER, errhp); - if (res != OCI_SUCCESS) - { - DBUG_PRINT("info",("spider set server attr error")); - stored_error_num = set_error(res, errhp, 0, NULL, NULL); - bg_disconnect(); - goto error; - } - - res = OCIHandleAlloc(envhp, (dvoid **) &usrhp, OCI_HTYPE_SESSION, 0, 0); - if (res != OCI_SUCCESS) - { - DBUG_PRINT("info",("spider create session handler error")); - stored_error_num = set_error(res, errhp, 0, NULL, NULL); - bg_disconnect(); - goto error; - } - DBUG_PRINT("info",("spider OCI init usrhp=%p", usrhp)); - - res = OCIAttrSet(usrhp, OCI_HTYPE_SESSION, - tgt_username, strlen(tgt_username), OCI_ATTR_USERNAME, errhp); - if (res != OCI_SUCCESS) - { - DBUG_PRINT("info",("spider set username attr error")); - stored_error_num = set_error(res, errhp, 0, NULL, NULL); - bg_disconnect(); - goto error; - } - - res = OCIAttrSet(usrhp, OCI_HTYPE_SESSION, - tgt_password, strlen(tgt_password), OCI_ATTR_PASSWORD, errhp); - if (res != OCI_SUCCESS) - { - DBUG_PRINT("info",("spider set password attr error")); - stored_error_num = set_error(res, errhp, 0, NULL, NULL); - bg_disconnect(); - goto error; - } - - res = OCISessionBegin(svchp, errhp, usrhp, OCI_CRED_RDBMS, OCI_DEFAULT); - if (res != OCI_SUCCESS) - { - DBUG_PRINT("info",("spider session begin error")); - stored_error_num = set_error(res, errhp, 0, NULL, NULL); - bg_disconnect(); - goto error; - } - DBUG_PRINT("info",("spider OCISessionBegin")); - - // set the session in the context handle - res = OCIAttrSet(svchp, OCI_HTYPE_SVCCTX, usrhp, 0, OCI_ATTR_SESSION, errhp); - if (res != OCI_SUCCESS) - { - DBUG_PRINT("info",("spider set session attr error")); - stored_error_num = set_error(res, errhp, 0, NULL, NULL); - bg_disconnect(); - goto error; - } - - if ( - (stored_error_num = exec_query(SPIDER_SQL_SET_NLS_DATE_FORMAT_STR, - SPIDER_SQL_SET_NLS_DATE_FORMAT_LEN, -1)) || - (stored_error_num = exec_query(SPIDER_SQL_SET_NLS_TIME_FORMAT_STR, - SPIDER_SQL_SET_NLS_TIME_FORMAT_LEN, -1)) || - (stored_error_num = exec_query(SPIDER_SQL_SET_NLS_TIMESTAMP_FORMAT_STR, - SPIDER_SQL_SET_NLS_TIMESTAMP_FORMAT_LEN, -1)) - ) { - DBUG_PRINT("info",("spider init connection error")); - bg_disconnect(); - goto error; - } - DBUG_VOID_RETURN; - -error: - strmov(stored_error_msg, spider_stmt_da_message(current_thd)); - current_thd->clear_error(); - DBUG_VOID_RETURN; -} - -int spider_db_oracle::connect( - char *tgt_host, - char *tgt_username, - char *tgt_password, - long tgt_port, - char *tgt_socket, - char *server_name, - int connect_retry_count, - longlong connect_retry_interval -) { - int error_num; - DBUG_ENTER("spider_db_oracle::connect"); - DBUG_PRINT("info",("spider this=%p", this)); - this->tgt_host = tgt_host; - this->tgt_username = tgt_username; - this->tgt_password = tgt_password; - this->tgt_port = tgt_port; - this->tgt_socket = tgt_socket; - this->server_name = server_name; - this->connect_retry_count = connect_retry_count; - this->connect_retry_interval = connect_retry_interval; - if ((error_num = spider_create_conn_thread(conn))) - DBUG_RETURN(error_num); - spider_bg_conn_simple_action(conn, SPIDER_SIMPLE_CONNECT, TRUE, NULL, - 0, NULL); - - if (stored_error_num) - { - my_message(stored_error_num, stored_error_msg, MYF(0)); - DBUG_RETURN(stored_error_num); - } - DBUG_RETURN(0); -} - -int spider_db_oracle::ping( -) { - sword res; - DBUG_ENTER("spider_db_oracle::ping"); - DBUG_PRINT("info",("spider this=%p", this)); - res = OCIPing(svchp, errhp, OCI_DEFAULT); - if (res != OCI_SUCCESS) - { - DBUG_PRINT("info",("spider ping error %d", res)); - DBUG_RETURN(ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM); - } - DBUG_RETURN(0); -} - -void spider_db_oracle::bg_disconnect() -{ - DBUG_ENTER("spider_db_oracle::bg_disconnect"); - DBUG_PRINT("info",("spider this=%p", this)); - if (result) - { - delete result; - result = NULL; - } - if (txnhp) - { - DBUG_PRINT("info",("spider OCI free txnhp=%p", txnhp)); - OCIHandleFree(txnhp, OCI_HTYPE_TRANS); - txnhp = NULL; - } - if (stmtp) - { - DBUG_PRINT("info",("spider OCI free stmtp=%p", stmtp)); - OCIHandleFree(stmtp, OCI_HTYPE_STMT); - stmtp = NULL; - } - if (svchp && errhp && usrhp) - { - DBUG_PRINT("info",("spider OCISessionEnd")); - OCISessionEnd(svchp, errhp, usrhp, OCI_DEFAULT); - } - if (usrhp) - { - DBUG_PRINT("info",("spider OCI free usrhp=%p", usrhp)); - OCIHandleFree(usrhp, OCI_HTYPE_SESSION); - usrhp = NULL; - } - if (svchp) - { - DBUG_PRINT("info",("spider OCI free svchp=%p", svchp)); - OCIHandleFree(svchp, OCI_HTYPE_SVCCTX); - svchp = NULL; - } - if (srvhp) - { - DBUG_PRINT("info",("spider OCI free srvhp=%p", srvhp)); - OCIServerDetach(srvhp, errhp, OCI_DEFAULT); - OCIHandleFree(srvhp, OCI_HTYPE_SERVER); - srvhp = NULL; - } - if (errhp) - { - DBUG_PRINT("info",("spider OCI free errhp=%p", errhp)); - OCIHandleFree(errhp, OCI_HTYPE_ERROR); - errhp = NULL; - } - if (envhp) - { - DBUG_PRINT("info",("spider OCI free envhp=%p", envhp)); - OCIHandleFree(envhp, OCI_HTYPE_ENV); - envhp = NULL; - } - DBUG_VOID_RETURN; -} - -void spider_db_oracle::disconnect() -{ - DBUG_ENTER("spider_db_oracle::disconnect"); - DBUG_PRINT("info",("spider this=%p", this)); - if (!conn->bg_init) - DBUG_VOID_RETURN; - spider_bg_conn_simple_action(conn, SPIDER_SIMPLE_DISCONNECT, TRUE, NULL, - 0, NULL); - DBUG_VOID_RETURN; -} - -int spider_db_oracle::set_net_timeout() -{ - DBUG_ENTER("spider_db_oracle::set_net_timeout"); - DBUG_PRINT("info",("spider this=%p", this)); - /* TODO: develop later */ - DBUG_RETURN(0); -} - -int spider_db_oracle::exec_query( - const char *query, - uint length, - int quick_mode -) { - sword res; - int error_num; - DBUG_ENTER("spider_db_oracle::exec_query"); - DBUG_PRINT("info",("spider this=%p", this)); - if (spider_param_general_log()) - { - const char *tgt_str = conn->tgt_host; - uint32 tgt_len = conn->tgt_host_length; - spider_string tmp_query_str(length + conn->tgt_wrapper_length + - tgt_len + (SPIDER_SQL_SPACE_LEN * 2)); - tmp_query_str.init_calc_mem(SPD_MID_DB_ORACLE_EXEC_QUERY_1); - tmp_query_str.length(0); - tmp_query_str.q_append(conn->tgt_wrapper, conn->tgt_wrapper_length); - tmp_query_str.q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN); - tmp_query_str.q_append(tgt_str, tgt_len); - tmp_query_str.q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN); - tmp_query_str.q_append(query, length); - general_log_write(current_thd, COM_QUERY, tmp_query_str.ptr(), - tmp_query_str.length()); - } - stored_error_num = 0; - if (table_lock_mode && !conn->in_before_query) - { - DBUG_PRINT("info",("spider table_lock_mode=%d", table_lock_mode)); - table_lock_mode = 0; - if ((error_num = exec_query(exec_lock_sql->ptr(), exec_lock_sql->length(), - -1))) { - DBUG_RETURN(error_num); - } - } - - if (length) - { - if (result) - { - delete result; - result = NULL; - } - - if (!stmtp) - { - DBUG_PRINT("info",("spider create stmt")); - res = OCIHandleAlloc(envhp, (dvoid **) &stmtp, OCI_HTYPE_STMT, 0, 0); - if (res != OCI_SUCCESS) - { - DBUG_PRINT("info",("spider create stmt handler error")); - DBUG_RETURN(set_error(res, errhp, 0, NULL, NULL)); - } - } - - res = OCIStmtPrepare(stmtp, errhp, (OraText *) query, length, - OCI_NTV_SYNTAX, OCI_DEFAULT); - if (res != OCI_SUCCESS) - { - DBUG_PRINT("info",("spider stmt prepare error")); - DBUG_RETURN(set_error(res, errhp, 0, NULL, NULL)); - } - -/* - if ((result = new spider_db_oracle_result())) - { - result->db_conn = this; - result->stmtp = stmtp; - stmtp = NULL; - result->field_count = result->num_fields(); - result->row.field_count = result->field_count; - result->row.db_conn = this; - result->row.result = result; - if ((error_num = result->row.init())) - { - delete result; - result = NULL; - DBUG_RETURN(error_num); - } - } else { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } -*/ - - /* select statement check */ - ub4 iters; - if ( - !strncasecmp(query, "select ", sizeof("select ") - 1) || - !strncasecmp(query, "(select ", sizeof("(select ") - 1) - ) { - iters = 0; - } else { - iters = 1; - } - - if (quick_mode) - { - DBUG_PRINT("info",("spider use OCI_DEFAULT")); - res = OCIStmtExecute(svchp, stmtp, errhp, iters, 0, NULL, NULL, - OCI_DEFAULT); - } else { - DBUG_PRINT("info",("spider use OCI_STMT_SCROLLABLE_READONLY")); - res = OCIStmtExecute(svchp, stmtp, errhp, iters, 0, NULL, NULL, - OCI_STMT_SCROLLABLE_READONLY); -/* - if (res == OCI_SUCCESS) - { - DBUG_PRINT("info",("spider fetch last for row count")); - res = OCIStmtFetch2(result->stmtp, errhp, 1, OCI_FETCH_LAST, 0, - OCI_DEFAULT); - } - if (res == OCI_SUCCESS) - { - DBUG_PRINT("info",("spider fetch first for row count")); - res = OCIStmtFetch2(result->stmtp, errhp, 1, OCI_FETCH_FIRST, 0, - OCI_DEFAULT); - } -*/ - } - if (res == OCI_SUCCESS && iters) - { - DBUG_PRINT("info",("spider get row count")); - ub4 row_count; - res = OCIAttrGet(stmtp, OCI_HTYPE_STMT, &row_count, 0, - OCI_ATTR_ROW_COUNT, errhp); - update_rows = (uint) row_count; - DBUG_PRINT("info",("spider row_count=%u", update_rows)); - } - if (res != OCI_SUCCESS) - { - DBUG_PRINT("info",("spider stmt execute error")); - error_num = set_error(res, errhp, 0, NULL, NULL); - if (error_num == HA_ERR_END_OF_FILE) - DBUG_RETURN(0); - DBUG_RETURN(error_num); - } - - if ((result = new spider_db_oracle_result(this))) - { - result->db_conn = this; - result->stmtp = stmtp; - stmtp = NULL; - result->field_count = result->num_fields(); - result->row.field_count = result->field_count; - result->row.db_conn = this; - result->row.result = result; - result->row.access_charset = conn->access_charset; - result->access_charset = conn->access_charset; - if ( - (error_num = result->row.init()) || - (error_num = result->set_column_info()) - ) { - delete result; - result = NULL; - DBUG_RETURN(error_num); - } - result->row.define(); - } else { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - - if (!quick_mode && !iters) - { - if (res == OCI_SUCCESS) - { - DBUG_PRINT("info",("spider fetch last for row count")); - res = OCIStmtFetch2(result->stmtp, errhp, 1, OCI_FETCH_LAST, 0, - OCI_DEFAULT); - } - if (res == OCI_SUCCESS) - { - DBUG_PRINT("info",("spider fetch first for row count")); - res = OCIStmtFetch2(result->stmtp, errhp, 1, OCI_FETCH_FIRST, 0, - OCI_DEFAULT); - } - if (res != OCI_SUCCESS) - { - DBUG_PRINT("info",("spider stmt execute error")); - error_num = set_error(res, errhp, 0, NULL, NULL); - if (error_num == HA_ERR_END_OF_FILE) - DBUG_RETURN(0); - DBUG_RETURN(error_num); - } - result->fetched = TRUE; - } - } - DBUG_RETURN(0); -} - -int spider_db_oracle::get_errno() -{ - DBUG_ENTER("spider_db_oracle::get_errno"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_PRINT("info",("spider stored_error=%d", stored_error_num)); - DBUG_RETURN(stored_error_num); -} - -const char *spider_db_oracle::get_error() -{ - DBUG_ENTER("spider_db_oracle::get_error"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_PRINT("info",("spider error=%s", stored_error)); - DBUG_RETURN(stored_error); -} - -bool spider_db_oracle::is_server_gone_error( - int error_num -) { - DBUG_ENTER("spider_db_oracle::is_server_gone_error"); - DBUG_PRINT("info",("spider this=%p", this)); - /* TODO: develop later */ - DBUG_RETURN(FALSE); -} - -bool spider_db_oracle::is_dup_entry_error( - int error_num -) { - DBUG_ENTER("spider_db_oracle::is_dup_entry_error"); - DBUG_PRINT("info",("spider this=%p", this)); - if (error_num == HA_ERR_FOUND_DUPP_KEY) - DBUG_RETURN(TRUE); - DBUG_RETURN(FALSE); -} - -bool spider_db_oracle::is_xa_nota_error( - int error_num -) { - DBUG_ENTER("spider_db_oracle::is_xa_nota_error"); - DBUG_PRINT("info",("spider this=%p", this)); - /* TODO: develop later */ - DBUG_RETURN(FALSE); -} - -spider_db_result *spider_db_oracle::store_result( - spider_db_result_buffer **spider_res_buf, - st_spider_db_request_key *request_key, - int *error_num -) { - spider_db_oracle_result *tmp_result = result; - DBUG_ENTER("spider_db_oracle::store_result"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_ASSERT(!spider_res_buf); - if (stored_error_num == HA_ERR_END_OF_FILE) - { - *error_num = HA_ERR_END_OF_FILE; - DBUG_RETURN(NULL); - } - - *error_num = 0; - result = NULL; - DBUG_RETURN(tmp_result); -} - -spider_db_result *spider_db_oracle::use_result( - ha_spider *spider, - st_spider_db_request_key *request_key, - int *error_num -) { - spider_db_oracle_result *tmp_result = result; - DBUG_ENTER("spider_db_oracle::use_result"); - DBUG_PRINT("info",("spider this=%p", this)); - if (stored_error_num == HA_ERR_END_OF_FILE) - { - *error_num = HA_ERR_END_OF_FILE; - DBUG_RETURN(NULL); - } - - *error_num = 0; - result = NULL; - DBUG_RETURN(tmp_result); -} - -int spider_db_oracle::next_result() -{ - DBUG_ENTER("spider_db_oracle::next_result"); - DBUG_PRINT("info",("spider this=%p", this)); - /* TODO: develop later */ - DBUG_RETURN(-1); -} - -uint spider_db_oracle::affected_rows() -{ - DBUG_ENTER("spider_db_oracle::affected_rows"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(update_rows); -} - -uint spider_db_oracle::matched_rows() -{ - DBUG_ENTER("spider_db_oracle::matched_rows"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(0); -} - -bool spider_db_oracle::inserted_info( - spider_db_handler *handler, - ha_copy_info *copy_info -) { - DBUG_ENTER("spider_db_oracle::inserted_info"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(FALSE); -} - -ulonglong spider_db_oracle::last_insert_id() -{ - DBUG_ENTER("spider_db_oracle::last_insert_id"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(stored_last_insert_id); -} - -int spider_db_oracle::set_character_set( - const char *csname -) { - DBUG_ENTER("spider_db_oracle::set_character_set"); - DBUG_PRINT("info",("spider this=%p", this)); - /* TODO: develop later */ - DBUG_RETURN(0); -} - -int spider_db_oracle::select_db( - const char *dbname -) { - DBUG_ENTER("spider_db_oracle::select_db"); - DBUG_PRINT("info",("spider this=%p", this)); - /* nothing to do for oracle */ - DBUG_RETURN(0); -} - -int spider_db_oracle::consistent_snapshot( - int *need_mon -) { - DBUG_ENTER("spider_db_oracle::consistent_snapshot"); - DBUG_PRINT("info",("spider this=%p", this)); - /* nothing to do for oracle */ - DBUG_RETURN(0); -} - -bool spider_db_oracle::trx_start_in_bulk_sql() -{ - DBUG_ENTER("spider_db_oracle::trx_start_in_bulk_sql"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(FALSE); -} - -int spider_db_oracle::start_transaction( - int *need_mon -) { - DBUG_ENTER("spider_db_oracle::start_transaction"); - DBUG_PRINT("info",("spider this=%p", this)); - if (conn->in_before_query) - { - if (conn->queued_semi_trx_isolation) - { - if (conn->queued_semi_trx_isolation_val != conn->trx_isolation) - { - /* nothing to do */ - DBUG_RETURN(0); - } - } else if (conn->queued_trx_isolation) - { - if (conn->queued_trx_isolation_val != conn->trx_isolation) - { - /* nothing to do */ - DBUG_RETURN(0); - } - } - DBUG_RETURN(set_trx_isolation(conn->trx_isolation, need_mon)); - } - pthread_mutex_assert_owner(&conn->mta_conn_mutex); - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - if (spider_db_query( - conn, - SPIDER_SQL_START_TRANSACTION_STR, - SPIDER_SQL_START_TRANSACTION_LEN, - -1, - need_mon) - ) { - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_RETURN(0); -} - -int spider_db_oracle::commit( - int *need_mon -) { - sword res; - DBUG_ENTER("spider_db_oracle::commit"); - DBUG_PRINT("info",("spider this=%p", this)); - if (conn->table_locked) - { - conn->table_locked = FALSE; - spider_current_trx->locked_connections--; - } - res = OCITransCommit(svchp, errhp, OCI_DEFAULT); - if (res != OCI_SUCCESS) - { - *need_mon = set_error(res, errhp, 0, NULL, NULL); - DBUG_RETURN(*need_mon); - } - DBUG_RETURN(0); -} - -int spider_db_oracle::rollback( - int *need_mon -) { - sword res; - DBUG_ENTER("spider_db_oracle::rollback"); - DBUG_PRINT("info",("spider this=%p", this)); - if (conn->table_locked) - { - conn->table_locked = FALSE; - spider_current_trx->locked_connections--; - } - if (svchp && errhp) - { - res = OCITransRollback(svchp, errhp, OCI_DEFAULT); - if (res != OCI_SUCCESS) - { - *need_mon = set_error(res, errhp, 0, NULL, NULL); - DBUG_RETURN(*need_mon); - } - } - DBUG_RETURN(0); -} - -bool spider_db_oracle::xa_start_in_bulk_sql() -{ - DBUG_ENTER("spider_db_oracle::xa_start_in_bulk_sql"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(FALSE); -} - -int spider_db_oracle::xa_start( - XID *xid, - int *need_mon -) { - sword res; - DBUG_ENTER("spider_db_oracle::xa_start"); - DBUG_PRINT("info",("spider this=%p", this)); - if (txnhp) - { - OCIHandleFree(txnhp, OCI_HTYPE_TRANS); - txnhp = NULL; - } - OCIHandleAlloc((dvoid *)envhp, (dvoid **)&txnhp, OCI_HTYPE_TRANS, 0, 0); - OCIAttrSet((dvoid *)svchp, OCI_HTYPE_SVCCTX, (dvoid *)txnhp, 0, - OCI_ATTR_TRANS, errhp); - OCIAttrSet((dvoid *)txnhp, OCI_HTYPE_TRANS, (dvoid *)xid, sizeof(XID), - OCI_ATTR_XID, errhp); - - res = OCITransStart(svchp, errhp, 31622400, OCI_TRANS_NEW); - if (res != OCI_SUCCESS) - { - *need_mon = set_error(res, errhp, 0, NULL, NULL); - DBUG_RETURN(*need_mon); - } - DBUG_RETURN(0); -} - -int spider_db_oracle::xa_end( - XID *xid, - int *need_mon -) { - DBUG_ENTER("spider_db_oracle::xa_end"); - DBUG_PRINT("info",("spider this=%p", this)); - /* nothing to do for oracle */ - DBUG_RETURN(0); -} - -int spider_db_oracle::xa_prepare( - XID *xid, - int *need_mon -) { - sword res; - DBUG_ENTER("spider_db_oracle::xa_prepare"); - DBUG_PRINT("info",("spider this=%p", this)); - res = OCITransPrepare(svchp, errhp, OCI_DEFAULT); - if (res != OCI_SUCCESS) - { - *need_mon = set_error(res, errhp, 0, NULL, NULL); - DBUG_RETURN(*need_mon); - } - DBUG_RETURN(0); -} - -int spider_db_oracle::xa_commit( - XID *xid, - int *need_mon -) { - sword res; - DBUG_ENTER("spider_db_oracle::xa_commit"); - DBUG_PRINT("info",("spider this=%p", this)); - if (conn->table_locked) - { - conn->table_locked = FALSE; - spider_current_trx->locked_connections--; - } - res = OCITransCommit(svchp, errhp, OCI_TRANS_TWOPHASE); - if (res != OCI_SUCCESS) - { - *need_mon = set_error(res, errhp, 0, NULL, NULL); - if (txnhp) - { - OCIHandleFree(txnhp, OCI_HTYPE_TRANS); - txnhp = NULL; - } - DBUG_RETURN(*need_mon); - } - if (txnhp) - { - OCIHandleFree(txnhp, OCI_HTYPE_TRANS); - txnhp = NULL; - } - DBUG_RETURN(0); -} - -int spider_db_oracle::xa_rollback( - XID *xid, - int *need_mon -) { - sword res; - DBUG_ENTER("spider_db_oracle::xa_rollback"); - DBUG_PRINT("info",("spider this=%p", this)); - if (svchp && errhp) - { - res = OCITransRollback(svchp, errhp, OCI_DEFAULT); - if (res != OCI_SUCCESS) - { - *need_mon = set_error(res, errhp, 0, NULL, NULL); - if (txnhp) - { - OCIHandleFree(txnhp, OCI_HTYPE_TRANS); - txnhp = NULL; - } - DBUG_RETURN(*need_mon); - } - } - if (txnhp) - { - OCIHandleFree(txnhp, OCI_HTYPE_TRANS); - txnhp = NULL; - } - DBUG_RETURN(0); -} - -bool spider_db_oracle::set_trx_isolation_in_bulk_sql() -{ - DBUG_ENTER("spider_db_oracle::set_trx_isolation_in_bulk_sql"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(FALSE); -} - -int spider_db_oracle::set_trx_isolation( - int trx_isolation, - int *need_mon -) { - DBUG_ENTER("spider_db_oracle::set_trx_isolation"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (trx_isolation) - { - case ISO_READ_UNCOMMITTED: - case ISO_READ_COMMITTED: - if (conn->in_before_query) - { - DBUG_RETURN(exec_query(SPIDER_SQL_ISO_READ_COMMITTED_STR, - SPIDER_SQL_ISO_READ_COMMITTED_LEN, -1)); - } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - SPIDER_SQL_ISO_READ_COMMITTED_STR, - SPIDER_SQL_ISO_READ_COMMITTED_LEN, - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - break; - case ISO_REPEATABLE_READ: - case ISO_SERIALIZABLE: - if (conn->in_before_query) - { - DBUG_RETURN(exec_query(SPIDER_SQL_ISO_SERIALIZABLE_STR, - SPIDER_SQL_ISO_SERIALIZABLE_LEN, -1)); - } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - SPIDER_SQL_ISO_SERIALIZABLE_STR, - SPIDER_SQL_ISO_SERIALIZABLE_LEN, - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - break; - default: - DBUG_RETURN(HA_ERR_UNSUPPORTED); - } - DBUG_RETURN(0); -} - -bool spider_db_oracle::set_autocommit_in_bulk_sql() -{ - DBUG_ENTER("spider_db_oracle::set_autocommit_in_bulk_sql"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(FALSE); -} - -int spider_db_oracle::set_autocommit( - bool autocommit, - int *need_mon -) { - DBUG_ENTER("spider_db_oracle::set_autocommit"); - DBUG_PRINT("info",("spider this=%p", this)); - if (autocommit) - { - if (conn->in_before_query) - { - DBUG_RETURN(exec_query(SPIDER_SQL_AUTOCOMMIT_ON_STR, - SPIDER_SQL_AUTOCOMMIT_ON_LEN, -1)); - } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - SPIDER_SQL_AUTOCOMMIT_ON_STR, - SPIDER_SQL_AUTOCOMMIT_ON_LEN, - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - } else { - if (conn->in_before_query) - { - DBUG_RETURN(exec_query(SPIDER_SQL_AUTOCOMMIT_OFF_STR, - SPIDER_SQL_AUTOCOMMIT_OFF_LEN, -1)); - } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - SPIDER_SQL_AUTOCOMMIT_OFF_STR, - SPIDER_SQL_AUTOCOMMIT_OFF_LEN, - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - } - DBUG_RETURN(0); -} - -bool spider_db_oracle::set_sql_log_off_in_bulk_sql() -{ - DBUG_ENTER("spider_db_oracle::set_sql_log_off_in_bulk_sql"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(FALSE); -} - -int spider_db_oracle::set_sql_log_off( - bool sql_log_off, - int *need_mon -) { - DBUG_ENTER("spider_db_oracle::set_sql_log_off"); - DBUG_PRINT("info",("spider this=%p", this)); - /* nothing to do */ - DBUG_RETURN(0); -} - -bool spider_db_oracle::set_wait_timeout_in_bulk_sql() -{ - DBUG_ENTER("spider_db_oracle::set_wait_timeout_in_bulk_sql"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(FALSE); -} - -int spider_db_oracle::set_wait_timeout( - int wait_timeout, - int *need_mon -) { - DBUG_ENTER("spider_db_oracle::set_wait_timeout"); - DBUG_PRINT("info",("spider this=%p", this)); - /* nothing to do */ - DBUG_RETURN(0); -} - -bool spider_db_oracle::set_sql_mode_in_bulk_sql() -{ - DBUG_ENTER("spider_db_oracle::set_sql_mode_in_bulk_sql"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(FALSE); -} - -int spider_db_oracle::set_sql_mode( - sql_mode_t sql_mode, - int *need_mon -) { - DBUG_ENTER("spider_db_oracle::set_sql_mode"); - DBUG_PRINT("info",("spider this=%p", this)); - /* nothing to do */ - DBUG_RETURN(0); -} - -bool spider_db_oracle::set_time_zone_in_bulk_sql() -{ - DBUG_ENTER("spider_db_oracle::set_time_zone_in_bulk_sql"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(FALSE); -} - -int spider_db_oracle::set_time_zone( - Time_zone *time_zone, - int *need_mon -) { - DBUG_ENTER("spider_db_oracle::set_time_zone"); - DBUG_PRINT("info",("spider this=%p", this)); - /* nothing to do */ - DBUG_RETURN(0); -} - -int spider_db_oracle::show_master_status( - SPIDER_TRX *trx, - SPIDER_SHARE *share, - int all_link_idx, - int *need_mon, - TABLE *table, - spider_string *str, - int mode, - SPIDER_DB_RESULT **res1, - SPIDER_DB_RESULT **res2 -) { - DBUG_ENTER("spider_db_oracle::show_master_status"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(0); -} - - -size_t spider_db_oracle::escape_string( - char *to, - const char *from, - size_t from_length -) { - DBUG_ENTER("spider_db_oracle::escape_string"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(util.escape_string(to, from, from_length, conn->access_charset)); -} - -bool spider_db_oracle::have_lock_table_list() -{ - DBUG_ENTER("spider_db_oracle::have_lock_table_list"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(lock_table_hash.records); -} - -int spider_db_oracle::append_lock_tables( - spider_string *str -) { - int error_num; - ha_spider *tmp_spider; - int lock_type; - uint conn_link_idx; - int tmp_link_idx; - SPIDER_LINK_FOR_HASH *tmp_link_for_hash; - const char *db_name; - uint db_name_length; - CHARSET_INFO *db_name_charset; - const char *table_name; - uint table_name_length; - CHARSET_INFO *table_name_charset; - DBUG_ENTER("spider_db_oracle::lock_tables"); - DBUG_PRINT("info",("spider this=%p", this)); - if ((tmp_link_for_hash = - (SPIDER_LINK_FOR_HASH *) my_hash_element(&lock_table_hash, 0))) - { - if ((error_num = spider_db_oracle_utility.append_lock_table_head(str))) - { - DBUG_RETURN(error_num); - } - - tmp_spider = tmp_link_for_hash->spider; - tmp_link_idx = tmp_link_for_hash->link_idx; - switch (tmp_spider->wide_handler->lock_type) - { - case TL_READ: - lock_type = SPIDER_DB_TABLE_LOCK_READ_LOCAL; - break; - case TL_READ_NO_INSERT: - lock_type = SPIDER_DB_TABLE_LOCK_READ; - break; - case TL_WRITE_LOW_PRIORITY: - lock_type = SPIDER_DB_TABLE_LOCK_LOW_PRIORITY_WRITE; - break; - case TL_WRITE: - lock_type = SPIDER_DB_TABLE_LOCK_WRITE; - break; - default: - // no lock - DBUG_PRINT("info",("spider lock_type=%d", - tmp_spider->wide_handler->lock_type)); - DBUG_RETURN(0); - } - conn_link_idx = tmp_spider->conn_link_idx[tmp_link_idx]; - spider_oracle_share *db_share = (spider_oracle_share *) - tmp_spider->share->dbton_share[conn->dbton_id]; - if (&db_share->db_names_str[conn_link_idx]) - { - db_name = db_share->db_names_str[conn_link_idx].ptr(); - db_name_length = db_share->db_names_str[conn_link_idx].length(); - db_name_charset = tmp_spider->share->access_charset; - } else { - db_name = tmp_spider->share->tgt_dbs[conn_link_idx]; - db_name_length = tmp_spider->share->tgt_dbs_lengths[conn_link_idx]; - db_name_charset = system_charset_info; - } - if (&db_share->table_names_str[conn_link_idx]) - { - table_name = db_share->table_names_str[conn_link_idx].ptr(); - table_name_length = db_share->table_names_str[conn_link_idx].length(); - table_name_charset = tmp_spider->share->access_charset; - } else { - table_name = tmp_spider->share->tgt_table_names[conn_link_idx]; - table_name_length = - tmp_spider->share->tgt_table_names_lengths[conn_link_idx]; - table_name_charset = system_charset_info; - } - if ((error_num = spider_db_oracle_utility. - append_lock_table_body( - str, - db_name, - db_name_length, - db_name_charset, - table_name, - table_name_length, - table_name_charset, - lock_type - ) - )) { - my_hash_reset(&lock_table_hash); - DBUG_RETURN(error_num); - } - my_hash_delete(&lock_table_hash, (uchar*) tmp_link_for_hash); - - if ((error_num = spider_db_oracle_utility.append_lock_table_tail(str))) - { - DBUG_RETURN(error_num); - } - } - DBUG_RETURN(0); -} - -int spider_db_oracle::append_unlock_tables( - spider_string *str -) { - int error_num; - DBUG_ENTER("spider_db_oracle::append_unlock_tables"); - DBUG_PRINT("info",("spider this=%p", this)); - if ((error_num = spider_db_oracle_utility.append_unlock_table(str))) - { - DBUG_RETURN(error_num); - } - DBUG_RETURN(0); -} - -uint spider_db_oracle::get_lock_table_hash_count() -{ - DBUG_ENTER("spider_db_oracle::get_lock_table_hash_count"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(lock_table_hash.records); -} - -void spider_db_oracle::reset_lock_table_hash() -{ - DBUG_ENTER("spider_db_oracle::reset_lock_table_hash"); - DBUG_PRINT("info",("spider this=%p", this)); - my_hash_reset(&lock_table_hash); - DBUG_VOID_RETURN; -} - -uint spider_db_oracle::get_opened_handler_count() -{ - DBUG_ENTER("spider_db_oracle::get_opened_handler_count"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(handler_open_array.elements); -} - -void spider_db_oracle::reset_opened_handler() -{ - ha_spider *tmp_spider; - int tmp_link_idx; - SPIDER_LINK_FOR_HASH **tmp_link_for_hash; - DBUG_ENTER("spider_db_oracle::reset_opened_handler"); - DBUG_PRINT("info",("spider this=%p", this)); - while ((tmp_link_for_hash = - (SPIDER_LINK_FOR_HASH **) pop_dynamic(&handler_open_array))) - { - tmp_spider = (*tmp_link_for_hash)->spider; - tmp_link_idx = (*tmp_link_for_hash)->link_idx; - tmp_spider->clear_handler_opened(tmp_link_idx, conn->conn_kind); - } - DBUG_VOID_RETURN; -} - -void spider_db_oracle::set_dup_key_idx( - ha_spider *spider, - int link_idx -) { - TABLE *table = spider->get_table(); - uint roop_count, pk_idx = table->s->primary_key; - int key_name_length; - int max_length = 0; - char *key_name, *tmp_pos; - char buf[SPIDER_ORACLE_ERR_BUF_LEN]; - DBUG_ENTER("spider_db_oracle::set_dup_key_idx"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_PRINT("info",("spider error_str=%s", stored_error_msg)); - memcpy(buf, spider->share->tgt_dbs[link_idx], - spider->share->tgt_dbs_lengths[link_idx]); - tmp_pos = buf + spider->share->tgt_dbs_lengths[link_idx]; - *tmp_pos = '.'; - ++tmp_pos; - for (roop_count = 0; roop_count < table->s->keys; roop_count++) - { - if (roop_count == pk_idx) - { - DBUG_PRINT("info",("spider pk_idx=%u", roop_count)); - int all_link_idx = spider->conn_link_idx[link_idx]; - key_name = spider->share->tgt_pk_names[all_link_idx]; - key_name_length = spider->share->tgt_pk_names_lengths[all_link_idx]; - } else { - key_name = (char *) table->s->key_info[roop_count].name.str; - key_name_length = table->s->key_info[roop_count].name.length; - } - memcpy(tmp_pos, key_name, key_name_length + 1); - DBUG_PRINT("info",("spider key_name=%s", key_name)); - DBUG_PRINT("info",("spider full key name=%s", buf)); - if ( - max_length < key_name_length && - strcasestr(stored_error_msg, buf) - ) { - max_length = key_name_length; - spider->dup_key_idx = roop_count; - } - } - if (max_length == 0) - spider->dup_key_idx = (uint) -1; - DBUG_PRINT("info",("spider dup_key_idx=%d", spider->dup_key_idx)); - DBUG_VOID_RETURN; -} - -bool spider_db_oracle::cmp_request_key_to_snd( - st_spider_db_request_key *request_key -) { - DBUG_ENTER("spider_db_oracle::cmp_request_key_to_snd"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(TRUE); -} - -int spider_db_oracle::set_error( - sword res, - dvoid *hndlp, - int error_num, - const char *error1, - const char *error2 -) { - DBUG_ENTER("spider_db_oracle::set_error"); - DBUG_PRINT("info",("spider this=%p", this)); - stored_error_num = - spider_db_oracle_get_error(res, hndlp, error_num, error1, error2, - conn->access_charset, stored_error_msg); - if (stored_error_num) - stored_error = ER_SPIDER_ORACLE_ERR; - else - stored_error = ""; - DBUG_RETURN(stored_error_num); -} - -spider_db_oracle_util::spider_db_oracle_util() : spider_db_util() -{ - DBUG_ENTER("spider_db_oracle_util::spider_db_oracle_util"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_VOID_RETURN; -} - -spider_db_oracle_util::~spider_db_oracle_util() -{ - DBUG_ENTER("spider_db_oracle_util::~spider_db_oracle_util"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_VOID_RETURN; -} - -int spider_db_oracle_util::append_name( - spider_string *str, - const char *name, - uint name_length -) { - DBUG_ENTER("spider_db_oracle_util::append_name"); - str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); - str->q_append(name, name_length); - str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); - DBUG_RETURN(0); -} - -int spider_db_oracle_util::append_name_with_charset( - spider_string *str, - const char *name, - uint name_length, - CHARSET_INFO *name_charset -) { - DBUG_ENTER("spider_db_oracle_util::append_name_with_charset"); - if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN * 2 + name_length * 2)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); - str->append(name, name_length, name_charset); - if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); - DBUG_RETURN(0); -} - -int spider_db_oracle_util::append_escaped_name( - spider_string *str, - const char *name, - uint name_length -) { - int error_num; - DBUG_ENTER("spider_db_oracle_util::append_name"); - if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN * 2 + name_length * 2)) - { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); - if ((error_num = spider_db_append_name_with_quote_str_internal( - str, name, name_length, dbton_id))) - { - DBUG_RETURN(error_num); - } - if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN)) - { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); - DBUG_RETURN(0); -} - -int spider_db_oracle_util::append_escaped_name_with_charset( - spider_string *str, - const char *name, - uint name_length, - CHARSET_INFO *name_charset -) { - int error_num; - DBUG_ENTER("spider_db_oracle_util::append_name_with_charset"); - if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN * 2 + name_length * 2)) - { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); - if ((error_num = spider_db_append_name_with_quote_str_internal( - str, name, name_length, name_charset, dbton_id))) - { - DBUG_RETURN(error_num); - } - if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN)) - { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); - DBUG_RETURN(0); -} - -bool spider_db_oracle_util::is_name_quote( - const char head_code -) { - DBUG_ENTER("spider_db_oracle_util::is_name_quote"); - DBUG_RETURN(head_code == *name_quote_str); -} - -int spider_db_oracle_util::append_escaped_name_quote( - spider_string *str -) { - DBUG_ENTER("spider_db_oracle_util::append_escaped_name_quote"); - if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN * 2)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); - str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); - DBUG_RETURN(0); -} - -int spider_db_oracle_util::append_column_value( - ha_spider *spider, - spider_string *str, - Field *field, - const uchar *new_ptr, - CHARSET_INFO *access_charset -) { - char buf[MAX_FIELD_WIDTH]; - spider_string tmp_str(buf, MAX_FIELD_WIDTH, &my_charset_bin); - String *ptr; - uint length; - Time_zone *saved_time_zone = thd->variables.time_zone; - DBUG_ENTER("spider_db_oracle_util::append_column_value"); - tmp_str.init_calc_mem(SPD_MID_DB_ORACLE_UTIL_APPEND_COLUMN_VALUE_1); - - thd->variables.time_zone = UTC; - - if (new_ptr) - { - if ( - field->type() == MYSQL_TYPE_BLOB || - field->real_type() == MYSQL_TYPE_VARCHAR - ) { - length = uint2korr(new_ptr); - tmp_str.set_quick((char *) new_ptr + HA_KEY_BLOB_LENGTH, length, - &my_charset_bin); - ptr = tmp_str.get_str(); - } else if (field->type() == MYSQL_TYPE_GEOMETRY) - { -/* - uint mlength = SIZEOF_STORED_DOUBLE, lcnt; - uchar *dest = (uchar *) buf; - const uchar *source; - for (lcnt = 0; lcnt < 4; lcnt++) - { - mlength = SIZEOF_STORED_DOUBLE; - source = new_ptr + mlength + SIZEOF_STORED_DOUBLE * lcnt; - while (mlength--) - *dest++ = *--source; - } - tmp_str.length(SIZEOF_STORED_DOUBLE * lcnt); -*/ - double xmin, xmax, ymin, ymax; -/* - float8store(buf,xmin); - float8store(buf+8,xmax); - float8store(buf+16,ymin); - float8store(buf+24,ymax); - memcpy(&xmin,new_ptr,sizeof(xmin)); - memcpy(&xmax,new_ptr + 8,sizeof(xmax)); - memcpy(&ymin,new_ptr + 16,sizeof(ymin)); - memcpy(&ymax,new_ptr + 24,sizeof(ymax)); - float8get(xmin, buf); - float8get(xmax, buf + 8); - float8get(ymin, buf + 16); - float8get(ymax, buf + 24); - DBUG_PRINT("info", ("spider geo is %f %f %f %f", - xmin, xmax, ymin, ymax)); - DBUG_PRINT("info", ("spider geo is %.14g %.14g %.14g %.14g", - xmin, xmax, ymin, ymax)); -*/ - float8get(xmin, new_ptr); - float8get(xmax, new_ptr + 8); - float8get(ymin, new_ptr + 16); - float8get(ymax, new_ptr + 24); - DBUG_PRINT("info", ("spider geo is %f %f %f %f", - xmin, xmax, ymin, ymax)); -/* - float8get(xmin, new_ptr + SIZEOF_STORED_DOUBLE * 4); - float8get(xmax, new_ptr + SIZEOF_STORED_DOUBLE * 5); - float8get(ymin, new_ptr + SIZEOF_STORED_DOUBLE * 6); - float8get(ymax, new_ptr + SIZEOF_STORED_DOUBLE * 7); - DBUG_PRINT("info", ("spider geo is %f %f %f %f", - xmin, xmax, ymin, ymax)); - float8get(xmin, new_ptr + SIZEOF_STORED_DOUBLE * 8); - float8get(xmax, new_ptr + SIZEOF_STORED_DOUBLE * 9); - float8get(ymin, new_ptr + SIZEOF_STORED_DOUBLE * 10); - float8get(ymax, new_ptr + SIZEOF_STORED_DOUBLE * 11); - DBUG_PRINT("info", ("spider geo is %f %f %f %f", - xmin, xmax, ymin, ymax)); - float8get(xmin, new_ptr + SIZEOF_STORED_DOUBLE * 12); - float8get(xmax, new_ptr + SIZEOF_STORED_DOUBLE * 13); - float8get(ymin, new_ptr + SIZEOF_STORED_DOUBLE * 14); - float8get(ymax, new_ptr + SIZEOF_STORED_DOUBLE * 15); - DBUG_PRINT("info", ("spider geo is %f %f %f %f", - xmin, xmax, ymin, ymax)); -*/ -/* - tmp_str.set_quick((char *) new_ptr, SIZEOF_STORED_DOUBLE * 4, - &my_charset_bin); -*/ - tmp_str.length(0); - tmp_str.q_append((char *) SPIDER_SQL_LINESTRING_HEAD_STR, - SPIDER_SQL_LINESTRING_HEAD_LEN); - tmp_str.q_append((char *) new_ptr, SIZEOF_STORED_DOUBLE); - tmp_str.q_append((char *) new_ptr + SIZEOF_STORED_DOUBLE * 2, - SIZEOF_STORED_DOUBLE); - tmp_str.q_append((char *) new_ptr + SIZEOF_STORED_DOUBLE, - SIZEOF_STORED_DOUBLE); - tmp_str.q_append((char *) new_ptr + SIZEOF_STORED_DOUBLE * 3, - SIZEOF_STORED_DOUBLE); - ptr = tmp_str.get_str(); - } else { - ptr = field->val_str(tmp_str.get_str(), new_ptr); - tmp_str.mem_calc(); - } - } else { - ptr = field->val_str(tmp_str.get_str()); - tmp_str.mem_calc(); - } - - thd->variables.time_zone = saved_time_zone; - - DBUG_PRINT("info", ("spider field->type() is %d", field->type())); - DBUG_PRINT("info", ("spider ptr->length() is %d", ptr->length())); -/* - if ( - field->type() == MYSQL_TYPE_BIT || - (field->type() >= MYSQL_TYPE_TINY_BLOB && - field->type() <= MYSQL_TYPE_BLOB) - ) { - uchar *hex_ptr = (uchar *) ptr->ptr(), *end_ptr; - char *str_ptr; - DBUG_PRINT("info", ("spider HEX")); - if (str->reserve(SPIDER_SQL_HEX_LEN + ptr->length() * 2)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_HEX_STR, SPIDER_SQL_HEX_LEN); - str_ptr = (char *) str->ptr() + str->length(); - for (end_ptr = hex_ptr + ptr->length(); hex_ptr < end_ptr; hex_ptr++) - { - *str_ptr++ = spider_dig_upper[(*hex_ptr) >> 4]; - *str_ptr++ = spider_dig_upper[(*hex_ptr) & 0x0F]; - } - str->length(str->length() + ptr->length() * 2); - } else -*/ - if (field->result_type() == STRING_RESULT) - { - DBUG_PRINT("info", ("spider STRING_RESULT")); - if (str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); - if ( - field->type() == MYSQL_TYPE_VARCHAR || - (field->type() >= MYSQL_TYPE_ENUM && - field->type() <= MYSQL_TYPE_GEOMETRY) - ) { - DBUG_PRINT("info", ("spider append_escaped")); - char buf2[MAX_FIELD_WIDTH]; - spider_string tmp_str2(buf2, MAX_FIELD_WIDTH, access_charset); - tmp_str2.init_calc_mem(SPD_MID_DB_ORACLE_UTIL_APPEND_COLUMN_VALUE_2); - tmp_str2.length(0); - if ( - tmp_str2.append(ptr->ptr(), ptr->length(), field->charset()) || - str->reserve(tmp_str2.length() * 2) || - append_escaped_util(str, tmp_str2.get_str()) - ) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } else if (str->append(*ptr)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - if (str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); - } else if (field->str_needs_quotes()) - { - if (str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN * 2 + ptr->length() * 2 + 2)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); - append_escaped_util(str, ptr); - str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); - } else if (str->append(*ptr)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - DBUG_RETURN(0); -} - -int spider_db_oracle_util::append_from_with_alias( - spider_string *str, - const char **table_names, - uint *table_name_lengths, - const char **table_aliases, - uint *table_alias_lengths, - uint table_count, - int *table_name_pos, - bool over_write -) { - uint roop_count, length = 0; - DBUG_ENTER("spider_db_oracle_util::append_from_with_alias"); - DBUG_PRINT("info",("spider this=%p", this)); - if (!over_write) - { - for (roop_count = 0; roop_count < table_count; roop_count++) - length += table_name_lengths[roop_count] + SPIDER_SQL_SPACE_LEN + - table_alias_lengths[roop_count] + SPIDER_SQL_COMMA_LEN; - if (str->reserve(SPIDER_SQL_FROM_LEN + length)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_FROM_STR, SPIDER_SQL_FROM_LEN); - *table_name_pos = str->length(); - } - for (roop_count = 0; roop_count < table_count; roop_count++) - { - str->q_append(table_names[roop_count], table_name_lengths[roop_count]); - str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN); - str->q_append(table_aliases[roop_count], table_alias_lengths[roop_count]); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - str->length(str->length() - SPIDER_SQL_COMMA_LEN); - DBUG_RETURN(0); -} - -int spider_db_oracle_util::append_trx_isolation( - spider_string *str, - int trx_isolation -) { - DBUG_ENTER("spider_db_oracle_util::append_trx_isolation"); - DBUG_PRINT("info",("spider this=%p", this)); - if (str->reserve(SPIDER_SQL_SEMICOLON_LEN + - SPIDER_SQL_ISO_READ_COMMITTED_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - if (str->length()) - { - str->q_append(SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN); - } - switch (trx_isolation) - { - case ISO_READ_UNCOMMITTED: - case ISO_READ_COMMITTED: - str->q_append(SPIDER_SQL_ISO_READ_COMMITTED_STR, - SPIDER_SQL_ISO_READ_COMMITTED_LEN); - break; - case ISO_REPEATABLE_READ: - case ISO_SERIALIZABLE: - str->q_append(SPIDER_SQL_ISO_SERIALIZABLE_STR, - SPIDER_SQL_ISO_SERIALIZABLE_LEN); - break; - default: - DBUG_RETURN(HA_ERR_UNSUPPORTED); - } - DBUG_RETURN(0); -} - -int spider_db_oracle_util::append_autocommit( - spider_string *str, - bool autocommit -) { - DBUG_ENTER("spider_db_oracle_util::append_autocommit"); - DBUG_PRINT("info",("spider this=%p", this)); - if (str->reserve(SPIDER_SQL_SEMICOLON_LEN + SPIDER_SQL_AUTOCOMMIT_OFF_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - if (str->length()) - { - str->q_append(SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN); - } - if (autocommit) - { - str->q_append(SPIDER_SQL_AUTOCOMMIT_ON_STR, - SPIDER_SQL_AUTOCOMMIT_ON_LEN); - } else { - str->q_append(SPIDER_SQL_AUTOCOMMIT_OFF_STR, - SPIDER_SQL_AUTOCOMMIT_OFF_LEN); - } - DBUG_RETURN(0); -} - -int spider_db_oracle_util::append_sql_log_off( - spider_string *str, - bool sql_log_off -) { - DBUG_ENTER("spider_db_oracle_util::append_sql_log_off"); - DBUG_PRINT("info",("spider this=%p", this)); - /* nothing to do */ - DBUG_RETURN(0); -} - -int spider_db_oracle_util::append_wait_timeout( - spider_string *str, - int wait_timeout -) { - DBUG_ENTER("spider_db_oracle_util::append_wait_timeout"); - DBUG_PRINT("info",("spider this=%p", this)); - /* nothing to do */ - DBUG_RETURN(0); -} - -int spider_db_oracle_util::append_sql_mode( - spider_string *str, - sql_mode_t sql_mode -) { - DBUG_ENTER("spider_db_oracle_util::append_sql_mode"); - DBUG_PRINT("info",("spider this=%p", this)); - /* nothing to do */ - DBUG_RETURN(0); -} - -int spider_db_oracle_util::append_time_zone( - spider_string *str, - Time_zone *time_zone -) { - DBUG_ENTER("spider_db_oracle_util::append_time_zone"); - DBUG_PRINT("info",("spider this=%p", this)); - /* nothing to do */ - DBUG_RETURN(0); -} - -int spider_db_oracle_util::append_start_transaction( - spider_string *str -) { - DBUG_ENTER("spider_db_oracle_util::append_start_transaction"); - DBUG_PRINT("info",("spider this=%p", this)); - if (str->reserve(SPIDER_SQL_SEMICOLON_LEN + - SPIDER_SQL_START_TRANSACTION_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - if (str->length()) - { - str->q_append(SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN); - } - str->q_append(SPIDER_SQL_START_TRANSACTION_STR, - SPIDER_SQL_START_TRANSACTION_LEN); - DBUG_RETURN(0); -} - -int spider_db_oracle_util::append_xa_start( - spider_string *str, - XID *xid -) { - DBUG_ENTER("spider_db_oracle_util::append_xa_start"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_ASSERT(0); - DBUG_RETURN(0); -} - -int spider_db_oracle_util::append_lock_table_head( - spider_string *str -) { - DBUG_ENTER("spider_db_oracle_util::append_lock_table_head"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(0); -} - -int spider_db_oracle_util::append_lock_table_body( - spider_string *str, - const char *db_name, - uint db_name_length, - CHARSET_INFO *db_name_charset, - const char *table_name, - uint table_name_length, - CHARSET_INFO *table_name_charset, - int lock_type -) { - DBUG_ENTER("spider_db_oracle_util::append_lock_table_body"); - DBUG_PRINT("info",("spider this=%p", this)); - if (str->reserve(SPIDER_SQL_SEMICOLON_LEN + SPIDER_SQL_LOCK_TABLE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - if (str->length()) - { - str->q_append(SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN); - } - str->q_append(SPIDER_SQL_LOCK_TABLE_STR, SPIDER_SQL_LOCK_TABLE_LEN); - if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN)) - { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); - if ( - str->append(db_name, db_name_length, db_name_charset) || - str->reserve((SPIDER_SQL_NAME_QUOTE_LEN) * 2 + SPIDER_SQL_DOT_LEN) - ) { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); - str->q_append(SPIDER_SQL_DOT_STR, SPIDER_SQL_DOT_LEN); - str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); - if ( - str->append(table_name, table_name_length, table_name_charset) || - str->reserve(SPIDER_SQL_NAME_QUOTE_LEN + - spider_db_table_lock_len[lock_type]) - ) { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); - str->q_append(spider_db_table_lock_str[lock_type], - spider_db_table_lock_len[lock_type]); - DBUG_RETURN(0); -} - -int spider_db_oracle_util::append_lock_table_tail( - spider_string *str -) { - DBUG_ENTER("spider_db_oracle_util::append_lock_table_tail"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(0); -} - -int spider_db_oracle_util::append_unlock_table( - spider_string *str -) { - DBUG_ENTER("spider_db_oracle_util::append_unlock_table"); - DBUG_PRINT("info",("spider this=%p", this)); - if (str->reserve(SPIDER_SQL_COMMIT_LEN)) - { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - str->q_append(SPIDER_SQL_COMMIT_STR, SPIDER_SQL_COMMIT_LEN); - DBUG_RETURN(0); -} - -int spider_db_oracle_util::open_item_func( - Item_func *item_func, - ha_spider *spider, - spider_string *str, - const char *alias, - uint alias_length, - bool use_fields, - spider_fields *fields -) { - uint dbton_id = spider_dbton_oracle.dbton_id; - int error_num; - Item *item, **item_list = item_func->arguments(); - Field *field; - uint roop_count, item_count = item_func->argument_count(), start_item = 0; - const char *func_name = SPIDER_SQL_NULL_CHAR_STR, - *separator_str = SPIDER_SQL_NULL_CHAR_STR, - *last_str = SPIDER_SQL_NULL_CHAR_STR; - int func_name_length = SPIDER_SQL_NULL_CHAR_LEN, - separator_str_length = SPIDER_SQL_NULL_CHAR_LEN, - last_str_length = SPIDER_SQL_NULL_CHAR_LEN; - int use_pushdown_udf; - bool merge_func = FALSE; - DBUG_ENTER("spider_db_oracle_util::open_item_func"); - if (str) - { - if (str->reserve(SPIDER_SQL_OPEN_PAREN_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN); - } - DBUG_PRINT("info",("spider functype = %d", item_func->functype())); - switch (item_func->functype()) - { - case Item_func::ISNULL_FUNC: - last_str = SPIDER_SQL_IS_NULL_STR; - last_str_length = SPIDER_SQL_IS_NULL_LEN; - break; - case Item_func::ISNOTNULL_FUNC: - last_str = SPIDER_SQL_IS_NOT_NULL_STR; - last_str_length = SPIDER_SQL_IS_NOT_NULL_LEN; - break; - case Item_func::UNKNOWN_FUNC: - func_name = (char*) item_func->func_name(); - func_name_length = strlen(func_name); - DBUG_PRINT("info",("spider func_name = %s", func_name)); - DBUG_PRINT("info",("spider func_name_length = %d", func_name_length)); - if (func_name_length == 1 && - ( - !strncasecmp("+", func_name, func_name_length) || - !strncasecmp("-", func_name, func_name_length) || - !strncasecmp("*", func_name, func_name_length) || - !strncasecmp("/", func_name, func_name_length) || - !strncasecmp("%", func_name, func_name_length) || - !strncasecmp("&", func_name, func_name_length) || - !strncasecmp("|", func_name, func_name_length) || - !strncasecmp("^", func_name, func_name_length) - ) - ) { - /* no action */ - break; - } else if (func_name_length == 2 && - ( - !strncasecmp("<<", func_name, func_name_length) || - !strncasecmp(">>", func_name, func_name_length) - ) - ) { - /* no action */ - break; - } else if (func_name_length == 3 && - !strncasecmp("div", func_name, func_name_length) - ) { - /* no action */ - break; - } else if (func_name_length == 4) - { - if ( - !strncasecmp("rand", func_name, func_name_length) && - !item_func->argument_count() - ) { - if (str) - str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN); - DBUG_RETURN(spider_db_open_item_int(item_func, NULL, spider, str, - alias, alias_length, dbton_id, use_fields, fields)); - } else if ( - !strncasecmp("case", func_name, func_name_length) - ) { -#ifdef ITEM_FUNC_CASE_PARAMS_ARE_PUBLIC - Item_func_case *item_func_case = (Item_func_case *) item_func; - if (str) - { - if (str->reserve(SPIDER_SQL_CASE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_CASE_STR, SPIDER_SQL_CASE_LEN); - } - if (item_func_case->first_expr_num != -1) - { - if ((error_num = spider_db_print_item_type( - item_list[item_func_case->first_expr_num], NULL, spider, str, - alias, alias_length, dbton_id, use_fields, fields))) - DBUG_RETURN(error_num); - } - for (roop_count = 0; roop_count < item_func_case->ncases; - roop_count += 2) - { - if (str) - { - if (str->reserve(SPIDER_SQL_WHEN_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_WHEN_STR, SPIDER_SQL_WHEN_LEN); - } - if ((error_num = spider_db_print_item_type( - item_list[roop_count], NULL, spider, str, - alias, alias_length, dbton_id, use_fields, fields))) - DBUG_RETURN(error_num); - if (str) - { - if (str->reserve(SPIDER_SQL_THEN_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_THEN_STR, SPIDER_SQL_THEN_LEN); - } - if ((error_num = spider_db_print_item_type( - item_list[roop_count + 1], NULL, spider, str, - alias, alias_length, dbton_id, use_fields, fields))) - DBUG_RETURN(error_num); - } - if (item_func_case->else_expr_num != -1) - { - if (str) - { - if (str->reserve(SPIDER_SQL_ELSE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_ELSE_STR, SPIDER_SQL_ELSE_LEN); - } - if ((error_num = spider_db_print_item_type( - item_list[item_func_case->else_expr_num], NULL, spider, str, - alias, alias_length, dbton_id, use_fields, fields))) - DBUG_RETURN(error_num); - } - if (str) - { - if (str->reserve(SPIDER_SQL_END_LEN + SPIDER_SQL_CLOSE_PAREN_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_END_STR, SPIDER_SQL_END_LEN); - str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, - SPIDER_SQL_CLOSE_PAREN_LEN); - } - DBUG_RETURN(0); -#else - DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM); -#endif - } - } else if (func_name_length == 6 && - !strncasecmp("istrue", func_name, func_name_length) - ) { - last_str = SPIDER_SQL_IS_TRUE_STR; - last_str_length = SPIDER_SQL_IS_TRUE_LEN; - break; - } else if (func_name_length == 7) - { - if (!strncasecmp("isfalse", func_name, func_name_length)) - { - last_str = SPIDER_SQL_IS_FALSE_STR; - last_str_length = SPIDER_SQL_IS_FALSE_LEN; - break; - } else if ( - !strncasecmp("sysdate", func_name, func_name_length) || - !strncasecmp("curdate", func_name, func_name_length) || - !strncasecmp("curtime", func_name, func_name_length) - ) { - if (str) - str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN); - DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str, - alias, alias_length, dbton_id, use_fields, fields)); - } else if ( - !strncasecmp("convert", func_name, func_name_length) - ) { - if (str) - { - if (str->reserve(func_name_length * 2 + SPIDER_SQL_OPEN_PAREN_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(func_name, func_name_length); - str->q_append(SPIDER_SQL_OPEN_PAREN_STR, - SPIDER_SQL_OPEN_PAREN_LEN); - last_str = SPIDER_SQL_CLOSE_PAREN_STR; - last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN; - } - break; - } - } else if (func_name_length == 8 && - ( - !strncasecmp("utc_date", func_name, func_name_length) || - !strncasecmp("utc_time", func_name, func_name_length) - ) - ) { - if (str) - str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN); - DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str, - alias, alias_length, dbton_id, use_fields, fields)); - } else if (func_name_length == 9 && - !strncasecmp("isnottrue", func_name, func_name_length) - ) { - last_str = SPIDER_SQL_IS_NOT_TRUE_STR; - last_str_length = SPIDER_SQL_IS_NOT_TRUE_LEN; - break; - } else if (func_name_length == 10) - { - if (!strncasecmp("isnotfalse", func_name, func_name_length)) - { - last_str = SPIDER_SQL_IS_NOT_FALSE_STR; - last_str_length = SPIDER_SQL_IS_NOT_FALSE_LEN; - break; - } else if (!strncasecmp("column_get", func_name, func_name_length)) - { - if (str) - { - str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN); - if (str->reserve(func_name_length + SPIDER_SQL_OPEN_PAREN_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(func_name, func_name_length); - str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN); - } - func_name = SPIDER_SQL_COMMA_STR; - func_name_length = SPIDER_SQL_COMMA_LEN; - separator_str = SPIDER_SQL_COMMA_STR; - separator_str_length = SPIDER_SQL_COMMA_LEN; - break; - } - } else if (func_name_length == 12) - { - if (!strncasecmp("cast_as_date", func_name, func_name_length)) - { - item = item_list[0]; - if (item->type() == Item::FUNC_ITEM) - { - DBUG_PRINT("info",("spider child is FUNC_ITEM")); - Item_func *ifunc = (Item_func *) item; - if (ifunc->functype() == Item_func::UNKNOWN_FUNC) - { - const char *child_func_name; - int child_func_name_length; - DBUG_PRINT("info",("spider child is UNKNOWN_FUNC")); - child_func_name = (char*) ifunc->func_name(); - child_func_name_length = strlen(child_func_name); - DBUG_PRINT("info",("spider child func_name is %s", child_func_name)); - if ( - child_func_name_length == 10 && - !strncasecmp("column_get", child_func_name, child_func_name_length) - ) { - DBUG_PRINT("info",("spider this is merge func")); - merge_func = TRUE; - } - } - } - - if (str) - { - str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN); - if (!merge_func) - { - if (str->reserve(SPIDER_SQL_CAST_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_CAST_STR, SPIDER_SQL_CAST_LEN); - } - } - last_str = SPIDER_SQL_AS_DATE_STR; - last_str_length = SPIDER_SQL_AS_DATE_LEN; - break; - } else if (!strncasecmp("cast_as_time", func_name, func_name_length)) - { - item = item_list[0]; - if (item->type() == Item::FUNC_ITEM) - { - DBUG_PRINT("info",("spider child is FUNC_ITEM")); - Item_func *ifunc = (Item_func *) item; - if (ifunc->functype() == Item_func::UNKNOWN_FUNC) - { - const char *child_func_name; - int child_func_name_length; - DBUG_PRINT("info",("spider child is UNKNOWN_FUNC")); - child_func_name = (char*) ifunc->func_name(); - child_func_name_length = strlen(child_func_name); - DBUG_PRINT("info",("spider child func_name is %s", child_func_name)); - if ( - child_func_name_length == 10 && - !strncasecmp("column_get", child_func_name, child_func_name_length) - ) { - DBUG_PRINT("info",("spider this is merge func")); - merge_func = TRUE; - } - } - } - - if (str) - { - str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN); - if (!merge_func) - { - if (str->reserve(SPIDER_SQL_CAST_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_CAST_STR, SPIDER_SQL_CAST_LEN); - } - } - last_str = SPIDER_SQL_AS_TIME_STR; - last_str_length = SPIDER_SQL_AS_TIME_LEN; - break; - } - } else if (func_name_length == 13) - { - if (!strncasecmp("utc_timestamp", func_name, func_name_length)) - { - if (str) - str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN); - DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str, - alias, alias_length, dbton_id, use_fields, fields)); - } else if (!strncasecmp("timestampdiff", func_name, func_name_length)) - { - Item_func_timestamp_diff *item_func_timestamp_diff = - (Item_func_timestamp_diff *) item_func; - if (str) - { - const char *interval_str; - uint interval_len; - switch (item_func_timestamp_diff->get_int_type()) - { - case INTERVAL_YEAR: - interval_str = SPIDER_SQL_YEAR_STR; - interval_len = SPIDER_SQL_YEAR_LEN; - break; - case INTERVAL_QUARTER: - interval_str = SPIDER_SQL_QUARTER_STR; - interval_len = SPIDER_SQL_QUARTER_LEN; - break; - case INTERVAL_MONTH: - interval_str = SPIDER_SQL_MONTH_STR; - interval_len = SPIDER_SQL_MONTH_LEN; - break; - case INTERVAL_WEEK: - interval_str = SPIDER_SQL_WEEK_STR; - interval_len = SPIDER_SQL_WEEK_LEN; - break; - case INTERVAL_DAY: - interval_str = SPIDER_SQL_DAY_STR; - interval_len = SPIDER_SQL_DAY_LEN; - break; - case INTERVAL_HOUR: - interval_str = SPIDER_SQL_HOUR_STR; - interval_len = SPIDER_SQL_HOUR_LEN; - break; - case INTERVAL_MINUTE: - interval_str = SPIDER_SQL_MINUTE_STR; - interval_len = SPIDER_SQL_MINUTE_LEN; - break; - case INTERVAL_SECOND: - interval_str = SPIDER_SQL_SECOND_STR; - interval_len = SPIDER_SQL_SECOND_LEN; - break; - case INTERVAL_MICROSECOND: - interval_str = SPIDER_SQL_MICROSECOND_STR; - interval_len = SPIDER_SQL_MICROSECOND_LEN; - break; - default: - interval_str = ""; - interval_len = 0; - break; - } - str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN); - if (str->reserve(func_name_length + SPIDER_SQL_OPEN_PAREN_LEN + - interval_len + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(func_name, func_name_length); - str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN); - str->q_append(interval_str, interval_len); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - if ((error_num = spider_db_print_item_type(item_list[0], NULL, spider, - str, alias, alias_length, dbton_id, use_fields, fields))) - DBUG_RETURN(error_num); - if (str) - { - if (str->reserve(SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - if ((error_num = spider_db_print_item_type(item_list[1], NULL, spider, - str, alias, alias_length, dbton_id, use_fields, fields))) - DBUG_RETURN(error_num); - if (str) - { - if (str->reserve(SPIDER_SQL_CLOSE_PAREN_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, - SPIDER_SQL_CLOSE_PAREN_LEN); - } - DBUG_RETURN(0); - } - } else if (func_name_length == 14) - { - if (!strncasecmp("cast_as_binary", func_name, func_name_length)) - { - item = item_list[0]; - if (item->type() == Item::FUNC_ITEM) - { - DBUG_PRINT("info",("spider child is FUNC_ITEM")); - Item_func *ifunc = (Item_func *) item; - if (ifunc->functype() == Item_func::UNKNOWN_FUNC) - { - const char *child_func_name; - int child_func_name_length; - DBUG_PRINT("info",("spider child is UNKNOWN_FUNC")); - child_func_name = (char*) ifunc->func_name(); - child_func_name_length = strlen(child_func_name); - DBUG_PRINT("info",("spider child func_name is %s", child_func_name)); - if ( - child_func_name_length == 10 && - !strncasecmp("column_get", child_func_name, child_func_name_length) - ) { - DBUG_PRINT("info",("spider this is merge func")); - merge_func = TRUE; - } - } - } - - if (str) - { - char tmp_buf[MAX_FIELD_WIDTH], *tmp_ptr, *tmp_ptr2; - spider_string tmp_str(tmp_buf, MAX_FIELD_WIDTH, str->charset()); - tmp_str.init_calc_mem(SPD_MID_DB_ORACLE_UTIL_OPEN_ITEM_FUNC_1); - tmp_str.length(0); - str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN); - if (!merge_func) - { - if (str->reserve(SPIDER_SQL_CAST_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_CAST_STR, SPIDER_SQL_CAST_LEN); - } - item_func->print(tmp_str.get_str(), QT_TO_SYSTEM_CHARSET); - tmp_str.mem_calc(); - if (tmp_str.reserve(1)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - tmp_ptr = tmp_str.c_ptr_quick(); - DBUG_PRINT("info",("spider tmp_ptr = %s", tmp_ptr)); - while ((tmp_ptr2 = strstr(tmp_ptr, SPIDER_SQL_AS_BINARY_STR))) - tmp_ptr = tmp_ptr2 + 1; - last_str = tmp_ptr - 1; - last_str_length = strlen(last_str) - SPIDER_SQL_CLOSE_PAREN_LEN; - } - break; - } else if (!strncasecmp("cast_as_signed", func_name, func_name_length)) - { - item = item_list[0]; - if (item->type() == Item::FUNC_ITEM) - { - DBUG_PRINT("info",("spider child is FUNC_ITEM")); - Item_func *ifunc = (Item_func *) item; - if (ifunc->functype() == Item_func::UNKNOWN_FUNC) - { - const char *child_func_name; - int child_func_name_length; - DBUG_PRINT("info",("spider child is UNKNOWN_FUNC")); - child_func_name = (char*) ifunc->func_name(); - child_func_name_length = strlen(child_func_name); - DBUG_PRINT("info",("spider child func_name is %s", child_func_name)); - if ( - child_func_name_length == 10 && - !strncasecmp("column_get", child_func_name, child_func_name_length) - ) { - DBUG_PRINT("info",("spider this is merge func")); - merge_func = TRUE; - } - } - } - - if (str) - { - str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN); - if (!merge_func) - { - if (str->reserve(SPIDER_SQL_CAST_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_CAST_STR, SPIDER_SQL_CAST_LEN); - } - } - last_str = SPIDER_SQL_AS_SIGNED_STR; - last_str_length = SPIDER_SQL_AS_SIGNED_LEN; - break; - } - } else if (func_name_length == 16) - { - if (!strncasecmp("cast_as_unsigned", func_name, func_name_length)) - { - item = item_list[0]; - if (item->type() == Item::FUNC_ITEM) - { - DBUG_PRINT("info",("spider child is FUNC_ITEM")); - Item_func *ifunc = (Item_func *) item; - if (ifunc->functype() == Item_func::UNKNOWN_FUNC) - { - const char *child_func_name; - int child_func_name_length; - DBUG_PRINT("info",("spider child is UNKNOWN_FUNC")); - child_func_name = (char*) ifunc->func_name(); - child_func_name_length = strlen(child_func_name); - DBUG_PRINT("info",("spider child func_name is %s", child_func_name)); - if ( - child_func_name_length == 10 && - !strncasecmp("column_get", child_func_name, child_func_name_length) - ) { - DBUG_PRINT("info",("spider this is merge func")); - merge_func = TRUE; - } - } - } - - if (str) - { - str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN); - if (!merge_func) - { - if (str->reserve(SPIDER_SQL_CAST_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_CAST_STR, SPIDER_SQL_CAST_LEN); - } - } - last_str = SPIDER_SQL_AS_UNSIGNED_STR; - last_str_length = SPIDER_SQL_AS_UNSIGNED_LEN; - break; - } else if (!strncasecmp("decimal_typecast", func_name, - func_name_length)) - { - item = item_list[0]; - if (item->type() == Item::FUNC_ITEM) - { - DBUG_PRINT("info",("spider child is FUNC_ITEM")); - Item_func *ifunc = (Item_func *) item; - if (ifunc->functype() == Item_func::UNKNOWN_FUNC) - { - const char *child_func_name; - int child_func_name_length; - DBUG_PRINT("info",("spider child is UNKNOWN_FUNC")); - child_func_name = (char*) ifunc->func_name(); - child_func_name_length = strlen(child_func_name); - DBUG_PRINT("info",("spider child func_name is %s", child_func_name)); - if ( - child_func_name_length == 10 && - !strncasecmp("column_get", child_func_name, child_func_name_length) - ) { - DBUG_PRINT("info",("spider this is merge func")); - merge_func = TRUE; - } - } - } - - if (str) - { - char tmp_buf[MAX_FIELD_WIDTH], *tmp_ptr, *tmp_ptr2; - spider_string tmp_str(tmp_buf, MAX_FIELD_WIDTH, str->charset()); - tmp_str.init_calc_mem(SPD_MID_DB_ORACLE_UTIL_OPEN_ITEM_FUNC_2); - tmp_str.length(0); - str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN); - if (!merge_func) - { - if (str->reserve(SPIDER_SQL_CAST_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_CAST_STR, SPIDER_SQL_CAST_LEN); - } - item_func->print(tmp_str.get_str(), QT_TO_SYSTEM_CHARSET); - tmp_str.mem_calc(); - if (tmp_str.reserve(1)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - tmp_ptr = tmp_str.c_ptr_quick(); - DBUG_PRINT("info",("spider tmp_ptr = %s", tmp_ptr)); - while ((tmp_ptr2 = strstr(tmp_ptr, SPIDER_SQL_AS_DECIMAL_STR))) - tmp_ptr = tmp_ptr2 + 1; - last_str = tmp_ptr - 1; - last_str_length = strlen(last_str) - SPIDER_SQL_CLOSE_PAREN_LEN; - } - break; - } else if (!strncasecmp("cast_as_datetime", func_name, - func_name_length)) - { - item = item_list[0]; - if (item->type() == Item::FUNC_ITEM) - { - DBUG_PRINT("info",("spider child is FUNC_ITEM")); - Item_func *ifunc = (Item_func *) item; - if (ifunc->functype() == Item_func::UNKNOWN_FUNC) - { - const char *child_func_name; - int child_func_name_length; - DBUG_PRINT("info",("spider child is UNKNOWN_FUNC")); - child_func_name = (char*) ifunc->func_name(); - child_func_name_length = strlen(child_func_name); - DBUG_PRINT("info",("spider child func_name is %s", child_func_name)); - if ( - child_func_name_length == 10 && - !strncasecmp("column_get", child_func_name, child_func_name_length) - ) { - DBUG_PRINT("info",("spider this is merge func")); - merge_func = TRUE; - } - } - } - - if (str) - { - str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN); - if (!merge_func) - { - if (str->reserve(SPIDER_SQL_CAST_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_CAST_STR, SPIDER_SQL_CAST_LEN); - } - } - last_str = SPIDER_SQL_AS_DATETIME_STR; - last_str_length = SPIDER_SQL_AS_DATETIME_LEN; - break; - } - } else if (func_name_length == 17) - { - if (!strncasecmp("date_add_interval", func_name, func_name_length)) - { - Item_date_add_interval *item_date_add_interval = - (Item_date_add_interval *) item_func; - switch (item_date_add_interval->int_type) - { - case INTERVAL_YEAR: - case INTERVAL_QUARTER: - case INTERVAL_MONTH: - if (str) - { - if (str->reserve(SPIDER_SQL_ADD_MONTHS_LEN + - SPIDER_SQL_OPEN_PAREN_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_ADD_MONTHS_STR, - SPIDER_SQL_ADD_MONTHS_LEN); - str->q_append(SPIDER_SQL_OPEN_PAREN_STR, - SPIDER_SQL_OPEN_PAREN_LEN); - } - if ((error_num = spider_db_print_item_type(item_list[0], NULL, - spider, str, alias, alias_length, dbton_id, use_fields, - fields))) - DBUG_RETURN(error_num); - if (str) - { - if (item_date_add_interval->date_sub_interval) - { - if (str->reserve(SPIDER_SQL_COMMA_LEN + - SPIDER_SQL_MINUS_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - str->q_append(SPIDER_SQL_MINUS_STR, SPIDER_SQL_MINUS_LEN); - } else { - if (str->reserve(SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - } - if ((error_num = spider_db_print_item_type(item_list[1], NULL, - spider, str, alias, alias_length, dbton_id, use_fields, - fields))) - DBUG_RETURN(error_num); - if (str) - { - if (item_date_add_interval->int_type == INTERVAL_YEAR) - { - func_name = " * 12"; - func_name_length = sizeof(" * 12") - 1; - if (str->reserve(func_name_length + - (SPIDER_SQL_CLOSE_PAREN_LEN * 2))) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(func_name, func_name_length); - str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, - SPIDER_SQL_CLOSE_PAREN_LEN); - str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, - SPIDER_SQL_CLOSE_PAREN_LEN); - } else if (item_date_add_interval->int_type == - INTERVAL_QUARTER) - { - func_name = " * 3"; - func_name_length = sizeof(" * 3") - 1; - if (str->reserve(func_name_length + - (SPIDER_SQL_CLOSE_PAREN_LEN * 2))) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(func_name, func_name_length); - str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, - SPIDER_SQL_CLOSE_PAREN_LEN); - str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, - SPIDER_SQL_CLOSE_PAREN_LEN); - } else { - if (str->reserve(SPIDER_SQL_CLOSE_PAREN_LEN * 2)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, - SPIDER_SQL_CLOSE_PAREN_LEN); - str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, - SPIDER_SQL_CLOSE_PAREN_LEN); - } - } - break; - case INTERVAL_WEEK: - case INTERVAL_DAY: - case INTERVAL_HOUR: - case INTERVAL_MINUTE: - case INTERVAL_SECOND: - case INTERVAL_MICROSECOND: - if ((error_num = spider_db_print_item_type(item_list[0], NULL, - spider, str, alias, alias_length, dbton_id, use_fields, - fields))) - DBUG_RETURN(error_num); - if (str) - { - if (item_date_add_interval->date_sub_interval) - { - if (str->reserve(SPIDER_SQL_MINUS_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_MINUS_STR, SPIDER_SQL_MINUS_LEN); - } else { - if (str->reserve(SPIDER_SQL_PLUS_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_PLUS_STR, SPIDER_SQL_PLUS_LEN); - } - } - if ((error_num = spider_db_print_item_type(item_list[1], NULL, - spider, str, alias, alias_length, dbton_id, use_fields, - fields))) - DBUG_RETURN(error_num); - if (str) - { - if (item_date_add_interval->int_type == INTERVAL_WEEK) - { - func_name = " * 7"; - func_name_length = sizeof(" * 7") - 1; - if (str->reserve(func_name_length + - (SPIDER_SQL_CLOSE_PAREN_LEN))) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(func_name, func_name_length); - str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, - SPIDER_SQL_CLOSE_PAREN_LEN); - } else if (item_date_add_interval->int_type == INTERVAL_HOUR) - { - func_name = " / 24"; - func_name_length = sizeof(" / 24") - 1; - if (str->reserve(func_name_length + - (SPIDER_SQL_CLOSE_PAREN_LEN))) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(func_name, func_name_length); - str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, - SPIDER_SQL_CLOSE_PAREN_LEN); - } else if (item_date_add_interval->int_type == INTERVAL_MINUTE) - { - func_name = " / 1440"; - func_name_length = sizeof(" / 1440") - 1; - if (str->reserve(func_name_length + - (SPIDER_SQL_CLOSE_PAREN_LEN))) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(func_name, func_name_length); - str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, - SPIDER_SQL_CLOSE_PAREN_LEN); - } else if (item_date_add_interval->int_type == INTERVAL_SECOND) - { - func_name = " / 86400"; - func_name_length = sizeof(" / 86400") - 1; - if (str->reserve(func_name_length + - (SPIDER_SQL_CLOSE_PAREN_LEN))) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(func_name, func_name_length); - str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, - SPIDER_SQL_CLOSE_PAREN_LEN); - } else if (item_date_add_interval->int_type == - INTERVAL_MICROSECOND) - { - func_name = " / 86400000000"; - func_name_length = sizeof(" / 86400000000") - 1; - if (str->reserve(func_name_length + - (SPIDER_SQL_CLOSE_PAREN_LEN))) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(func_name, func_name_length); - str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, - SPIDER_SQL_CLOSE_PAREN_LEN); - } else { - if (str->reserve(SPIDER_SQL_CLOSE_PAREN_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, - SPIDER_SQL_CLOSE_PAREN_LEN); - } - } - break; - default: - DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM); - } - DBUG_RETURN(0); - break; - } - } - if (str) - { - if (str->reserve(func_name_length + SPIDER_SQL_OPEN_PAREN_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(func_name, func_name_length); - str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN); - } - func_name = SPIDER_SQL_COMMA_STR; - func_name_length = SPIDER_SQL_COMMA_LEN; - separator_str = SPIDER_SQL_COMMA_STR; - separator_str_length = SPIDER_SQL_COMMA_LEN; - last_str = SPIDER_SQL_CLOSE_PAREN_STR; - last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN; - break; - case Item_func::NOW_FUNC: - if (str) - str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN); - DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str, - alias, alias_length, dbton_id, use_fields, fields)); - case Item_func::CHAR_TYPECAST_FUNC: - DBUG_PRINT("info",("spider CHAR_TYPECAST_FUNC")); - { - item = item_list[0]; - if (item->type() == Item::FUNC_ITEM) - { - DBUG_PRINT("info",("spider child is FUNC_ITEM")); - Item_func *ifunc = (Item_func *) item; - if (ifunc->functype() == Item_func::UNKNOWN_FUNC) - { - const char *child_func_name; - int child_func_name_length; - DBUG_PRINT("info",("spider child is UNKNOWN_FUNC")); - child_func_name = (char*) ifunc->func_name(); - child_func_name_length = strlen(child_func_name); - DBUG_PRINT("info",("spider child func_name is %s", child_func_name)); - if ( - child_func_name_length == 10 && - !strncasecmp("column_get", child_func_name, child_func_name_length) - ) { - DBUG_PRINT("info",("spider this is merge func")); - merge_func = TRUE; - } - } - } - - if (str) - { - char tmp_buf[MAX_FIELD_WIDTH], *tmp_ptr, *tmp_ptr2; - spider_string tmp_str(tmp_buf, MAX_FIELD_WIDTH, str->charset()); - tmp_str.init_calc_mem(SPD_MID_DB_ORACLE_UTIL_OPEN_ITEM_FUNC_3); - tmp_str.length(0); - str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN); - if (!merge_func) - { - if (str->reserve(SPIDER_SQL_CAST_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_CAST_STR, SPIDER_SQL_CAST_LEN); - } - item_func->print(tmp_str.get_str(), QT_TO_SYSTEM_CHARSET); - tmp_str.mem_calc(); - if (tmp_str.reserve(1)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - tmp_ptr = tmp_str.c_ptr_quick(); - DBUG_PRINT("info",("spider tmp_ptr = %s", tmp_ptr)); - while ((tmp_ptr2 = strstr(tmp_ptr, SPIDER_SQL_AS_CHAR_STR))) - tmp_ptr = tmp_ptr2 + 1; - last_str = tmp_ptr - 1; - last_str_length = strlen(last_str) - SPIDER_SQL_CLOSE_PAREN_LEN; - } - } - break; - case Item_func::NOT_FUNC: - DBUG_PRINT("info",("spider NOT_FUNC")); - if (item_list[0]->type() == Item::COND_ITEM) - { - DBUG_PRINT("info",("spider item_list[0] is COND_ITEM")); - Item_cond *item_cond = (Item_cond *) item_list[0]; - if (item_cond->functype() == Item_func::COND_AND_FUNC) - { - DBUG_PRINT("info",("spider item_cond is COND_AND_FUNC")); - List_iterator_fast lif(*(item_cond->argument_list())); - bool has_expr_cache_item = FALSE; - bool has_isnotnull_func = FALSE; - bool has_other_item = FALSE; - while((item = lif++)) - { -#ifdef SPIDER_HAS_EXPR_CACHE_ITEM - if ( - item->type() == Item::EXPR_CACHE_ITEM - ) { - DBUG_PRINT("info",("spider EXPR_CACHE_ITEM")); - has_expr_cache_item = TRUE; - } else -#endif - if ( - item->type() == Item::FUNC_ITEM && - ((Item_func *) item)->functype() == Item_func::ISNOTNULL_FUNC - ) { - DBUG_PRINT("info",("spider ISNOTNULL_FUNC")); - has_isnotnull_func = TRUE; - } else { - DBUG_PRINT("info",("spider has other item")); - DBUG_PRINT("info",("spider COND type=%d", item->type())); - has_other_item = TRUE; - } - } - if (has_expr_cache_item && has_isnotnull_func && !has_other_item) - { - DBUG_PRINT("info",("spider NOT EXISTS skip")); - DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM); - } - } - } - if (str) - { - func_name = (char*) item_func->func_name(); - func_name_length = strlen(func_name); - if (str->reserve(func_name_length + SPIDER_SQL_SPACE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(func_name, func_name_length); - str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN); - } - break; - case Item_func::NEG_FUNC: - if (str) - { - func_name = (char*) item_func->func_name(); - func_name_length = strlen(func_name); - if (str->reserve(func_name_length + SPIDER_SQL_SPACE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(func_name, func_name_length); - str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN); - } - break; - case Item_func::IN_FUNC: - if (((Item_func_opt_neg *) item_func)->negated) - { - func_name = SPIDER_SQL_NOT_IN_STR; - func_name_length = SPIDER_SQL_NOT_IN_LEN; - separator_str = SPIDER_SQL_COMMA_STR; - separator_str_length = SPIDER_SQL_COMMA_LEN; - last_str = SPIDER_SQL_CLOSE_PAREN_STR; - last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN; - } else { - func_name = SPIDER_SQL_IN_STR; - func_name_length = SPIDER_SQL_IN_LEN; - separator_str = SPIDER_SQL_COMMA_STR; - separator_str_length = SPIDER_SQL_COMMA_LEN; - last_str = SPIDER_SQL_CLOSE_PAREN_STR; - last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN; - } - break; - case Item_func::BETWEEN: - if (((Item_func_opt_neg *) item_func)->negated) - { - func_name = SPIDER_SQL_NOT_BETWEEN_STR; - func_name_length = SPIDER_SQL_NOT_BETWEEN_LEN; - separator_str = SPIDER_SQL_AND_STR; - separator_str_length = SPIDER_SQL_AND_LEN; - } else { - func_name = (char*) item_func->func_name(); - func_name_length = strlen(func_name); - separator_str = SPIDER_SQL_AND_STR; - separator_str_length = SPIDER_SQL_AND_LEN; - } - break; - case Item_func::UDF_FUNC: - use_pushdown_udf = spider_param_use_pushdown_udf( - spider->wide_handler->trx->thd, - spider->share->use_pushdown_udf); - if (!use_pushdown_udf) - DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM); - if (str) - { - func_name = (char*) item_func->func_name(); - func_name_length = strlen(func_name); - DBUG_PRINT("info",("spider func_name = %s", func_name)); - DBUG_PRINT("info",("spider func_name_length = %d", func_name_length)); - if (str->reserve(func_name_length + SPIDER_SQL_OPEN_PAREN_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(func_name, func_name_length); - str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN); - } - func_name = SPIDER_SQL_COMMA_STR; - func_name_length = SPIDER_SQL_COMMA_LEN; - separator_str = SPIDER_SQL_COMMA_STR; - separator_str_length = SPIDER_SQL_COMMA_LEN; - last_str = SPIDER_SQL_CLOSE_PAREN_STR; - last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN; - break; - case Item_func::XOR_FUNC: - if (str) - str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN); - DBUG_RETURN( - spider_db_open_item_cond((Item_cond *) item_func, spider, str, - alias, alias_length, dbton_id, use_fields, fields)); - case Item_func::TRIG_COND_FUNC: - DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM); - case Item_func::GUSERVAR_FUNC: - if (str) - str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN); - if (item_func->result_type() == STRING_RESULT) - DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str, - alias, alias_length, dbton_id, use_fields, fields)); - else - DBUG_RETURN(spider_db_open_item_int(item_func, NULL, spider, str, - alias, alias_length, dbton_id, use_fields, fields)); - case Item_func::FT_FUNC: - if (spider_db_check_ft_idx(item_func, spider) == MAX_KEY) - DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM); - start_item = 1; - if (str) - { - if (str->reserve(SPIDER_SQL_MATCH_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_MATCH_STR, SPIDER_SQL_MATCH_LEN); - } - separator_str = SPIDER_SQL_COMMA_STR; - separator_str_length = SPIDER_SQL_COMMA_LEN; - last_str = SPIDER_SQL_CLOSE_PAREN_STR; - last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN; - break; - case Item_func::SP_EQUALS_FUNC: - if (str) - { - func_name = SPIDER_SQL_MBR_EQUAL_STR; - func_name_length = SPIDER_SQL_MBR_EQUAL_LEN; - DBUG_PRINT("info",("spider func_name = %s", func_name)); - DBUG_PRINT("info",("spider func_name_length = %d", func_name_length)); - if (str->reserve(func_name_length)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(func_name, func_name_length); - } - func_name = SPIDER_SQL_COMMA_STR; - func_name_length = SPIDER_SQL_COMMA_LEN; - separator_str = SPIDER_SQL_COMMA_STR; - separator_str_length = SPIDER_SQL_COMMA_LEN; - last_str = SPIDER_SQL_CLOSE_PAREN_STR; - last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN; - break; - case Item_func::SP_DISJOINT_FUNC: - case Item_func::SP_INTERSECTS_FUNC: - case Item_func::SP_TOUCHES_FUNC: - case Item_func::SP_CROSSES_FUNC: - case Item_func::SP_WITHIN_FUNC: - case Item_func::SP_CONTAINS_FUNC: - case Item_func::SP_OVERLAPS_FUNC: - if (str) - { - func_name = (char*) item_func->func_name(); - func_name_length = strlen(func_name); - DBUG_PRINT("info",("spider func_name = %s", func_name)); - DBUG_PRINT("info",("spider func_name_length = %d", func_name_length)); - if (str->reserve( -#ifndef SPIDER_ITEM_GEOFUNC_NAME_HAS_MBR - SPIDER_SQL_MBR_LEN + -#endif - func_name_length + SPIDER_SQL_OPEN_PAREN_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); -#ifndef SPIDER_ITEM_GEOFUNC_NAME_HAS_MBR - str->q_append(SPIDER_SQL_MBR_STR, SPIDER_SQL_MBR_LEN); -#endif - str->q_append(func_name, func_name_length); - str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN); - } - func_name = SPIDER_SQL_COMMA_STR; - func_name_length = SPIDER_SQL_COMMA_LEN; - separator_str = SPIDER_SQL_COMMA_STR; - separator_str_length = SPIDER_SQL_COMMA_LEN; - last_str = SPIDER_SQL_CLOSE_PAREN_STR; - last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN; - break; - case Item_func::EQ_FUNC: - case Item_func::EQUAL_FUNC: - case Item_func::NE_FUNC: - case Item_func::LT_FUNC: - case Item_func::LE_FUNC: - case Item_func::GE_FUNC: - case Item_func::GT_FUNC: - if (str) - { - func_name = (char*) item_func->func_name(); - func_name_length = strlen(func_name); - } - break; - case Item_func::LIKE_FUNC: - if (str) - { - if (((Item_func_like *)item_func)->get_negated()) - { - func_name = SPIDER_SQL_NOT_LIKE_STR; - func_name_length = SPIDER_SQL_NOT_LIKE_LEN; - } - else - { - func_name = (char*)item_func->func_name(); - func_name_length = strlen(func_name); - } - } - break; - default: - THD *thd = spider->wide_handler->trx->thd; - SPIDER_SHARE *share = spider->share; - if (spider_param_skip_default_condition(thd, - share->skip_default_condition)) - DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM); - if (str) - { - func_name = (char*) item_func->func_name(); - func_name_length = strlen(func_name); - } - break; - } - DBUG_PRINT("info",("spider func_name = %s", func_name)); - DBUG_PRINT("info",("spider func_name_length = %d", func_name_length)); - DBUG_PRINT("info",("spider separator_str = %s", separator_str)); - DBUG_PRINT("info",("spider separator_str_length = %d", separator_str_length)); - DBUG_PRINT("info",("spider last_str = %s", last_str)); - DBUG_PRINT("info",("spider last_str_length = %d", last_str_length)); - if (item_count) - { - /* Find the field in the list of items of the expression tree */ - field = spider_db_find_field_in_item_list(item_list, - item_count, start_item, - str, - func_name, func_name_length); - item_count--; - for (roop_count = start_item; roop_count < item_count; roop_count++) - { - item = item_list[roop_count]; - if ((error_num = spider_db_print_item_type(item, field, spider, str, - alias, alias_length, dbton_id, use_fields, fields))) - DBUG_RETURN(error_num); - if (roop_count == 1) - { - func_name = separator_str; - func_name_length = separator_str_length; - } - if (str) - { - if (str->reserve(func_name_length + SPIDER_SQL_SPACE_LEN * 2)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN); - str->q_append(func_name, func_name_length); - str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN); - } - } - item = item_list[roop_count]; - if ((error_num = spider_db_print_item_type(item, field, spider, str, - alias, alias_length, dbton_id, use_fields, fields))) - DBUG_RETURN(error_num); - } - if (item_func->functype() == Item_func::FT_FUNC) - { - Item_func_match *item_func_match = (Item_func_match *)item_func; - if (str) - { - if (str->reserve(SPIDER_SQL_AGAINST_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_AGAINST_STR, SPIDER_SQL_AGAINST_LEN); - } - item = item_list[0]; - if ((error_num = spider_db_print_item_type(item, NULL, spider, str, - alias, alias_length, dbton_id, use_fields, fields))) - DBUG_RETURN(error_num); - if (str) - { - if (str->reserve( - ((item_func_match->flags & FT_BOOL) ? - SPIDER_SQL_IN_BOOLEAN_MODE_LEN : 0) + - ((item_func_match->flags & FT_EXPAND) ? - SPIDER_SQL_WITH_QUERY_EXPANSION_LEN : 0) - )) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - if (item_func_match->flags & FT_BOOL) - str->q_append(SPIDER_SQL_IN_BOOLEAN_MODE_STR, - SPIDER_SQL_IN_BOOLEAN_MODE_LEN); - if (item_func_match->flags & FT_EXPAND) - str->q_append(SPIDER_SQL_WITH_QUERY_EXPANSION_STR, - SPIDER_SQL_WITH_QUERY_EXPANSION_LEN); - } - } else if (item_func->functype() == Item_func::UNKNOWN_FUNC) - { - if ( - func_name_length == 7 && - !strncasecmp("convert", func_name, func_name_length) - ) { - if (str) - { - Item_func_conv_charset *item_func_conv_charset = - (Item_func_conv_charset *)item_func; - CHARSET_INFO *conv_charset = - item_func_conv_charset->SPIDER_Item_func_conv_charset_conv_charset; - uint cset_length = strlen(conv_charset->csname); - if (str->reserve(SPIDER_SQL_USING_LEN + cset_length)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_USING_STR, SPIDER_SQL_USING_LEN); - str->q_append(conv_charset->csname, cset_length); - } - } - } - if (str) - { - if (merge_func) - str->length(str->length() - SPIDER_SQL_CLOSE_PAREN_LEN); - if (str->reserve(last_str_length + SPIDER_SQL_CLOSE_PAREN_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(last_str, last_str_length); - str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN); - } - DBUG_RETURN(0); -} - -int spider_db_oracle_util::open_item_sum_func( - Item_sum *item_sum, - ha_spider *spider, - spider_string *str, - const char *alias, - uint alias_length, - bool use_fields, - spider_fields *fields -) { - uint dbton_id = spider_dbton_oracle.dbton_id; - uint roop_count, item_count = item_sum->get_arg_count(); - int error_num; - DBUG_ENTER("spider_db_oracle_util::open_item_sum_func"); - DBUG_PRINT("info",("spider Sumfunctype = %d", item_sum->sum_func())); - switch (item_sum->sum_func()) - { - case Item_sum::COUNT_FUNC: - case Item_sum::SUM_FUNC: - case Item_sum::MIN_FUNC: - case Item_sum::MAX_FUNC: - { - const char *func_name = item_sum->func_name(); - uint func_name_length = strlen(func_name); - Item *item, **args = item_sum->get_args(); - if (str) - { - if (str->reserve(func_name_length)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(func_name, func_name_length); - } - if (item_count) - { - item_count--; - for (roop_count = 0; roop_count < item_count; roop_count++) - { - item = args[roop_count]; - if ((error_num = spider_db_print_item_type(item, NULL, spider, str, - alias, alias_length, dbton_id, use_fields, fields))) - DBUG_RETURN(error_num); - if (str) - { - if (str->reserve(SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - } - item = args[roop_count]; - if ((error_num = spider_db_print_item_type(item, NULL, spider, str, - alias, alias_length, dbton_id, use_fields, fields))) - DBUG_RETURN(error_num); - } - if (str) - { - if (str->reserve(SPIDER_SQL_CLOSE_PAREN_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, - SPIDER_SQL_CLOSE_PAREN_LEN); - } - } - break; - case Item_sum::COUNT_DISTINCT_FUNC: - case Item_sum::SUM_DISTINCT_FUNC: - case Item_sum::AVG_FUNC: - case Item_sum::AVG_DISTINCT_FUNC: - case Item_sum::STD_FUNC: - case Item_sum::VARIANCE_FUNC: - case Item_sum::SUM_BIT_FUNC: - case Item_sum::UDF_SUM_FUNC: - case Item_sum::GROUP_CONCAT_FUNC: - default: - DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM); - } - DBUG_RETURN(0); -} - -size_t spider_db_oracle_util::escape_string( - char *to, - const char *from, - size_t from_length, - CHARSET_INFO *access_charset -) { - DBUG_ENTER("spider_db_oracle::escape_string"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(escape_quotes_for_mysql(access_charset, to, 0, - from, from_length)); -} - -int spider_db_oracle_util::append_escaped_util( - spider_string *to, - String *from -) { - size_t copy_length; - DBUG_ENTER("spider_db_oracle_util::append_escaped_util"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_PRINT("info",("spider to=%s", to->c_ptr_safe())); - DBUG_PRINT("info",("spider from=%s", from->c_ptr_safe())); - copy_length = escape_string((char *) to->ptr() + to->length(), from->ptr(), - from->length(), to->charset()); - DBUG_PRINT("info",("spider copy_length=%zu", copy_length)); - to->length(to->length() + copy_length); - to->mem_calc(); - DBUG_RETURN(0); -} - -int spider_db_oracle_util::append_from_and_tables( - ha_spider *spider, - spider_fields *fields, - spider_string *str, - TABLE_LIST *table_list, - uint table_count -) { - SPIDER_TABLE_HOLDER *table_holder; - int error_num; - uint dbton_id = spider_dbton_oracle.dbton_id, from_length; - spider_oracle_share *db_share; - spider_oracle_handler *dbton_hdl; - ha_spider *spider; - DBUG_ENTER("spider_db_oracle_util::append_from_and_tables"); - DBUG_PRINT("info",("spider this=%p", this)); - - /* calculate from size */ - from_length = SPIDER_SQL_FROM_LEN; - fields->set_pos_to_first_table_holder(); - while ((table_holder = fields->get_next_table_holder())) - { - spider = table_holder->spider; - db_share = (spider_oracle_share *) - spider->share->dbton_share[dbton_id]; - from_length += - db_share->db_nm_max_length + - SPIDER_SQL_DOT_LEN + /* SPIDER_SQL_NAME_QUOTE_LEN */ 4 + - db_share->table_nm_max_length + - SPIDER_SQL_SPACE_LEN + SPIDER_SQL_COMMA_LEN + - table_holder->alias->length() - SPIDER_SQL_DOT_LEN; - } - - if (str->reserve(from_length)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_FROM_STR, SPIDER_SQL_FROM_LEN); - - fields->set_pos_to_first_table_holder(); - while ((table_holder = fields->get_next_table_holder())) - { - spider = table_holder->spider; - db_share = (spider_oracle_share *) - spider->share->dbton_share[dbton_id]; - dbton_hdl = (spider_oracle_handler *) spider->dbton_handler[dbton_id]; - dbton_hdl->table_name_pos = str->length(); - if ((error_num = db_share->append_table_name_with_adjusting(str, - spider->conn_link_idx[dbton_hdl->first_link_idx]))) - { - DBUG_RETURN(error_num); - } - str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN); - str->q_append(table_holder->alias->ptr(), - table_holder->alias->length() - SPIDER_SQL_DOT_LEN); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - str->length(str->length() - SPIDER_SQL_COMMA_LEN); - DBUG_RETURN(0); -} - -int spider_db_oracle_util::reappend_tables( - spider_fields *fields, - SPIDER_LINK_IDX_CHAIN *link_idx_chain, - spider_string *str -) { - int error_num; - uint dbton_id = spider_dbton_oracle.dbton_id, length; - ha_spider *spider; - spider_oracle_share *db_share; - spider_oracle_handler *dbton_hdl; - SPIDER_TABLE_HOLDER *table_holder; - SPIDER_LINK_IDX_HOLDER *link_idx_holder; - DBUG_ENTER("spider_db_oracle_util::reappend_tables"); - DBUG_PRINT("info",("spider this=%p", this)); - length = str->length(); - fields->set_pos_to_first_table_on_link_idx_chain(link_idx_chain); - fields->set_pos_to_first_table_holder(); - while ((table_holder = fields->get_next_table_holder())) - { - link_idx_holder = fields->get_next_table_on_link_idx_chain(link_idx_chain); - spider = table_holder->spider; - db_share = (spider_oracle_share *) - spider->share->dbton_share[dbton_id]; - if (!db_share->same_db_table_name) - { - dbton_hdl = (spider_oracle_handler *) spider->dbton_handler[dbton_id]; - str->length(dbton_hdl->table_name_pos); - if ((error_num = db_share->append_table_name_with_adjusting(str, - spider->conn_link_idx[link_idx_holder->link_idx]))) - { - DBUG_RETURN(error_num); - } - } - } - str->length(length); - DBUG_RETURN(0); -} - -int spider_db_oracle_util::append_where( - spider_string *str -) { - DBUG_ENTER("spider_db_oracle_util::append_where"); - DBUG_PRINT("info",("spider this=%p", this)); - if (str->reserve(SPIDER_SQL_WHERE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN); - DBUG_RETURN(0); -} - -int spider_db_oracle_util::append_having( - spider_string *str -) { - DBUG_ENTER("spider_db_oracle_util::append_having"); - DBUG_PRINT("info",("spider this=%p", this)); - if (str->reserve(SPIDER_SQL_HAVING_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_HAVING_STR, SPIDER_SQL_HAVING_LEN); - DBUG_RETURN(0); -} - -spider_oracle_share::spider_oracle_share( - st_spider_share *share -) : spider_db_share( - share, - spider_dbton_oracle.dbton_id -), - table_select(NULL), - table_select_pos(0), - key_select(NULL), - key_select_pos(NULL), - key_hint(NULL), - show_table_status(NULL), - show_records(NULL), - show_autoinc(NULL), - show_last_insert_id(NULL), - show_index(NULL), - table_names_str(NULL), - db_names_str(NULL), - db_table_str(NULL), - nextval_str(NULL), - db_table_str_hash_value(NULL), - table_nm_max_length(0), - db_nm_max_length(0), - nextval_max_length(0), - column_name_str(NULL), - same_db_table_name(TRUE), - first_all_link_idx(-1) -{ - DBUG_ENTER("spider_oracle_share::spider_oracle_share"); - DBUG_PRINT("info",("spider this=%p", this)); - spider_alloc_calc_mem_init(mem_calc, SPD_MID_ORACLE_SHARE_SPIDER_ORACLE_SHARE_1); - spider_alloc_calc_mem(spider_current_trx, mem_calc, sizeof(*this)); - DBUG_VOID_RETURN; -} - -spider_oracle_share::~spider_oracle_share() -{ - DBUG_ENTER("spider_oracle_share::~spider_oracle_share"); - DBUG_PRINT("info",("spider this=%p", this)); - if (table_select) - delete [] table_select; - if (key_select) - delete [] key_select; - if (key_hint) - delete [] key_hint; - free_show_table_status(); - free_show_records(); - free_show_autoinc(); - free_show_last_insert_id(); - free_show_index(); - free_column_name_str(); - free_table_names_str(); - if (key_select_pos) - { - spider_free(spider_current_trx, key_select_pos, MYF(0)); - } - spider_free_mem_calc(spider_current_trx, mem_calc_id, sizeof(*this)); - DBUG_VOID_RETURN; -} - -int spider_oracle_share::init() -{ - int error_num; - uint roop_count; - TABLE_SHARE *table_share = spider_share->table_share; - uint keys = table_share ? table_share->keys : 0; - DBUG_ENTER("spider_oracle_share::init"); - DBUG_PRINT("info",("spider this=%p", this)); - if (!(key_select_pos = (int *) - spider_bulk_alloc_mem(spider_current_trx, SPD_MID_ORACLE_SHARE_INIT_1, - __func__, __FILE__, __LINE__, MYF(MY_WME | MY_ZEROFILL), - &key_select_pos, - sizeof(int) * keys, - &db_table_str_hash_value, - sizeof(my_hash_value_type) * spider_share->all_link_count, - NullS)) - ) { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - - if (keys > 0 && - !(key_hint = new spider_string[keys]) - ) { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - for (roop_count = 0; roop_count < keys; roop_count++) - { - key_hint[roop_count].init_calc_mem(SPD_MID_ORACLE_SHARE_INIT_2); - key_hint[roop_count].set_charset(spider_share->access_charset); - } - DBUG_PRINT("info",("spider key_hint=%p", key_hint)); - - if ( - !(table_select = new spider_string[1]) || - (keys > 0 && - !(key_select = new spider_string[keys]) - ) || - (error_num = create_table_names_str()) || - (table_share && - ( - (error_num = create_column_name_str()) || - (error_num = convert_key_hint_str()) || - (error_num = append_show_table_status()) || - (error_num = append_show_records()) || - (error_num = append_show_autoinc()) || - (error_num = append_show_last_insert_id()) || - (error_num = append_show_index()) - ) - ) - ) { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - - table_select->init_calc_mem(SPD_MID_ORACLE_SHARE_INIT_3); - if (table_share && (error_num = append_table_select())) - DBUG_RETURN(error_num); - - for (roop_count = 0; roop_count < keys; roop_count++) - { - key_select[roop_count].init_calc_mem(SPD_MID_ORACLE_SHARE_INIT_4); - if ((error_num = append_key_select(roop_count))) - DBUG_RETURN(error_num); - } - - DBUG_RETURN(error_num); -} - -uint spider_oracle_share::get_column_name_length( - uint field_index -) { - DBUG_ENTER("spider_oracle_share::get_column_name_length"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(column_name_str[field_index].length()); -} - -int spider_oracle_share::append_column_name( - spider_string *str, - uint field_index -) { - int error_num; - DBUG_ENTER("spider_oracle_share::append_column_name"); - DBUG_PRINT("info",("spider this=%p", this)); - error_num = spider_db_oracle_utility.append_name(str, - column_name_str[field_index].ptr(), column_name_str[field_index].length()); - DBUG_RETURN(error_num); -} - -int spider_oracle_share::append_column_name_with_alias( - spider_string *str, - uint field_index, - const char *alias, - uint alias_length -) { - DBUG_ENTER("spider_oracle_share::append_column_name_with_alias"); - DBUG_PRINT("info",("spider this=%p", this)); - if (str->reserve( - alias_length + - column_name_str[field_index].length() + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(alias, alias_length); - append_column_name(str, field_index); - DBUG_RETURN(0); -} - -int spider_oracle_share::append_table_name( - spider_string *str, - int all_link_idx -) { - const char *db_nm = db_names_str[all_link_idx].ptr(); - uint db_nm_len = db_names_str[all_link_idx].length(); - const char *table_nm = table_names_str[all_link_idx].ptr(); - uint table_nm_len = table_names_str[all_link_idx].length(); - DBUG_ENTER("spider_oracle_share::append_table_name"); - DBUG_PRINT("info",("spider this=%p", this)); - if (str->reserve(db_nm_len + SPIDER_SQL_DOT_LEN + table_nm_len + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 4)) - { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - spider_db_oracle_utility.append_name(str, db_nm, db_nm_len); - str->q_append(SPIDER_SQL_DOT_STR, SPIDER_SQL_DOT_LEN); - spider_db_oracle_utility.append_name(str, table_nm, table_nm_len); - DBUG_RETURN(0); -} - -int spider_oracle_share::append_table_name_with_adjusting( - spider_string *str, - int all_link_idx -) { - const char *db_nm = db_names_str[all_link_idx].ptr(); - uint db_nm_len = db_names_str[all_link_idx].length(); - uint db_nm_max_len = db_nm_max_length; - const char *table_nm = table_names_str[all_link_idx].ptr(); - uint table_nm_len = table_names_str[all_link_idx].length(); - uint table_nm_max_len = table_nm_max_length; - DBUG_ENTER("spider_oracle_share::append_table_name_with_adjusting"); - DBUG_PRINT("info",("spider this=%p", this)); - spider_db_oracle_utility.append_name(str, db_nm, db_nm_len); - str->q_append(SPIDER_SQL_DOT_STR, SPIDER_SQL_DOT_LEN); - spider_db_oracle_utility.append_name(str, table_nm, table_nm_len); - uint length = - db_nm_max_len - db_nm_len + - table_nm_max_len - table_nm_len; - memset((char *) str->ptr() + str->length(), ' ', length); - str->length(str->length() + length); - DBUG_RETURN(0); -} - -int spider_oracle_share::append_from_with_adjusted_table_name( - spider_string *str, - int *table_name_pos -) { - const char *db_nm = db_names_str[0].ptr(); - uint db_nm_len = db_names_str[0].length(); - uint db_nm_max_len = db_nm_max_length; - const char *table_nm = table_names_str[0].ptr(); - uint table_nm_len = table_names_str[0].length(); - uint table_nm_max_len = table_nm_max_length; - DBUG_ENTER("spider_oracle_share::append_from_with_adjusted_table_name"); - DBUG_PRINT("info",("spider this=%p", this)); - if (str->reserve(SPIDER_SQL_FROM_LEN + db_nm_max_length + - SPIDER_SQL_DOT_LEN + table_nm_max_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 4)) - { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - str->q_append(SPIDER_SQL_FROM_STR, SPIDER_SQL_FROM_LEN); - *table_name_pos = str->length(); - spider_db_oracle_utility.append_name(str, db_nm, db_nm_len); - str->q_append(SPIDER_SQL_DOT_STR, SPIDER_SQL_DOT_LEN); - spider_db_oracle_utility.append_name(str, table_nm, table_nm_len); - uint length = - db_nm_max_len - db_nm_len + - table_nm_max_len - table_nm_len; - memset((char *) str->ptr() + str->length(), ' ', length); - str->length(str->length() + length); - DBUG_RETURN(0); -} - -int spider_oracle_share::create_table_names_str() -{ - int error_num, roop_count; - uint table_nm_len, db_nm_len; - spider_string *str, *first_tbl_nm_str, *first_db_nm_str, *first_db_tbl_str; - char *first_tbl_nm, *first_db_nm; - uint dbton_id = spider_dbton_oracle.dbton_id; - DBUG_ENTER("spider_oracle_share::create_table_names_str"); - table_names_str = NULL; - db_names_str = NULL; - db_table_str = NULL; - if ( - !(table_names_str = new spider_string[spider_share->all_link_count]) || - !(db_names_str = new spider_string[spider_share->all_link_count]) || - !(db_table_str = new spider_string[spider_share->all_link_count]) - ) { - error_num = HA_ERR_OUT_OF_MEM; - goto error; - } - - same_db_table_name = TRUE; - first_tbl_nm = spider_share->tgt_table_names[0]; - first_db_nm = spider_share->tgt_dbs[0]; - table_nm_len = spider_share->tgt_table_names_lengths[0]; - db_nm_len = spider_share->tgt_dbs_lengths[0]; - first_tbl_nm_str = &table_names_str[0]; - first_db_nm_str = &db_names_str[0]; - first_db_tbl_str = &db_table_str[0]; - for (roop_count = 0; roop_count < (int) spider_share->all_link_count; - roop_count++) - { - table_names_str[roop_count].init_calc_mem(SPD_MID_ORACLE_SHARE_CREATE_TABLE_NAMES_STR_1); - db_names_str[roop_count].init_calc_mem(SPD_MID_ORACLE_SHARE_CREATE_TABLE_NAMES_STR_2); - db_table_str[roop_count].init_calc_mem(SPD_MID_ORACLE_SHARE_CREATE_TABLE_NAMES_STR_3); - if (spider_share->sql_dbton_ids[roop_count] != dbton_id) - continue; - if (first_all_link_idx == -1) - first_all_link_idx = roop_count; - - str = &table_names_str[roop_count]; - if ( - roop_count != 0 && - same_db_table_name && - spider_share->tgt_table_names_lengths[roop_count] == table_nm_len && - !memcmp(first_tbl_nm, spider_share->tgt_table_names[roop_count], - table_nm_len) - ) { - if (str->copy(*first_tbl_nm_str)) - { - error_num = HA_ERR_OUT_OF_MEM; - goto error; - } - } else { - str->set_charset(spider_share->access_charset); - if ((error_num = spider_db_append_name_with_quote_str(str, - spider_share->tgt_table_names[roop_count], dbton_id))) - goto error; - if (roop_count) - { - same_db_table_name = FALSE; - DBUG_PRINT("info", ("spider found different table name %s", - spider_share->tgt_table_names[roop_count])); - if (str->length() > table_nm_max_length) - table_nm_max_length = str->length(); - } else - table_nm_max_length = str->length(); - } - - str = &db_names_str[roop_count]; - if ( - roop_count != 0 && - same_db_table_name && - spider_share->tgt_dbs_lengths[roop_count] == db_nm_len && - !memcmp(first_db_nm, spider_share->tgt_dbs[roop_count], - db_nm_len) - ) { - if (str->copy(*first_db_nm_str)) - { - error_num = HA_ERR_OUT_OF_MEM; - goto error; - } - } else { - str->set_charset(spider_share->access_charset); - if ((error_num = spider_db_append_name_with_quote_str(str, - spider_share->tgt_dbs[roop_count], dbton_id))) - goto error; - if (roop_count) - { - same_db_table_name = FALSE; - DBUG_PRINT("info", ("spider found different db name %s", - spider_share->tgt_dbs[roop_count])); - if (str->length() > db_nm_max_length) - db_nm_max_length = str->length(); - } else - db_nm_max_length = str->length(); - } - - str = &db_table_str[roop_count]; - if ( - roop_count != 0 && - same_db_table_name - ) { - if (str->copy(*first_db_tbl_str)) - { - error_num = HA_ERR_OUT_OF_MEM; - goto error; - } - } else { - str->set_charset(spider_share->access_charset); - if ((error_num = append_table_name(str, roop_count))) - goto error; - } - db_table_str_hash_value[roop_count] = my_calc_hash( - &spider_open_connections, (uchar*) str->ptr(), str->length()); - } - DBUG_RETURN(0); - -error: - if (db_table_str) - { - delete [] db_table_str; - db_table_str = NULL; - } - if (db_names_str) - { - delete [] db_names_str; - db_names_str = NULL; - } - if (table_names_str) - { - delete [] table_names_str; - table_names_str = NULL; - } - DBUG_RETURN(error_num); -} - -void spider_oracle_share::free_table_names_str() -{ - DBUG_ENTER("spider_oracle_share::free_table_names_str"); - if (db_table_str) - { - delete [] db_table_str; - db_table_str = NULL; - } - if (db_names_str) - { - delete [] db_names_str; - db_names_str = NULL; - } - if (table_names_str) - { - delete [] table_names_str; - table_names_str = NULL; - } - DBUG_VOID_RETURN; -} - -int spider_oracle_share::create_column_name_str() -{ - spider_string *str; - int error_num; - Field **field; - TABLE_SHARE *table_share = spider_share->table_share; - uint dbton_id = spider_dbton_oracle.dbton_id; - DBUG_ENTER("spider_oracle_share::create_column_name_str"); - if ( - table_share->fields && - !(column_name_str = new spider_string[table_share->fields]) - ) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - for (field = table_share->field, str = column_name_str; - *field; field++, str++) - { - str->init_calc_mem(SPD_MID_ORACLE_SHARE_CREATE_COLUMN_NAME_STR_1); - str->set_charset(spider_share->access_charset); - if ((error_num = spider_db_append_name_with_quote_str(str, - (*field)->field_name, dbton_id))) - goto error; - } - DBUG_RETURN(0); - -error: - if (column_name_str) - { - delete [] column_name_str; - column_name_str = NULL; - } - DBUG_RETURN(error_num); -} - -void spider_oracle_share::free_column_name_str() -{ - DBUG_ENTER("spider_oracle_share::free_column_name_str"); - if (column_name_str) - { - delete [] column_name_str; - column_name_str = NULL; - } - DBUG_VOID_RETURN; -} - -int spider_oracle_share::convert_key_hint_str() -{ - spider_string *tmp_key_hint; - int roop_count; - TABLE_SHARE *table_share = spider_share->table_share; - DBUG_ENTER("spider_oracle_share::convert_key_hint_str"); - if (spider_share->access_charset->cset != system_charset_info->cset) - { - /* need conversion */ - for (roop_count = 0, tmp_key_hint = key_hint; - roop_count < (int) table_share->keys; roop_count++, tmp_key_hint++) - { - tmp_key_hint->length(0); - if (tmp_key_hint->append(spider_share->key_hint->ptr(), - spider_share->key_hint->length(), system_charset_info)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - } else { - for (roop_count = 0, tmp_key_hint = key_hint; - roop_count < (int) table_share->keys; roop_count++, tmp_key_hint++) - { - if (tmp_key_hint->copy(spider_share->key_hint[roop_count])) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - } - DBUG_RETURN(0); -} - -int spider_oracle_share::append_show_table_status() -{ - int roop_count; - spider_string *str; - uint dbton_id = spider_dbton_oracle.dbton_id; - DBUG_ENTER("spider_oracle_append_show_table_status"); - if (!(show_table_status = - new spider_string[2 * spider_share->all_link_count])) - goto error; - - for (roop_count = 0; roop_count < (int) spider_share->all_link_count; - roop_count++) - { - show_table_status[0 + (2 * roop_count)].init_calc_mem(SPD_MID_ORACLE_SHARE_APPEND_SHOW_TABLE_STATUS_1); - show_table_status[1 + (2 * roop_count)].init_calc_mem(SPD_MID_ORACLE_SHARE_APPEND_SHOW_TABLE_STATUS_2); - if (spider_share->sql_dbton_ids[roop_count] != dbton_id) - continue; - - if ( - show_table_status[0 + (2 * roop_count)].reserve( - SPIDER_SQL_SHOW_TABLE_STATUS_LEN + - db_names_str[roop_count].length() + - SPIDER_SQL_LIKE_LEN + table_names_str[roop_count].length() + - ((SPIDER_SQL_NAME_QUOTE_LEN) * 2) + - ((SPIDER_SQL_VALUE_QUOTE_LEN) * 2)) || - show_table_status[1 + (2 * roop_count)].reserve( - SPIDER_SQL_SELECT_TABLES_STATUS_LEN + - db_names_str[roop_count].length() + - SPIDER_SQL_AND_LEN + SPIDER_SQL_TABLE_NAME_LEN + SPIDER_SQL_EQUAL_LEN + - table_names_str[roop_count].length() + - ((SPIDER_SQL_VALUE_QUOTE_LEN) * 4)) - ) - goto error; - str = &show_table_status[0 + (2 * roop_count)]; - str->q_append( - SPIDER_SQL_SHOW_TABLE_STATUS_STR, SPIDER_SQL_SHOW_TABLE_STATUS_LEN); - str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); - str->q_append(db_names_str[roop_count].ptr(), - db_names_str[roop_count].length()); - str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); - str->q_append(SPIDER_SQL_LIKE_STR, SPIDER_SQL_LIKE_LEN); - str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); - str->q_append(table_names_str[roop_count].ptr(), - table_names_str[roop_count].length()); - str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); - str = &show_table_status[1 + (2 * roop_count)]; - str->q_append( - SPIDER_SQL_SELECT_TABLES_STATUS_STR, - SPIDER_SQL_SELECT_TABLES_STATUS_LEN); - str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); - str->q_append(db_names_str[roop_count].ptr(), - db_names_str[roop_count].length()); - str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); - str->q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN); - str->q_append(SPIDER_SQL_TABLE_NAME_STR, SPIDER_SQL_TABLE_NAME_LEN); - str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN); - str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); - str->q_append(table_names_str[roop_count].ptr(), - table_names_str[roop_count].length()); - str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); - } - DBUG_RETURN(0); - -error: - if (show_table_status) - { - delete [] show_table_status; - show_table_status = NULL; - } - DBUG_RETURN(HA_ERR_OUT_OF_MEM); -} - -void spider_oracle_share::free_show_table_status() -{ - DBUG_ENTER("spider_oracle_free_show_table_status"); - if (show_table_status) - { - delete [] show_table_status; - show_table_status = NULL; - } - DBUG_VOID_RETURN; -} - -int spider_oracle_share::append_show_records() -{ - int roop_count; - spider_string *str; - uint dbton_id = spider_dbton_oracle.dbton_id; - DBUG_ENTER("spider_oracle_share::append_show_records"); - if (!(show_records = new spider_string[spider_share->all_link_count])) - goto error; - - for (roop_count = 0; roop_count < (int) spider_share->all_link_count; - roop_count++) - { - show_records[roop_count].init_calc_mem(SPD_MID_ORACLE_SHARE_APPEND_SHOW_RECORDS_1); - if (spider_share->sql_dbton_ids[roop_count] != dbton_id) - continue; - - if ( - show_records[roop_count].reserve( - SPIDER_SQL_SHOW_RECORDS_LEN + - db_names_str[roop_count].length() + - SPIDER_SQL_DOT_LEN + - table_names_str[roop_count].length() + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 4) - ) - goto error; - str = &show_records[roop_count]; - str->q_append(SPIDER_SQL_SHOW_RECORDS_STR, SPIDER_SQL_SHOW_RECORDS_LEN); - append_table_name(str, roop_count); - } - DBUG_RETURN(0); - -error: - if (show_records) - { - delete [] show_records; - show_records = NULL; - } - DBUG_RETURN(HA_ERR_OUT_OF_MEM); -} - -void spider_oracle_share::free_show_records() -{ - DBUG_ENTER("spider_oracle_share::free_show_records"); - if (show_records) - { - delete [] show_records; - show_records = NULL; - } - DBUG_VOID_RETURN; -} - -int spider_oracle_share::append_show_autoinc() -{ - uint roop_count, field_length; - spider_string *str; - uint dbton_id = spider_dbton_oracle.dbton_id; - Field **found_next_number_field = - spider_share->table_share->found_next_number_field; - DBUG_ENTER("spider_oracle_share::append_show_autoinc"); - if (!found_next_number_field) - DBUG_RETURN(0); - - if (!(show_autoinc = new spider_string[spider_share->all_link_count])) - goto error; - - field_length = - column_name_str[(*found_next_number_field)->field_index].length(); - for (roop_count = 0; roop_count < spider_share->all_link_count; - roop_count++) - { - show_autoinc[roop_count].init_calc_mem(SPD_MID_ORACLE_SHARE_APPEND_SHOW_AUTOINC_1); - if (spider_share->sql_dbton_ids[roop_count] != dbton_id) - continue; - - if ( - show_autoinc[roop_count].reserve( - SPIDER_SQL_SELECT_LEN + - SPIDER_SQL_MAX_LEN + - SPIDER_SQL_OPEN_PAREN_LEN + - field_length + - SPIDER_SQL_CLOSE_PAREN_LEN + - SPIDER_SQL_FROM_LEN + - db_names_str[roop_count].length() + - SPIDER_SQL_DOT_LEN + - table_names_str[roop_count].length() + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 6) - ) - goto error; - str = &show_autoinc[roop_count]; - str->q_append(SPIDER_SQL_SELECT_STR, SPIDER_SQL_SELECT_LEN); - str->q_append(SPIDER_SQL_MAX_STR, SPIDER_SQL_MAX_LEN); - str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN); - append_column_name(str, (*found_next_number_field)->field_index); - str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN); - str->q_append(SPIDER_SQL_FROM_STR, SPIDER_SQL_FROM_LEN); - append_table_name(str, roop_count); - } - DBUG_RETURN(0); - -error: - if (show_autoinc) - { - delete [] show_autoinc; - show_autoinc = NULL; - } - DBUG_RETURN(HA_ERR_OUT_OF_MEM); -} - -void spider_oracle_share::free_show_autoinc() -{ - DBUG_ENTER("spider_oracle_share::free_show_autoinc"); - if (show_autoinc) - { - delete [] show_autoinc; - show_autoinc = NULL; - } - DBUG_VOID_RETURN; -} - -int spider_oracle_share::append_show_last_insert_id() -{ - uint roop_count; - spider_string *str; - uint dbton_id = spider_dbton_oracle.dbton_id; - Field **found_next_number_field = - spider_share->table_share->found_next_number_field; - uint seq_nm_max_length = 0; - DBUG_ENTER("spider_oracle_share::append_show_last_insert_id"); - if (!found_next_number_field) - DBUG_RETURN(0); - - if ( - !(show_last_insert_id = new spider_string[spider_share->all_link_count]) || - !(nextval_str = new spider_string[spider_share->all_link_count]) - ) - goto error; - - for (roop_count = 0; roop_count < spider_share->all_link_count; - roop_count++) - { - show_last_insert_id[roop_count].init_calc_mem(SPD_MID_ORACLE_SHARE_APPEND_SHOW_LAST_INSERT_ID_1); - nextval_str[roop_count].init_calc_mem(SPD_MID_ORACLE_SHARE_APPEND_SHOW_LAST_INSERT_ID_2); - if (spider_share->sql_dbton_ids[roop_count] != dbton_id) - continue; - - if ( - show_last_insert_id[roop_count].reserve( - SPIDER_SQL_SELECT_LEN + - spider_share->tgt_sequence_names_lengths[roop_count] + - SPIDER_SQL_CURRVAL_LEN + - SPIDER_SQL_FROM_DUAL_LEN + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2) - ) - goto error; - str = &show_last_insert_id[roop_count]; - str->q_append(SPIDER_SQL_SELECT_STR, SPIDER_SQL_SELECT_LEN); - spider_db_oracle_utility.append_name(str, - spider_share->tgt_sequence_names[roop_count], - spider_share->tgt_sequence_names_lengths[roop_count]); - str->q_append(SPIDER_SQL_CURRVAL_STR, SPIDER_SQL_CURRVAL_LEN); - str->q_append(SPIDER_SQL_FROM_DUAL_STR, SPIDER_SQL_FROM_DUAL_LEN); - - if (seq_nm_max_length < - spider_share->tgt_sequence_names_lengths[roop_count]) - { - seq_nm_max_length = - spider_share->tgt_sequence_names_lengths[roop_count]; - } - } - for (roop_count = 0; roop_count < spider_share->all_link_count; - roop_count++) - { - if (spider_share->sql_dbton_ids[roop_count] != dbton_id) - continue; - - if ( - nextval_str[roop_count].reserve( - seq_nm_max_length + - SPIDER_SQL_NEXTVAL_LEN + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2) - ) - goto error; - str = &nextval_str[roop_count]; - spider_db_oracle_utility.append_name(str, - spider_share->tgt_sequence_names[roop_count], - spider_share->tgt_sequence_names_lengths[roop_count]); - str->q_append(SPIDER_SQL_NEXTVAL_STR, SPIDER_SQL_NEXTVAL_LEN); - uint length = - seq_nm_max_length - spider_share->tgt_sequence_names_lengths[roop_count]; - memset((char *) str->ptr() + str->length(), ' ', length); - str->length(str->length() + length); - nextval_max_length = str->length(); - } - DBUG_RETURN(0); - -error: - if (show_last_insert_id) - { - delete [] show_last_insert_id; - show_last_insert_id = NULL; - } - if (nextval_str) - { - delete [] nextval_str; - nextval_str = NULL; - } - DBUG_RETURN(HA_ERR_OUT_OF_MEM); -} - -void spider_oracle_share::free_show_last_insert_id() -{ - DBUG_ENTER("spider_oracle_share::free_show_last_insert_id"); - if (show_last_insert_id) - { - delete [] show_last_insert_id; - show_last_insert_id = NULL; - } - if (nextval_str) - { - delete [] nextval_str; - nextval_str = NULL; - } - DBUG_VOID_RETURN; -} - -int spider_oracle_share::append_show_index() -{ - int roop_count; - spider_string *str; - uint dbton_id = spider_dbton_oracle.dbton_id; - DBUG_ENTER("spider_oracle_share::append_show_index"); - if (!(show_index = new spider_string[2 * spider_share->all_link_count])) - goto error; - - for (roop_count = 0; roop_count < (int) spider_share->all_link_count; - roop_count++) - { - show_index[0 + (2 * roop_count)].init_calc_mem(SPD_MID_ORACLE_SHARE_APPEND_SHOW_INDEX_1); - show_index[1 + (2 * roop_count)].init_calc_mem(SPD_MID_ORACLE_SHARE_APPEND_SHOW_INDEX_2); - if (spider_share->sql_dbton_ids[roop_count] != dbton_id) - continue; - - if ( - show_index[0 + (2 * roop_count)].reserve( - SPIDER_SQL_SHOW_INDEX_LEN + db_names_str[roop_count].length() + - SPIDER_SQL_DOT_LEN + - table_names_str[roop_count].length() + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 4) || - show_index[1 + (2 * roop_count)].reserve( - SPIDER_SQL_SELECT_STATISTICS_LEN + - db_names_str[roop_count].length() + - SPIDER_SQL_AND_LEN + SPIDER_SQL_TABLE_NAME_LEN + SPIDER_SQL_EQUAL_LEN + - table_names_str[roop_count].length() + - ((SPIDER_SQL_VALUE_QUOTE_LEN) * 4) + - SPIDER_SQL_GROUP_LEN + SPIDER_SQL_COLUMN_NAME_LEN) - ) - goto error; - str = &show_index[0 + (2 * roop_count)]; - str->q_append( - SPIDER_SQL_SHOW_INDEX_STR, SPIDER_SQL_SHOW_INDEX_LEN); - append_table_name(str, roop_count); - str = &show_index[1 + (2 * roop_count)]; - str->q_append( - SPIDER_SQL_SELECT_STATISTICS_STR, SPIDER_SQL_SELECT_STATISTICS_LEN); - str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); - str->q_append(db_names_str[roop_count].ptr(), - db_names_str[roop_count].length()); - str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); - str->q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN); - str->q_append(SPIDER_SQL_TABLE_NAME_STR, SPIDER_SQL_TABLE_NAME_LEN); - str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN); - str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); - str->q_append(table_names_str[roop_count].ptr(), - table_names_str[roop_count].length()); - str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); - str->q_append(SPIDER_SQL_GROUP_STR, SPIDER_SQL_GROUP_LEN); - str->q_append(SPIDER_SQL_COLUMN_NAME_STR, SPIDER_SQL_COLUMN_NAME_LEN); - } - DBUG_RETURN(0); - -error: - if (show_index) - { - delete [] show_index; - show_index = NULL; - } - DBUG_RETURN(HA_ERR_OUT_OF_MEM); -} - -void spider_oracle_share::free_show_index() -{ - DBUG_ENTER("spider_oracle_share::free_show_index"); - if (show_index) - { - delete [] show_index; - show_index = NULL; - } - DBUG_VOID_RETURN; -} - -int spider_oracle_share::append_table_select() -{ - Field **field; - uint field_length; - spider_string *str = table_select; - TABLE_SHARE *table_share = spider_share->table_share; - DBUG_ENTER("spider_oracle_share::append_table_select"); - - if (!*table_share->field) - DBUG_RETURN(0); - - for (field = table_share->field; *field; field++) - { - field_length = column_name_str[(*field)->field_index].length(); - if (str->reserve(field_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - append_column_name(str, (*field)->field_index); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - str->length(str->length() - SPIDER_SQL_COMMA_LEN); - DBUG_RETURN(append_from_with_adjusted_table_name(str, &table_select_pos)); -} - -int spider_oracle_share::append_key_select( - uint idx -) { - KEY_PART_INFO *key_part; - Field *field; - uint part_num; - uint field_length; - spider_string *str = &key_select[idx]; - TABLE_SHARE *table_share = spider_share->table_share; - const KEY *key_info = &table_share->key_info[idx]; - DBUG_ENTER("spider_oracle_share::append_key_select"); - - if (!spider_user_defined_key_parts(key_info)) - DBUG_RETURN(0); - - for (key_part = key_info->key_part, part_num = 0; - part_num < spider_user_defined_key_parts(key_info); key_part++, part_num++) - { - field = key_part->field; - field_length = column_name_str[field->field_index].length(); - if (str->reserve(field_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - append_column_name(str, field->field_index); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - str->length(str->length() - SPIDER_SQL_COMMA_LEN); - DBUG_RETURN(append_from_with_adjusted_table_name(str, &key_select_pos[idx])); -} - -bool spider_oracle_share::need_change_db_table_name() -{ - DBUG_ENTER("spider_oracle_share::need_change_db_table_name"); - DBUG_RETURN(!same_db_table_name); -} - -#ifdef SPIDER_HAS_DISCOVER_TABLE_STRUCTURE -int spider_oracle_share::discover_table_structure( - SPIDER_TRX *trx, - SPIDER_SHARE *spider_share, - spider_string *str -) { - DBUG_ENTER("spider_oracle_share::discover_table_structure"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(HA_ERR_WRONG_COMMAND); -} -#endif - -spider_oracle_handler::spider_oracle_handler( - ha_spider *spider, - spider_oracle_share *db_share -) : spider_db_handler( - spider, - db_share -), - where_pos(0), - order_pos(0), - limit_pos(0), - table_name_pos(0), - update_set_pos(0), - ha_read_pos(0), - ha_next_pos(0), - ha_where_pos(0), - ha_limit_pos(0), - ha_table_name_pos(0), - insert_pos(0), - insert_table_name_pos(0), - upd_tmp_tbl(NULL), - tmp_sql_pos1(0), - tmp_sql_pos2(0), - tmp_sql_pos3(0), - tmp_sql_pos4(0), - tmp_sql_pos5(0), - table_lock_mode(0), - reading_from_bulk_tmp_table(FALSE), - filled_up(FALSE), - select_rownum_appended(FALSE), - update_rownum_appended(FALSE), - union_table_name_pos_first(NULL), - union_table_name_pos_current(NULL), - oracle_share(db_share), - link_for_hash(NULL) -{ - DBUG_ENTER("spider_oracle_handler::spider_oracle_handler"); - DBUG_PRINT("info",("spider this=%p", this)); - spider_alloc_calc_mem_init(mem_calc, SPD_MID_ORACLE_HANDLER_SPIDER_ORACLE_HANDLER_1); - spider_alloc_calc_mem(spider_current_trx, mem_calc, sizeof(*this)); - DBUG_VOID_RETURN; -} - -spider_oracle_handler::~spider_oracle_handler() -{ - DBUG_ENTER("spider_oracle_handler::~spider_oracle_handler"); - DBUG_PRINT("info",("spider this=%p", this)); - while (union_table_name_pos_first) - { - SPIDER_INT_HLD *tmp_pos = union_table_name_pos_first; - union_table_name_pos_first = tmp_pos->next; - spider_free(spider_current_trx, tmp_pos, MYF(0)); - } - if (link_for_hash) - { - spider_free(spider_current_trx, link_for_hash, MYF(0)); - } - spider_free_mem_calc(spider_current_trx, mem_calc_id, sizeof(*this)); - DBUG_VOID_RETURN; -} - -int spider_oracle_handler::init() -{ - uint roop_count; - THD *thd = spider->wide_handler->trx->thd; - st_spider_share *share = spider->share; - int init_sql_alloc_size = - spider_param_init_sql_alloc_size(thd, share->init_sql_alloc_size); - TABLE *table = spider->get_table(); - DBUG_ENTER("spider_oracle_handler::init"); - DBUG_PRINT("info",("spider this=%p", this)); - sql.init_calc_mem(SPD_MID_ORACLE_HANDLER_INIT_1); - sql_part.init_calc_mem(SPD_MID_ORACLE_HANDLER_INIT_2); - sql_part2.init_calc_mem(SPD_MID_ORACLE_HANDLER_INIT_3); - ha_sql.init_calc_mem(SPD_MID_ORACLE_HANDLER_INIT_4); - insert_sql.init_calc_mem(SPD_MID_ORACLE_HANDLER_INIT_5); - update_sql.init_calc_mem(SPD_MID_ORACLE_HANDLER_INIT_6); - tmp_sql.init_calc_mem(SPD_MID_ORACLE_HANDLER_INIT_7); - dup_update_sql.init_calc_mem(SPD_MID_ORACLE_HANDLER_INIT_8); - if ( - (sql.real_alloc(init_sql_alloc_size)) || - (insert_sql.real_alloc(init_sql_alloc_size)) || - (update_sql.real_alloc(init_sql_alloc_size)) || - (tmp_sql.real_alloc(init_sql_alloc_size)) - ) { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - sql.set_charset(share->access_charset); - sql_part.set_charset(share->access_charset); - sql_part2.set_charset(share->access_charset); - ha_sql.set_charset(share->access_charset); - insert_sql.set_charset(share->access_charset); - update_sql.set_charset(share->access_charset); - tmp_sql.set_charset(share->access_charset); - dup_update_sql.set_charset(share->access_charset); - upd_tmp_tbl_prm.init(); - upd_tmp_tbl_prm.field_count = 1; - if (!(link_for_hash = (SPIDER_LINK_FOR_HASH *) - spider_bulk_alloc_mem(spider_current_trx, SPD_MID_ORACLE_HANDLER_INIT_9, - __func__, __FILE__, __LINE__, MYF(MY_WME | MY_ZEROFILL), - &link_for_hash, - sizeof(SPIDER_LINK_FOR_HASH) * share->link_count, - &minimum_select_bitmap, - table ? sizeof(uchar) * no_bytes_in_map(table->read_set) : 0, - NullS)) - ) { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - for (roop_count = 0; roop_count < share->link_count; roop_count++) - { - link_for_hash[roop_count].spider = spider; - link_for_hash[roop_count].link_idx = roop_count; - link_for_hash[roop_count].db_table_str = - &oracle_share->db_table_str[roop_count]; - link_for_hash[roop_count].db_table_str_hash_value = - oracle_share->db_table_str_hash_value[roop_count]; - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_index_hint( - spider_string *str, - int link_idx, - ulong sql_type - ) -{ - DBUG_ENTER("spider_oracle_handler::append_index_hint"); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_table_name_with_adjusting( - spider_string *str, - int link_idx, - ulong sql_type -) { - int error_num = 0; - DBUG_ENTER("spider_oracle_handler::append_table_name_with_adjusting"); - DBUG_PRINT("info",("spider this=%p", this)); - if (sql_type == SPIDER_SQL_TYPE_HANDLER) - { - str->q_append(spider->m_handler_cid[link_idx], SPIDER_SQL_HANDLER_CID_LEN); - } else { - error_num = oracle_share->append_table_name_with_adjusting(str, - spider->conn_link_idx[link_idx]); - } - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_key_column_types( - const key_range *start_key, - spider_string *str -) { - SPIDER_RESULT_LIST *result_list = &spider->result_list; - KEY *key_info = result_list->key_info; - uint key_name_length, key_count; - key_part_map full_key_part_map = - make_prev_keypart_map(spider_user_defined_key_parts(key_info)); - key_part_map start_key_part_map; - KEY_PART_INFO *key_part; - Field *field; - char tmp_buf[MAX_FIELD_WIDTH]; - spider_string tmp_str(tmp_buf, sizeof(tmp_buf), system_charset_info); - DBUG_ENTER("spider_oracle_handler::append_key_column_types"); - DBUG_PRINT("info",("spider this=%p", this)); - tmp_str.init_calc_mem(SPD_MID_ORACLE_HANDLER_APPEND_KEY_COLUMN_TYPES_1); - - start_key_part_map = start_key->keypart_map & full_key_part_map; - DBUG_PRINT("info", ("spider spider_user_defined_key_parts=%u", - spider_user_defined_key_parts(key_info))); - DBUG_PRINT("info", ("spider full_key_part_map=%lu", full_key_part_map)); - DBUG_PRINT("info", ("spider start_key_part_map=%lu", start_key_part_map)); - - if (!start_key_part_map) - DBUG_RETURN(0); - - for ( - key_part = key_info->key_part, - key_count = 0; - start_key_part_map; - start_key_part_map >>= 1, - key_part++, - key_count++ - ) { - field = key_part->field; - key_name_length = my_sprintf(tmp_buf, (tmp_buf, "c%u", key_count)); - if (str->reserve(key_name_length + SPIDER_SQL_SPACE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(tmp_buf, key_name_length); - str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN); - - if (tmp_str.ptr() != tmp_buf) - tmp_str.set(tmp_buf, sizeof(tmp_buf), system_charset_info); - else - tmp_str.set_charset(system_charset_info); - field->sql_type(*tmp_str.get_str()); - tmp_str.mem_calc(); - str->append(tmp_str); - - if (str->reserve(SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - str->length(str->length() - SPIDER_SQL_COMMA_LEN); - - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_key_join_columns_for_bka( - const key_range *start_key, - spider_string *str, - const char **table_aliases, - uint *table_alias_lengths -) { - KEY *key_info = spider->result_list.key_info; - uint length, key_name_length, key_count; - key_part_map full_key_part_map = - make_prev_keypart_map(spider_user_defined_key_parts(key_info)); - key_part_map start_key_part_map; - KEY_PART_INFO *key_part; - Field *field; - char tmp_buf[MAX_FIELD_WIDTH]; - bool start_where = ((int) str->length() == where_pos); - DBUG_ENTER("spider_oracle_handler::append_key_join_columns_for_bka"); - DBUG_PRINT("info",("spider this=%p", this)); - start_key_part_map = start_key->keypart_map & full_key_part_map; - DBUG_PRINT("info", ("spider spider_user_defined_key_parts=%u", - spider_user_defined_key_parts(key_info))); - DBUG_PRINT("info", ("spider full_key_part_map=%lu", full_key_part_map)); - DBUG_PRINT("info", ("spider start_key_part_map=%lu", start_key_part_map)); - - if (!start_key_part_map) - DBUG_RETURN(0); - - if (start_where) - { - if (str->reserve(SPIDER_SQL_WHERE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN); - } else { - if (str->reserve(SPIDER_SQL_AND_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN); - } - - for ( - key_part = key_info->key_part, - key_count = 0; - start_key_part_map; - start_key_part_map >>= 1, - key_part++, - key_count++ - ) { - field = key_part->field; - key_name_length = - oracle_share->column_name_str[field->field_index].length(); - length = my_sprintf(tmp_buf, (tmp_buf, "c%u", key_count)); - if (str->reserve(length + table_alias_lengths[0] + key_name_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + - table_alias_lengths[1] + SPIDER_SQL_PF_EQUAL_LEN + SPIDER_SQL_AND_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(table_aliases[0], table_alias_lengths[0]); - str->q_append(tmp_buf, length); - str->q_append(SPIDER_SQL_PF_EQUAL_STR, SPIDER_SQL_PF_EQUAL_LEN); - str->q_append(table_aliases[1], table_alias_lengths[1]); - oracle_share->append_column_name(str, field->field_index); - str->q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN); - } - str->length(str->length() - SPIDER_SQL_AND_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_tmp_table_and_sql_for_bka( - const key_range *start_key -) { - int error_num; - DBUG_ENTER("spider_oracle_handler::append_tmp_table_and_sql_for_bka"); - DBUG_PRINT("info",("spider this=%p", this)); - char tmp_table_name[MAX_FIELD_WIDTH * 2], - tgt_table_name[MAX_FIELD_WIDTH * 2]; - int tmp_table_name_length; - spider_string tgt_table_name_str(tgt_table_name, MAX_FIELD_WIDTH * 2, - oracle_share->db_names_str[0].charset()); - const char *table_names[2], *table_aliases[2], *table_dot_aliases[2]; - uint table_name_lengths[2], table_alias_lengths[2], - table_dot_alias_lengths[2]; - tgt_table_name_str.init_calc_mem(SPD_MID_ORACLE_HANDLER_APPEND_TMP_TABLE_AND_SQL_FOR_BKA_1); - tgt_table_name_str.length(0); - create_tmp_bka_table_name(tmp_table_name, &tmp_table_name_length, - first_link_idx); - if ((error_num = append_table_name_with_adjusting(&tgt_table_name_str, - first_link_idx, SPIDER_SQL_TYPE_SELECT_SQL))) - { - DBUG_RETURN(error_num); - } - table_names[0] = tmp_table_name; - table_names[1] = tgt_table_name_str.c_ptr_safe(); - table_name_lengths[0] = tmp_table_name_length; - table_name_lengths[1] = tgt_table_name_str.length(); - table_aliases[0] = SPIDER_SQL_A_STR; - table_aliases[1] = SPIDER_SQL_B_STR; - table_alias_lengths[0] = SPIDER_SQL_A_LEN; - table_alias_lengths[1] = SPIDER_SQL_B_LEN; - table_dot_aliases[0] = SPIDER_SQL_A_DOT_STR; - table_dot_aliases[1] = SPIDER_SQL_B_DOT_STR; - table_dot_alias_lengths[0] = SPIDER_SQL_A_DOT_LEN; - table_dot_alias_lengths[1] = SPIDER_SQL_B_DOT_LEN; - if ( - (error_num = append_drop_tmp_bka_table( - &tmp_sql, tmp_table_name, tmp_table_name_length, - &tmp_sql_pos1, &tmp_sql_pos5, TRUE)) || - (error_num = append_create_tmp_bka_table( - start_key, - &tmp_sql, tmp_table_name, - tmp_table_name_length, - &tmp_sql_pos2, spider->share->table_share->table_charset)) || - (error_num = append_insert_tmp_bka_table( - start_key, - &tmp_sql, tmp_table_name, - tmp_table_name_length, &tmp_sql_pos3)) - ) - DBUG_RETURN(error_num); - tmp_sql_pos4 = tmp_sql.length(); - if ((error_num = spider_db_append_select(spider))) - DBUG_RETURN(error_num); - if (sql.reserve(SPIDER_SQL_A_DOT_LEN + SPIDER_SQL_ID_LEN + - SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql.q_append(SPIDER_SQL_A_DOT_STR, SPIDER_SQL_A_DOT_LEN); - sql.q_append(SPIDER_SQL_ID_STR, SPIDER_SQL_ID_LEN); - sql.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - if ( - (error_num = append_select_columns_with_alias(&sql, - SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN)) || - (error_num = spider_db_oracle_utility.append_from_with_alias(&sql, - table_names, table_name_lengths, - table_aliases, table_alias_lengths, 2, - &table_name_pos, FALSE)) - ) - DBUG_RETURN(error_num); - if ( - oracle_share->key_hint && - (error_num = spider_db_append_hint_after_table(spider, - &sql, &oracle_share->key_hint[spider->active_index])) - ) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - where_pos = sql.length(); - if ( - (error_num = append_key_join_columns_for_bka( - start_key, &sql, - table_dot_aliases, table_dot_alias_lengths)) || - (error_num = append_condition_part( - SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN, - SPIDER_SQL_TYPE_SELECT_SQL, FALSE)) - ) - DBUG_RETURN(error_num); - if (spider->result_list.direct_order_limit) - { - if ((error_num = append_key_order_for_direct_order_limit_with_alias(&sql, - SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN))) - DBUG_RETURN(error_num); - } - else if (spider->result_list.direct_aggregate) - { - if ((error_num = - append_group_by(&sql, SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN))) - DBUG_RETURN(error_num); - } - - DBUG_RETURN(0); -} - -int spider_oracle_handler::reuse_tmp_table_and_sql_for_bka() -{ - DBUG_ENTER("spider_oracle_handler::reuse_tmp_table_and_sql_for_bka"); - DBUG_PRINT("info",("spider this=%p", this)); - tmp_sql.length(tmp_sql_pos4); - sql.length(limit_pos); - ha_sql.length(ha_limit_pos); - DBUG_RETURN(0); -} - -void spider_oracle_handler::create_tmp_bka_table_name( - char *tmp_table_name, - int *tmp_table_name_length, - int link_idx -) { - uint adjust_length, length; - DBUG_ENTER("spider_oracle_handler::create_tmp_bka_table_name"); - if (spider_param_bka_table_name_type(current_thd, - oracle_share->spider_share-> - bka_table_name_types[spider->conn_link_idx[link_idx]]) == 1) - { - adjust_length = - oracle_share->db_nm_max_length - - oracle_share->db_names_str[spider->conn_link_idx[link_idx]].length() + - oracle_share->table_nm_max_length - - oracle_share->table_names_str[spider->conn_link_idx[link_idx]].length(); - *tmp_table_name_length = oracle_share->db_nm_max_length + - oracle_share->table_nm_max_length; - memset(tmp_table_name, ' ', adjust_length); - tmp_table_name += adjust_length; - memcpy(tmp_table_name, oracle_share->db_names_str[link_idx].c_ptr(), - oracle_share->db_names_str[link_idx].length()); - tmp_table_name += oracle_share->db_names_str[link_idx].length(); - length = my_sprintf(tmp_table_name, (tmp_table_name, - "%s%s%p%s", SPIDER_SQL_DOT_STR, SPIDER_SQL_TMP_BKA_STR, spider, - SPIDER_SQL_UNDERSCORE_STR)); - *tmp_table_name_length += length; - tmp_table_name += length; - memcpy(tmp_table_name, - oracle_share->table_names_str[spider->conn_link_idx[link_idx]].c_ptr(), - oracle_share->table_names_str[spider->conn_link_idx[link_idx]].length()); - } else { - adjust_length = - oracle_share->db_nm_max_length - - oracle_share->db_names_str[spider->conn_link_idx[link_idx]].length(); - *tmp_table_name_length = oracle_share->db_nm_max_length; - memset(tmp_table_name, ' ', adjust_length); - tmp_table_name += adjust_length; - memcpy(tmp_table_name, oracle_share->db_names_str[link_idx].c_ptr(), - oracle_share->db_names_str[link_idx].length()); - tmp_table_name += oracle_share->db_names_str[link_idx].length(); - length = my_sprintf(tmp_table_name, (tmp_table_name, - "%s%s%p", SPIDER_SQL_DOT_STR, SPIDER_SQL_TMP_BKA_STR, spider)); - *tmp_table_name_length += length; - } - DBUG_VOID_RETURN; -} - -int spider_oracle_handler::append_create_tmp_bka_table( - const key_range *start_key, - spider_string *str, - char *tmp_table_name, - int tmp_table_name_length, - int *db_name_pos, - CHARSET_INFO *table_charset -) { - int error_num; - SPIDER_SHARE *share = spider->share; - THD *thd = spider->wide_handler->trx->thd; - char *bka_engine = spider_param_bka_engine(thd, share->bka_engine); - uint bka_engine_length = strlen(bka_engine), - cset_length = strlen(table_charset->csname); - DBUG_ENTER("spider_oracle_handler::append_create_tmp_bka_table"); - if (str->reserve(SPIDER_SQL_CREATE_TMP_LEN + tmp_table_name_length + - SPIDER_SQL_OPEN_PAREN_LEN + SPIDER_SQL_ID_LEN + SPIDER_SQL_ID_TYPE_LEN + - SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_CREATE_TMP_STR, SPIDER_SQL_CREATE_TMP_LEN); - *db_name_pos = str->length(); - str->q_append(tmp_table_name, tmp_table_name_length); - str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN); - str->q_append(SPIDER_SQL_ID_STR, SPIDER_SQL_ID_LEN); - str->q_append(SPIDER_SQL_ID_TYPE_STR, SPIDER_SQL_ID_TYPE_LEN); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - if ((error_num = append_key_column_types(start_key, str))) - DBUG_RETURN(error_num); - if (str->reserve(SPIDER_SQL_ENGINE_LEN + bka_engine_length + - SPIDER_SQL_DEF_CHARSET_LEN + cset_length + SPIDER_SQL_SEMICOLON_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_ENGINE_STR, SPIDER_SQL_ENGINE_LEN); - str->q_append(bka_engine, bka_engine_length); - str->q_append(SPIDER_SQL_DEF_CHARSET_STR, SPIDER_SQL_DEF_CHARSET_LEN); - str->q_append(table_charset->csname, cset_length); - str->q_append(SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_drop_tmp_bka_table( - spider_string *str, - char *tmp_table_name, - int tmp_table_name_length, - int *db_name_pos, - int *drop_table_end_pos, - bool with_semicolon -) { - DBUG_ENTER("spider_oracle_handler::append_drop_tmp_bka_table"); - if (str->reserve(SPIDER_SQL_DROP_TMP_LEN + tmp_table_name_length + - (with_semicolon ? SPIDER_SQL_SEMICOLON_LEN : 0))) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_DROP_TMP_STR, SPIDER_SQL_DROP_TMP_LEN); - *db_name_pos = str->length(); - str->q_append(tmp_table_name, tmp_table_name_length); - *drop_table_end_pos = str->length(); - if (with_semicolon) - str->q_append(SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_insert_tmp_bka_table( - const key_range *start_key, - spider_string *str, - char *tmp_table_name, - int tmp_table_name_length, - int *db_name_pos -) { - int error_num; - DBUG_ENTER("spider_oracle_handler::append_insert_tmp_bka_table"); - if (str->reserve(SPIDER_SQL_INSERT_LEN + SPIDER_SQL_INTO_LEN + - tmp_table_name_length + SPIDER_SQL_OPEN_PAREN_LEN + SPIDER_SQL_ID_LEN + - SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_INSERT_STR, SPIDER_SQL_INSERT_LEN); - str->q_append(SPIDER_SQL_INTO_STR, SPIDER_SQL_INTO_LEN); - *db_name_pos = str->length(); - str->q_append(tmp_table_name, tmp_table_name_length); - str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN); - str->q_append(SPIDER_SQL_ID_STR, SPIDER_SQL_ID_LEN); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - if ((error_num = spider_db_append_key_columns(start_key, spider, str))) - DBUG_RETURN(error_num); - if (str->reserve(SPIDER_SQL_CLOSE_PAREN_LEN + SPIDER_SQL_VALUES_LEN + - SPIDER_SQL_OPEN_PAREN_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN); - str->q_append(SPIDER_SQL_VALUES_STR, SPIDER_SQL_VALUES_LEN); - str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_union_table_and_sql_for_bka( - const key_range *start_key -) { - int error_num; - DBUG_ENTER("spider_oracle_handler::append_union_table_and_sql_for_bka"); - DBUG_PRINT("info",("spider this=%p", this)); - char tgt_table_name[MAX_FIELD_WIDTH * 2]; - spider_string tgt_table_name_str(tgt_table_name, MAX_FIELD_WIDTH * 2, - oracle_share->db_names_str[0].charset()); - const char *table_names[2], *table_aliases[2], *table_dot_aliases[2]; - uint table_name_lengths[2], table_alias_lengths[2], - table_dot_alias_lengths[2]; - tgt_table_name_str.init_calc_mem(SPD_MID_ORACLE_HANDLER_APPEND_UNION_TABLE_AND_SQL_FOR_BKA_1); - tgt_table_name_str.length(0); - if ((error_num = append_table_name_with_adjusting(&tgt_table_name_str, - first_link_idx, SPIDER_SQL_TYPE_SELECT_SQL))) - { - DBUG_RETURN(error_num); - } - table_names[0] = ""; - table_names[1] = tgt_table_name_str.c_ptr_safe(); - table_name_lengths[0] = 0; - table_name_lengths[1] = tgt_table_name_str.length(); - table_aliases[0] = SPIDER_SQL_A_STR; - table_aliases[1] = SPIDER_SQL_B_STR; - table_alias_lengths[0] = SPIDER_SQL_A_LEN; - table_alias_lengths[1] = SPIDER_SQL_B_LEN; - table_dot_aliases[0] = SPIDER_SQL_A_DOT_STR; - table_dot_aliases[1] = SPIDER_SQL_B_DOT_STR; - table_dot_alias_lengths[0] = SPIDER_SQL_A_DOT_LEN; - table_dot_alias_lengths[1] = SPIDER_SQL_B_DOT_LEN; - - if ((error_num = spider_db_append_select(spider))) - DBUG_RETURN(error_num); - if (sql.reserve(SPIDER_SQL_A_DOT_LEN + SPIDER_SQL_ID_LEN + - SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql.q_append(SPIDER_SQL_A_DOT_STR, SPIDER_SQL_A_DOT_LEN); - sql.q_append(SPIDER_SQL_ID_STR, SPIDER_SQL_ID_LEN); - sql.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - if ((error_num = append_select_columns_with_alias(&sql, - SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN))) - DBUG_RETURN(error_num); - if (sql.reserve(SPIDER_SQL_FROM_LEN + (SPIDER_SQL_OPEN_PAREN_LEN * 2))) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql.q_append(SPIDER_SQL_FROM_STR, SPIDER_SQL_FROM_LEN); - sql.q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN); - sql.q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN); - tmp_sql_pos1 = sql.length(); - - if ( - (error_num = spider_db_oracle_utility.append_from_with_alias(&tmp_sql, - table_names, table_name_lengths, - table_aliases, table_alias_lengths, 2, - &table_name_pos, FALSE)) - ) - DBUG_RETURN(error_num); - if ( - oracle_share->key_hint && - (error_num = spider_db_append_hint_after_table(spider, - &tmp_sql, &oracle_share->key_hint[spider->active_index])) - ) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - where_pos = tmp_sql.length(); - if ( - (error_num = append_key_join_columns_for_bka( - start_key, &tmp_sql, - table_dot_aliases, table_dot_alias_lengths)) || - (error_num = append_condition_part( - SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN, - SPIDER_SQL_TYPE_TMP_SQL, FALSE)) - ) - DBUG_RETURN(error_num); - if (spider->result_list.direct_order_limit) - { - if ((error_num = append_key_order_for_direct_order_limit_with_alias( - &tmp_sql, SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN))) - DBUG_RETURN(error_num); - } - else if (spider->result_list.direct_aggregate) - { - if ((error_num = - append_group_by(&tmp_sql, SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN))) - DBUG_RETURN(error_num); - } - - DBUG_RETURN(0); -} - -int spider_oracle_handler::reuse_union_table_and_sql_for_bka() -{ - DBUG_ENTER("spider_oracle_handler::reuse_union_table_and_sql_for_bka"); - DBUG_PRINT("info",("spider this=%p", this)); - sql.length(tmp_sql_pos1); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_insert_for_recovery( - ulong sql_type, - int link_idx -) { - const TABLE *table = spider->get_table(); - SPIDER_SHARE *share = spider->share; - Field **field; - uint field_name_length = 0; - bool add_value = FALSE; - spider_string *insert_sql; - DBUG_ENTER("spider_oracle_handler::append_insert_for_recovery"); - DBUG_PRINT("info",("spider this=%p", this)); - if (sql_type == SPIDER_SQL_TYPE_INSERT_SQL) - { - insert_sql = &spider->result_list.insert_sqls[link_idx]; - insert_sql->length(0); - } else { - insert_sql = &spider->result_list.update_sqls[link_idx]; - } - if (insert_sql->reserve( - SPIDER_SQL_INSERT_LEN + SPIDER_SQL_SQL_IGNORE_LEN + - SPIDER_SQL_INTO_LEN + oracle_share->db_nm_max_length + - SPIDER_SQL_DOT_LEN + oracle_share->table_nm_max_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 4 + SPIDER_SQL_OPEN_PAREN_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - insert_sql->q_append(SPIDER_SQL_INSERT_STR, SPIDER_SQL_INSERT_LEN); - insert_sql->q_append(SPIDER_SQL_SQL_IGNORE_STR, SPIDER_SQL_SQL_IGNORE_LEN); - insert_sql->q_append(SPIDER_SQL_INTO_STR, SPIDER_SQL_INTO_LEN); - oracle_share->append_table_name(insert_sql, spider->conn_link_idx[link_idx]); - insert_sql->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN); - for (field = table->field; *field; field++) - { - field_name_length = - oracle_share->column_name_str[(*field)->field_index].length(); - if (insert_sql->reserve(field_name_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - oracle_share->append_column_name(insert_sql, (*field)->field_index); - insert_sql->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - if (field_name_length) - insert_sql->length(insert_sql->length() - SPIDER_SQL_COMMA_LEN); - if (insert_sql->reserve(SPIDER_SQL_CLOSE_PAREN_LEN + SPIDER_SQL_VALUES_LEN + - SPIDER_SQL_OPEN_PAREN_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - insert_sql->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN); - insert_sql->q_append(SPIDER_SQL_VALUES_STR, SPIDER_SQL_VALUES_LEN); - insert_sql->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN); - for (field = table->field; *field; field++) - { - add_value = TRUE; - if ((*field)->is_null()) - { - if (insert_sql->reserve(SPIDER_SQL_NULL_LEN + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - insert_sql->q_append(SPIDER_SQL_NULL_STR, SPIDER_SQL_NULL_LEN); - } else { - if ( - spider_db_oracle_utility. - append_column_value(spider, insert_sql, *field, NULL, - share->access_charset) || - insert_sql->reserve(SPIDER_SQL_COMMA_LEN) - ) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - insert_sql->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - if (add_value) - insert_sql->length(insert_sql->length() - SPIDER_SQL_COMMA_LEN); - if (insert_sql->reserve(SPIDER_SQL_CLOSE_PAREN_LEN, SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - insert_sql->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN); - if (sql_type == SPIDER_SQL_TYPE_INSERT_SQL) - { - exec_insert_sql = insert_sql; - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_update( - const TABLE *table, - my_ptrdiff_t ptr_diff -) { - int error_num; - spider_string *str = &update_sql; - DBUG_ENTER("spider_oracle_handler::append_update"); - DBUG_PRINT("info",("spider this=%p", this)); - if (str->length() > 0) - { - if (str->reserve(SPIDER_SQL_SEMICOLON_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN); - } - - if ( - (error_num = append_update(str, 0)) || - (error_num = append_update_set(str)) || - (error_num = append_update_where(str, table, ptr_diff)) - ) - DBUG_RETURN(error_num); - filled_up = (str->length() >= (uint) spider->result_list.bulk_update_size); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_update( - const TABLE *table, - my_ptrdiff_t ptr_diff, - int link_idx -) { - int error_num; - SPIDER_SHARE *share = spider->share; - spider_string *str = &spider->result_list.update_sqls[link_idx]; - DBUG_ENTER("spider_oracle_handler::append_update"); - DBUG_PRINT("info",("spider this=%p", this)); - if (str->length() > 0) - { - if (str->reserve(SPIDER_SQL_SEMICOLON_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN); - } - - if ( - (error_num = append_update(str, link_idx)) || - (error_num = append_update_set(str)) || - (error_num = append_update_where(str, table, ptr_diff)) - ) - DBUG_RETURN(error_num); - - if ( - spider->pk_update && - share->link_statuses[link_idx] == SPIDER_LINK_STATUS_RECOVERY - ) { - if (str->reserve(SPIDER_SQL_SEMICOLON_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN); - if ((error_num = append_insert_for_recovery( - SPIDER_SQL_TYPE_UPDATE_SQL, link_idx))) - DBUG_RETURN(error_num); - } - - if (!filled_up) - filled_up = (str->length() >= (uint) spider->result_list.bulk_update_size); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_delete( - const TABLE *table, - my_ptrdiff_t ptr_diff -) { - int error_num; - spider_string *str = &update_sql; - DBUG_ENTER("spider_oracle_handler::append_delete"); - DBUG_PRINT("info",("spider this=%p", this)); - if (str->length() > 0) - { - if (str->reserve(SPIDER_SQL_SEMICOLON_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN); - } - - if ( - (error_num = append_delete(str)) || - (error_num = append_from(str, SPIDER_SQL_TYPE_DELETE_SQL, - first_link_idx)) || - (error_num = append_update_where(str, table, ptr_diff)) - ) - DBUG_RETURN(error_num); - filled_up = (str->length() >= (uint) spider->result_list.bulk_update_size); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_delete( - const TABLE *table, - my_ptrdiff_t ptr_diff, - int link_idx -) { - int error_num; - spider_string *str = &spider->result_list.update_sqls[link_idx]; - DBUG_ENTER("spider_oracle_handler::append_delete"); - DBUG_PRINT("info",("spider this=%p", this)); - if (str->length() > 0) - { - if (str->reserve(SPIDER_SQL_SEMICOLON_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN); - } - - if ( - (error_num = append_delete(str)) || - (error_num = append_from(str, SPIDER_SQL_TYPE_DELETE_SQL, link_idx)) || - (error_num = append_update_where(str, table, ptr_diff)) - ) - DBUG_RETURN(error_num); - if (!filled_up) - filled_up = (str->length() >= (uint) spider->result_list.bulk_update_size); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_insert_part() -{ - int error_num; - DBUG_ENTER("spider_oracle_handler::append_insert_part"); - DBUG_PRINT("info",("spider this=%p", this)); - error_num = append_insert(&insert_sql, 0); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_insert( - spider_string *str, - int link_idx -) { - DBUG_ENTER("spider_oracle_handler::append_insert"); - if (str->reserve(SPIDER_SQL_INSERT_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_INSERT_STR, SPIDER_SQL_INSERT_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_update_part() -{ - int error_num; - DBUG_ENTER("spider_oracle_handler::append_update_part"); - DBUG_PRINT("info",("spider this=%p", this)); - error_num = append_update(&update_sql, 0); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_update( - spider_string *str, - int link_idx -) { - DBUG_ENTER("spider_oracle_handler::append_update"); - if (str->reserve(SPIDER_SQL_UPDATE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_UPDATE_STR, SPIDER_SQL_UPDATE_LEN); - if (str->reserve(oracle_share->db_nm_max_length + - SPIDER_SQL_DOT_LEN + oracle_share->table_nm_max_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 4)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - table_name_pos = str->length(); - append_table_name_with_adjusting(str, link_idx, SPIDER_SQL_TYPE_UPDATE_SQL); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_delete_part() -{ - int error_num; - DBUG_ENTER("spider_oracle_handler::append_delete_part"); - DBUG_PRINT("info",("spider this=%p", this)); - error_num = append_delete(&update_sql); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_delete( - spider_string *str -) { - DBUG_ENTER("spider_oracle_handler::append_delete"); - if (str->reserve(SPIDER_SQL_DELETE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_DELETE_STR, SPIDER_SQL_DELETE_LEN); - str->length(str->length() - 1); - DBUG_RETURN(0); -} - - -int spider_oracle_handler::append_update_set_part() -{ - int error_num; - DBUG_ENTER("spider_oracle_handler::append_update_set_part"); - DBUG_PRINT("info",("spider this=%p", this)); - update_set_pos = update_sql.length(); - error_num = append_update_set(&update_sql); - where_pos = update_sql.length(); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_update_set( - spider_string *str -) { - uint field_name_length; - SPIDER_SHARE *share = spider->share; - TABLE *table = spider->get_table(); - Field **fields; - DBUG_ENTER("spider_oracle_handler::append_update_set"); - if (str->reserve(SPIDER_SQL_SET_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_SET_STR, SPIDER_SQL_SET_LEN); - for (fields = table->field; *fields; fields++) - { - if (bitmap_is_set(table->write_set, (*fields)->field_index)) - { - field_name_length = - oracle_share->column_name_str[(*fields)->field_index].length(); - if ((*fields)->is_null()) - { - if (str->reserve(field_name_length + /* SPIDER_SQL_NAME_QUOTE_LEN */ - 2 + SPIDER_SQL_EQUAL_LEN + SPIDER_SQL_NULL_LEN + - SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - oracle_share->append_column_name(str, (*fields)->field_index); - str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN); - str->q_append(SPIDER_SQL_NULL_STR, SPIDER_SQL_NULL_LEN); - } else { - if (str->reserve(field_name_length + /* SPIDER_SQL_NAME_QUOTE_LEN */ - 2 + SPIDER_SQL_EQUAL_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - oracle_share->append_column_name(str, (*fields)->field_index); - str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN); -#ifndef DBUG_OFF - my_bitmap_map *tmp_map = dbug_tmp_use_all_columns(table, - table->read_set); -#endif - if ( - spider_db_oracle_utility. - append_column_value(spider, str, *fields, NULL, - share->access_charset) || - str->reserve(SPIDER_SQL_COMMA_LEN) - ) { -#ifndef DBUG_OFF - dbug_tmp_restore_column_map(table->read_set, tmp_map); -#endif - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } -#ifndef DBUG_OFF - dbug_tmp_restore_column_map(table->read_set, tmp_map); -#endif - } - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - } - str->length(str->length() - SPIDER_SQL_COMMA_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_direct_update_set_part() -{ - int error_num; - DBUG_ENTER("spider_oracle_handler::append_direct_update_set_part"); - DBUG_PRINT("info",("spider this=%p", this)); - update_set_pos = update_sql.length(); - error_num = append_direct_update_set(&update_sql); - where_pos = update_sql.length(); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_direct_update_set( - spider_string *str -) { - DBUG_ENTER("spider_oracle_handler::append_direct_update_set"); - if ( - spider->direct_update_kinds == SPIDER_SQL_KIND_SQL && - spider->wide_handler->direct_update_fields - ) { - if (str->reserve(SPIDER_SQL_SET_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_SET_STR, SPIDER_SQL_SET_LEN); - DBUG_RETURN(append_update_columns(str, NULL, 0)); - } - - if ( - (spider->direct_update_kinds & SPIDER_SQL_KIND_SQL) - ) { - DBUG_ASSERT(0); - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_dup_update_pushdown_part( - const char *alias, - uint alias_length -) { - int error_num; - DBUG_ENTER("spider_oracle_handler::append_dup_update_pushdown_part"); - DBUG_PRINT("info",("spider this=%p", this)); - dup_update_sql.length(0); - error_num = append_update_columns(&dup_update_sql, alias, alias_length); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_update_columns_part( - const char *alias, - uint alias_length -) { - int error_num; - DBUG_ENTER("spider_oracle_handler::append_update_columns_part"); - DBUG_PRINT("info",("spider this=%p", this)); - error_num = append_update_columns(&update_sql, alias, alias_length); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::check_update_columns_part() -{ - int error_num; - DBUG_ENTER("spider_oracle_handler::check_update_columns_part"); - DBUG_PRINT("info",("spider this=%p", this)); - error_num = append_update_columns(NULL, NULL, 0); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_update_columns( - spider_string *str, - const char *alias, - uint alias_length -) { - int error_num; - List_iterator_fast fi(*spider->wide_handler->direct_update_fields), - vi(*spider->wide_handler->direct_update_values); - Item *field, *value; - DBUG_ENTER("spider_oracle_handler::append_update_columns"); - while ((field = fi++)) - { - value = vi++; - if ((error_num = spider_db_print_item_type( - (Item *) field, NULL, spider, str, alias, alias_length, - spider_dbton_oracle.dbton_id, FALSE, NULL))) - { - if ( - error_num == ER_SPIDER_COND_SKIP_NUM && - field->type() == Item::FIELD_ITEM && - ((Item_field *) field)->field - ) - continue; - DBUG_RETURN(error_num); - } - if (str) - { - if (str->reserve(SPIDER_SQL_EQUAL_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN); - } - if ((error_num = spider_db_print_item_type( - (Item *) value, ((Item_field *) field)->field, spider, str, - alias, alias_length, spider_dbton_oracle.dbton_id, FALSE, NULL))) - DBUG_RETURN(error_num); - if (str) - { - if (str->reserve(SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - } - if (str) - str->length(str->length() - SPIDER_SQL_COMMA_LEN); - DBUG_RETURN(0); -/* - error_num = spider_db_append_update_columns(spider, str, - alias, alias_length, spider_dbton_oracle.dbton_id); - DBUG_RETURN(error_num); -*/ -} - -int spider_oracle_handler::append_select_part( - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_select_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - break; - case SPIDER_SQL_TYPE_HANDLER: - str = &ha_sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_select(str, sql_type); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_select( - spider_string *str, - ulong sql_type -) { - DBUG_ENTER("spider_oracle_handler::append_select"); - if (sql_type == SPIDER_SQL_TYPE_HANDLER) - { - if (str->reserve(SPIDER_SQL_HANDLER_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_HANDLER_STR, SPIDER_SQL_HANDLER_LEN); - } else { - if (str->reserve(SPIDER_SQL_SELECT_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_SELECT_STR, SPIDER_SQL_SELECT_LEN); - if (spider->result_list.direct_distinct) - { - if (str->reserve(SPIDER_SQL_DISTINCT_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_DISTINCT_STR, SPIDER_SQL_DISTINCT_LEN); - } - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_table_select_part( - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_table_select_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_table_select(str); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_table_select( - spider_string *str -) { - DBUG_ENTER("spider_oracle_handler::append_table_select"); - table_name_pos = str->length() + oracle_share->table_select_pos; - if (str->append(*(oracle_share->table_select))) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_key_select_part( - ulong sql_type, - uint idx -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_key_select_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_key_select(str, idx); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_key_select( - spider_string *str, - uint idx -) { - DBUG_ENTER("spider_oracle_handler::append_key_select"); - table_name_pos = str->length() + oracle_share->key_select_pos[idx]; - if (str->append(oracle_share->key_select[idx])) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_minimum_select_part( - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_minimum_select_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_minimum_select(str, sql_type); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_minimum_select( - spider_string *str, - ulong sql_type -) { - TABLE *table = spider->get_table(); - Field **field; - int field_length; - bool appended = FALSE; - DBUG_ENTER("spider_oracle_handler::append_minimum_select"); - minimum_select_bitmap_create(); - for (field = table->field; *field; field++) - { - if (minimum_select_bit_is_set((*field)->field_index)) - { -/* - spider_set_bit(minimum_select_bitmap, (*field)->field_index); -*/ - field_length = - oracle_share->column_name_str[(*field)->field_index].length(); - if (str->reserve(field_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - oracle_share->append_column_name(str, (*field)->field_index); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - appended = TRUE; - } - } - if (appended) - str->length(str->length() - SPIDER_SQL_COMMA_LEN); - else { - if (str->reserve(SPIDER_SQL_ONE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_ONE_STR, SPIDER_SQL_ONE_LEN); - } - DBUG_RETURN(append_from(str, sql_type, first_link_idx)); -} - -int spider_oracle_handler::append_table_select_with_alias( - spider_string *str, - const char *alias, - uint alias_length -) { - TABLE *table = spider->get_table(); - Field **field; - int field_length; - DBUG_ENTER("spider_oracle_handler::append_table_select_with_alias"); - for (field = table->field; *field; field++) - { - field_length = - oracle_share->column_name_str[(*field)->field_index].length(); - if (str->reserve(alias_length + field_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(alias, alias_length); - oracle_share->append_column_name(str, (*field)->field_index); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - str->length(str->length() - SPIDER_SQL_COMMA_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_key_select_with_alias( - spider_string *str, - const KEY *key_info, - const char *alias, - uint alias_length -) { - KEY_PART_INFO *key_part; - Field *field; - uint part_num; - int field_length; - DBUG_ENTER("spider_oracle_handler::append_key_select_with_alias"); - for (key_part = key_info->key_part, part_num = 0; - part_num < spider_user_defined_key_parts(key_info); key_part++, part_num++) - { - field = key_part->field; - field_length = oracle_share->column_name_str[field->field_index].length(); - if (str->reserve(alias_length + field_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(alias, alias_length); - oracle_share->append_column_name(str, field->field_index); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - str->length(str->length() - SPIDER_SQL_COMMA_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_minimum_select_with_alias( - spider_string *str, - const char *alias, - uint alias_length -) { - TABLE *table = spider->get_table(); - Field **field; - int field_length; - bool appended = FALSE; - DBUG_ENTER("spider_oracle_handler::append_minimum_select_with_alias"); - minimum_select_bitmap_create(); - for (field = table->field; *field; field++) - { - if (minimum_select_bit_is_set((*field)->field_index)) - { -/* - spider_set_bit(minimum_select_bitmap, (*field)->field_index); -*/ - field_length = - oracle_share->column_name_str[(*field)->field_index].length(); - if (str->reserve(alias_length + field_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(alias, alias_length); - oracle_share->append_column_name(str, (*field)->field_index); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - appended = TRUE; - } - } - if (appended) - str->length(str->length() - SPIDER_SQL_COMMA_LEN); - else { - if (str->reserve(SPIDER_SQL_ONE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_ONE_STR, SPIDER_SQL_ONE_LEN); - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_select_columns_with_alias( - spider_string *str, - const char *alias, - uint alias_length -) { - int error_num; - SPIDER_RESULT_LIST *result_list = &spider->result_list; - DBUG_ENTER("spider_oracle_handler::append_select_columns_with_alias"); - if ( - result_list->direct_aggregate && - (error_num = append_sum_select(str, alias, alias_length)) - ) - DBUG_RETURN(error_num); - if ((error_num = append_match_select(str, alias, alias_length))) - DBUG_RETURN(error_num); - if (!spider->select_column_mode) - { - if (result_list->keyread) - DBUG_RETURN(append_key_select_with_alias( - str, result_list->key_info, alias, alias_length)); - else - DBUG_RETURN(append_table_select_with_alias( - str, alias, alias_length)); - } - DBUG_RETURN(append_minimum_select_with_alias(str, alias, alias_length)); -} - -int spider_oracle_handler::append_hint_after_table_part( - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_hint_after_table_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - case SPIDER_SQL_TYPE_TMP_SQL: - str = &sql; - break; - case SPIDER_SQL_TYPE_INSERT_SQL: - case SPIDER_SQL_TYPE_UPDATE_SQL: - case SPIDER_SQL_TYPE_DELETE_SQL: - case SPIDER_SQL_TYPE_BULK_UPDATE_SQL: - str = &update_sql; - break; - case SPIDER_SQL_TYPE_HANDLER: - str = &ha_sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_hint_after_table(str); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_hint_after_table( - spider_string *str -) { - int error_num; - DBUG_ENTER("spider_oracle_handler::append_hint_after_table"); - DBUG_PRINT("info",("spider this=%p", this)); - if ( - oracle_share->key_hint && - (error_num = spider_db_append_hint_after_table(spider, - str, &oracle_share->key_hint[spider->active_index])) - ) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - DBUG_RETURN(0); -} - -void spider_oracle_handler::set_where_pos( - ulong sql_type -) { - DBUG_ENTER("spider_oracle_handler::set_where_pos"); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - case SPIDER_SQL_TYPE_TMP_SQL: - where_pos = sql.length(); - break; - case SPIDER_SQL_TYPE_INSERT_SQL: - case SPIDER_SQL_TYPE_UPDATE_SQL: - case SPIDER_SQL_TYPE_DELETE_SQL: - case SPIDER_SQL_TYPE_BULK_UPDATE_SQL: - where_pos = update_sql.length(); - break; - case SPIDER_SQL_TYPE_HANDLER: - ha_read_pos = ha_sql.length(); - break; - default: - break; - } - DBUG_VOID_RETURN; -} - -void spider_oracle_handler::set_where_to_pos( - ulong sql_type -) { - DBUG_ENTER("spider_oracle_handler::set_where_to_pos"); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - case SPIDER_SQL_TYPE_TMP_SQL: - sql.length(where_pos); - break; - case SPIDER_SQL_TYPE_INSERT_SQL: - case SPIDER_SQL_TYPE_UPDATE_SQL: - case SPIDER_SQL_TYPE_DELETE_SQL: - case SPIDER_SQL_TYPE_BULK_UPDATE_SQL: - update_sql.length(where_pos); - break; - case SPIDER_SQL_TYPE_HANDLER: - ha_sql.length(ha_read_pos); - break; - default: - break; - } - DBUG_VOID_RETURN; -} - -int spider_oracle_handler::check_item_type( - Item *item -) { - int error_num; - DBUG_ENTER("spider_oracle_handler::check_item_type"); - DBUG_PRINT("info",("spider this=%p", this)); - error_num = spider_db_print_item_type(item, NULL, spider, NULL, NULL, 0, - spider_dbton_oracle.dbton_id, FALSE, NULL); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_values_connector_part( - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_values_connector_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - break; - case SPIDER_SQL_TYPE_TMP_SQL: - str = &tmp_sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_values_connector(str); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_values_connector( - spider_string *str -) { - DBUG_ENTER("spider_oracle_handler::append_values_connector"); - DBUG_PRINT("info",("spider this=%p", this)); - if (str->reserve(SPIDER_SQL_CLOSE_PAREN_LEN + - SPIDER_SQL_COMMA_LEN + SPIDER_SQL_OPEN_PAREN_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_values_terminator_part( - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_values_terminator_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - break; - case SPIDER_SQL_TYPE_TMP_SQL: - str = &tmp_sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_values_terminator(str); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_values_terminator( - spider_string *str -) { - DBUG_ENTER("spider_oracle_handler::append_values_terminator"); - DBUG_PRINT("info",("spider this=%p", this)); - str->length(str->length() - - SPIDER_SQL_COMMA_LEN - SPIDER_SQL_OPEN_PAREN_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_union_table_connector_part( - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_union_table_connector_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - break; - case SPIDER_SQL_TYPE_TMP_SQL: - str = &tmp_sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_union_table_connector(str); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_union_table_connector( - spider_string *str -) { - DBUG_ENTER("spider_oracle_handler::append_union_table_connector"); - DBUG_PRINT("info",("spider this=%p", this)); - if (str->reserve((SPIDER_SQL_SPACE_LEN * 2) + SPIDER_SQL_UNION_ALL_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN); - str->q_append(SPIDER_SQL_UNION_ALL_STR, SPIDER_SQL_UNION_ALL_LEN); - str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_union_table_terminator_part( - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_union_table_terminator_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_union_table_terminator(str); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_union_table_terminator( - spider_string *str -) { - DBUG_ENTER("spider_oracle_handler::append_union_table_terminator"); - DBUG_PRINT("info",("spider this=%p", this)); - str->length(str->length() - - ((SPIDER_SQL_SPACE_LEN * 2) + SPIDER_SQL_UNION_ALL_LEN)); - str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN); - str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN); - table_name_pos = str->length() + SPIDER_SQL_SPACE_LEN + SPIDER_SQL_A_LEN + - SPIDER_SQL_COMMA_LEN; - if (str->reserve(tmp_sql.length() - SPIDER_SQL_FROM_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(tmp_sql.ptr() + SPIDER_SQL_FROM_LEN, - tmp_sql.length() - SPIDER_SQL_FROM_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_key_column_values_part( - const key_range *start_key, - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_key_column_values_part"); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - break; - case SPIDER_SQL_TYPE_TMP_SQL: - str = &tmp_sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_key_column_values(str, start_key); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_key_column_values( - spider_string *str, - const key_range *start_key -) { - int error_num; - const uchar *ptr; - SPIDER_RESULT_LIST *result_list = &spider->result_list; - SPIDER_SHARE *share = spider->share; - KEY *key_info = result_list->key_info; - uint length; - uint store_length; - key_part_map full_key_part_map = - make_prev_keypart_map(spider_user_defined_key_parts(key_info)); - key_part_map start_key_part_map; - KEY_PART_INFO *key_part; - Field *field; - DBUG_ENTER("spider_oracle_handler::append_key_column_values"); - start_key_part_map = start_key->keypart_map & full_key_part_map; - DBUG_PRINT("info", ("spider spider_user_defined_key_parts=%u", - spider_user_defined_key_parts(key_info))); - DBUG_PRINT("info", ("spider full_key_part_map=%lu", full_key_part_map)); - DBUG_PRINT("info", ("spider start_key_part_map=%lu", start_key_part_map)); - - if (!start_key_part_map) - DBUG_RETURN(0); - - for ( - key_part = key_info->key_part, - length = 0; - start_key_part_map; - start_key_part_map >>= 1, - key_part++, - length += store_length - ) { - store_length = key_part->store_length; - ptr = start_key->key + length; - field = key_part->field; - if ((error_num = spider_db_append_null_value(str, key_part, &ptr))) - { - if (error_num > 0) - DBUG_RETURN(error_num); - } else { - if (spider_db_oracle_utility.append_column_value(spider, str, field, ptr, - share->access_charset)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - - if (str->reserve(SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - str->length(str->length() - SPIDER_SQL_COMMA_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_key_column_values_with_name_part( - const key_range *start_key, - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_key_column_values_with_name_part"); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - break; - case SPIDER_SQL_TYPE_TMP_SQL: - str = &tmp_sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_key_column_values_with_name(str, start_key); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_key_column_values_with_name( - spider_string *str, - const key_range *start_key -) { - int error_num; - const uchar *ptr; - SPIDER_RESULT_LIST *result_list = &spider->result_list; - SPIDER_SHARE *share = spider->share; - KEY *key_info = result_list->key_info; - uint length; - uint key_name_length, key_count; - uint store_length; - key_part_map full_key_part_map = - make_prev_keypart_map(spider_user_defined_key_parts(key_info)); - key_part_map start_key_part_map; - KEY_PART_INFO *key_part; - Field *field; - char tmp_buf[MAX_FIELD_WIDTH]; - DBUG_ENTER("spider_oracle_handler::append_key_column_values_with_name"); - start_key_part_map = start_key->keypart_map & full_key_part_map; - DBUG_PRINT("info", ("spider spider_user_defined_key_parts=%u", - spider_user_defined_key_parts(key_info))); - DBUG_PRINT("info", ("spider full_key_part_map=%lu", full_key_part_map)); - DBUG_PRINT("info", ("spider start_key_part_map=%lu", start_key_part_map)); - - if (!start_key_part_map) - DBUG_RETURN(0); - - for ( - key_part = key_info->key_part, - length = 0, - key_count = 0; - start_key_part_map; - start_key_part_map >>= 1, - key_part++, - length += store_length, - key_count++ - ) { - store_length = key_part->store_length; - ptr = start_key->key + length; - field = key_part->field; - if ((error_num = spider_db_append_null_value(str, key_part, &ptr))) - { - if (error_num > 0) - DBUG_RETURN(error_num); - } else { - if (spider_db_oracle_utility.append_column_value(spider, str, field, ptr, - share->access_charset)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - - key_name_length = my_sprintf(tmp_buf, (tmp_buf, "c%u", key_count)); - if (str->reserve(SPIDER_SQL_SPACE_LEN + key_name_length + - SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN); - str->q_append(tmp_buf, key_name_length); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - str->length(str->length() - SPIDER_SQL_COMMA_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_key_where_part( - const key_range *start_key, - const key_range *end_key, - ulong sql_type -) { - int error_num; - spider_string *str, *str_part = NULL, *str_part2 = NULL; - bool set_order; - DBUG_ENTER("spider_oracle_handler::append_key_where_part"); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - set_order = FALSE; - break; - case SPIDER_SQL_TYPE_TMP_SQL: - str = &tmp_sql; - set_order = FALSE; - break; - case SPIDER_SQL_TYPE_INSERT_SQL: - case SPIDER_SQL_TYPE_UPDATE_SQL: - case SPIDER_SQL_TYPE_DELETE_SQL: - case SPIDER_SQL_TYPE_BULK_UPDATE_SQL: - str = &update_sql; - set_order = FALSE; - break; - case SPIDER_SQL_TYPE_HANDLER: - str = &ha_sql; - ha_read_pos = str->length(); - str_part = &sql_part; - str_part2 = &sql_part2; - str_part->length(0); - str_part2->length(0); - set_order = TRUE; - break; - default: - DBUG_RETURN(0); - } - error_num = append_key_where(str, str_part, str_part2, start_key, end_key, - sql_type, set_order); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_key_where( - spider_string *str, - spider_string *str_part, - spider_string *str_part2, - const key_range *start_key, - const key_range *end_key, - ulong sql_type, - bool set_order -) { - int error_num; - DBUG_ENTER("spider_oracle_handler::append_key_where"); - error_num = spider_db_append_key_where_internal(str, str_part, str_part2, - start_key, end_key, spider, set_order, sql_type, - spider_dbton_oracle.dbton_id); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_is_null_part( - ulong sql_type, - KEY_PART_INFO *key_part, - const key_range *key, - const uchar **ptr, - bool key_eq, - bool tgt_final -) { - int error_num; - spider_string *str, *str_part = NULL, *str_part2 = NULL; - DBUG_ENTER("spider_oracle_handler::append_is_null_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - case SPIDER_SQL_TYPE_TMP_SQL: - str = &sql; - break; - case SPIDER_SQL_TYPE_INSERT_SQL: - case SPIDER_SQL_TYPE_UPDATE_SQL: - case SPIDER_SQL_TYPE_DELETE_SQL: - case SPIDER_SQL_TYPE_BULK_UPDATE_SQL: - str = &update_sql; - break; - case SPIDER_SQL_TYPE_HANDLER: - str = &ha_sql; - str_part = &sql_part; - str_part2 = &sql_part2; - break; - default: - DBUG_RETURN(0); - } - error_num = append_is_null(sql_type, str, str_part, str_part2, - key_part, key, ptr, key_eq, tgt_final); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_is_null( - ulong sql_type, - spider_string *str, - spider_string *str_part, - spider_string *str_part2, - KEY_PART_INFO *key_part, - const key_range *key, - const uchar **ptr, - bool key_eq, - bool tgt_final -) { - DBUG_ENTER("spider_oracle_handler::append_is_null"); - DBUG_PRINT("info",("spider this=%p", this)); - if (key_part->null_bit) - { - if (*(*ptr)++) - { - if (sql_type == SPIDER_SQL_TYPE_HANDLER) - { - str = str_part; - if ( - key_eq || - key->flag == HA_READ_KEY_EXACT || - key->flag == HA_READ_KEY_OR_NEXT - ) { - if (str->reserve(SPIDER_SQL_IS_NULL_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_IS_NULL_STR, SPIDER_SQL_IS_NULL_LEN); - } else { - str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN); - ha_next_pos = str->length(); - if (str->reserve(SPIDER_SQL_FIRST_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_FIRST_STR, SPIDER_SQL_FIRST_LEN); - spider->result_list.ha_read_kind = 1; - } - str = str_part2; - } - if ( - key_eq || - key->flag == HA_READ_KEY_EXACT || - key->flag == HA_READ_KEY_OR_NEXT - ) { - if (str->reserve(SPIDER_SQL_IS_NULL_LEN + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + - oracle_share->column_name_str[key_part->field->field_index].length())) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - oracle_share->append_column_name(str, key_part->field->field_index); - str->q_append(SPIDER_SQL_IS_NULL_STR, SPIDER_SQL_IS_NULL_LEN); - } else { - if (str->reserve(SPIDER_SQL_IS_NOT_NULL_LEN + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + - oracle_share->column_name_str[key_part->field->field_index].length())) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - oracle_share->append_column_name(str, key_part->field->field_index); - str->q_append(SPIDER_SQL_IS_NOT_NULL_STR, SPIDER_SQL_IS_NOT_NULL_LEN); - } - DBUG_RETURN(-1); - } - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_where_terminator_part( - ulong sql_type, - bool set_order, - int key_count -) { - int error_num; - spider_string *str, *str_part = NULL, *str_part2 = NULL; - DBUG_ENTER("spider_oracle_handler::append_where_terminator_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - case SPIDER_SQL_TYPE_TMP_SQL: - str = &sql; - break; - case SPIDER_SQL_TYPE_INSERT_SQL: - case SPIDER_SQL_TYPE_UPDATE_SQL: - case SPIDER_SQL_TYPE_DELETE_SQL: - case SPIDER_SQL_TYPE_BULK_UPDATE_SQL: - str = &update_sql; - break; - case SPIDER_SQL_TYPE_HANDLER: - str = &ha_sql; - str_part = &sql_part; - str_part2 = &sql_part2; - break; - default: - DBUG_RETURN(0); - } - error_num = append_where_terminator(sql_type, str, str_part, str_part2, - set_order, key_count); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_where_terminator( - ulong sql_type, - spider_string *str, - spider_string *str_part, - spider_string *str_part2, - bool set_order, - int key_count -) { - SPIDER_RESULT_LIST *result_list = &spider->result_list; - DBUG_ENTER("spider_oracle_handler::append_where_terminator"); - DBUG_PRINT("info",("spider this=%p", this)); - if (sql_type != SPIDER_SQL_TYPE_HANDLER) - { - str->length(str->length() - SPIDER_SQL_AND_LEN); - if (!set_order) - result_list->key_order = key_count; - } else { - str_part2->length(str_part2->length() - SPIDER_SQL_AND_LEN); - - str_part->length(str_part->length() - SPIDER_SQL_COMMA_LEN); - if (!result_list->ha_read_kind) - str_part->q_append(SPIDER_SQL_CLOSE_PAREN_STR, - SPIDER_SQL_CLOSE_PAREN_LEN); - if (str->append(*str_part)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - uint clause_length = str->length() - ha_next_pos; - if (clause_length < SPIDER_SQL_NEXT_LEN) - { - int roop_count; - clause_length = SPIDER_SQL_NEXT_LEN - clause_length; - if (str->reserve(clause_length)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - for (roop_count = 0; roop_count < (int) clause_length; roop_count++) - str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN); - } - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_match_where_part( - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_match_where_part"); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - break; - default: - DBUG_ASSERT(0); - DBUG_RETURN(0); - } - error_num = append_match_where(str); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_match_where( - spider_string *str -) { - int error_num; - bool first = TRUE; - st_spider_ft_info *ft_info = spider->ft_first; - DBUG_ENTER("spider_oracle_handler::append_match_where"); - if (spider->ft_current) - { - while (TRUE) - { - if (ft_info->used_in_where) - { - if (first) - { - if (str->reserve(SPIDER_SQL_WHERE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN); - first = FALSE; - } - if ((error_num = append_match_against(str, ft_info, NULL, 0))) - DBUG_RETURN(error_num); - if (str->reserve(SPIDER_SQL_AND_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN); - } - - if (ft_info == spider->ft_current) - break; - ft_info = ft_info->next; - } - if (!first) - str->length(str->length() - SPIDER_SQL_AND_LEN); - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_update_where( - spider_string *str, - const TABLE *table, - my_ptrdiff_t ptr_diff -) { - uint field_name_length; - Field **field; - THD *thd = spider->wide_handler->trx->thd; - SPIDER_SHARE *share = spider->share; - bool no_pk = (table->s->primary_key == MAX_KEY); - DBUG_ENTER("spider_oracle_handler::append_update_where"); - uint str_len_bakup = str->length(); - if (str->reserve(SPIDER_SQL_WHERE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN); - if ( - no_pk || - spider_param_use_cond_other_than_pk_for_update(thd) - ) { - for (field = table->field; *field; field++) - { - if ( - no_pk || - bitmap_is_set(table->read_set, (*field)->field_index) - ) { - field_name_length = - oracle_share->column_name_str[(*field)->field_index].length(); - if ((*field)->is_null(ptr_diff)) - { - if (str->reserve(field_name_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + - SPIDER_SQL_IS_NULL_LEN + SPIDER_SQL_AND_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - oracle_share->append_column_name(str, (*field)->field_index); - str->q_append(SPIDER_SQL_IS_NULL_STR, SPIDER_SQL_IS_NULL_LEN); - } else { - if (str->reserve(field_name_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + - SPIDER_SQL_EQUAL_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - oracle_share->append_column_name(str, (*field)->field_index); - str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN); - (*field)->move_field_offset(ptr_diff); - if ( - spider_db_oracle_utility. - append_column_value(spider, str, *field, NULL, - share->access_charset) || - str->reserve(SPIDER_SQL_AND_LEN) - ) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - (*field)->move_field_offset(-ptr_diff); - } - str->q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN); - } - } - } else { - KEY *key_info = &table->key_info[table->s->primary_key]; - KEY_PART_INFO *key_part; - uint part_num; - for ( - key_part = key_info->key_part, part_num = 0; - part_num < spider_user_defined_key_parts(key_info); - key_part++, part_num++ - ) { - field = &key_part->field; - field_name_length = - oracle_share->column_name_str[(*field)->field_index].length(); - if ((*field)->is_null(ptr_diff)) - { - if (str->reserve(field_name_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + - SPIDER_SQL_IS_NULL_LEN + SPIDER_SQL_AND_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - oracle_share->append_column_name(str, (*field)->field_index); - str->q_append(SPIDER_SQL_IS_NULL_STR, SPIDER_SQL_IS_NULL_LEN); - } else { - if (str->reserve(field_name_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + - SPIDER_SQL_EQUAL_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - oracle_share->append_column_name(str, (*field)->field_index); - str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN); - (*field)->move_field_offset(ptr_diff); - if ( - spider_db_oracle_utility. - append_column_value(spider, str, *field, NULL, - share->access_charset) || - str->reserve(SPIDER_SQL_AND_LEN) - ) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - (*field)->move_field_offset(-ptr_diff); - } - str->q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN); - } - } - if (str->length() == str_len_bakup + SPIDER_SQL_WHERE_LEN) - { - /* no condition */ - str->length(str_len_bakup); - } else { - str->length(str->length() - SPIDER_SQL_AND_LEN); - } - if (str->reserve(SPIDER_SQL_LIMIT1_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_LIMIT1_STR, SPIDER_SQL_LIMIT1_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_condition_part( - const char *alias, - uint alias_length, - ulong sql_type, - bool test_flg -) { - int error_num; - spider_string *str; - bool start_where = FALSE; - DBUG_ENTER("spider_oracle_handler::append_condition_part"); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - DBUG_PRINT("info",("spider case1 sql_type=%lu", sql_type)); - if (test_flg) - { - str = NULL; - } else { - str = &sql; - start_where = ((int) str->length() == where_pos); - } - break; - case SPIDER_SQL_TYPE_TMP_SQL: - DBUG_PRINT("info",("spider case1 sql_type=%lu", sql_type)); - if (test_flg) - { - str = NULL; - } else { - str = &tmp_sql; - start_where = ((int) str->length() == where_pos); - } - break; - case SPIDER_SQL_TYPE_INSERT_SQL: - case SPIDER_SQL_TYPE_UPDATE_SQL: - case SPIDER_SQL_TYPE_DELETE_SQL: - case SPIDER_SQL_TYPE_BULK_UPDATE_SQL: - DBUG_PRINT("info",("spider case2 sql_type=%lu", sql_type)); - if (test_flg) - { - str = NULL; - } else { - str = &update_sql; - start_where = ((int) str->length() == where_pos); - } - break; - case SPIDER_SQL_TYPE_HANDLER: - DBUG_PRINT("info",("spider case3 sql_type=%lu", sql_type)); - if (test_flg) - { - str = NULL; - } else { - str = &ha_sql; - start_where = TRUE; - if (spider->active_index == MAX_KEY) - { - set_where_pos(SPIDER_SQL_TYPE_HANDLER); - if (str->reserve(SPIDER_SQL_READ_LEN + SPIDER_SQL_FIRST_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_READ_STR, SPIDER_SQL_READ_LEN); - ha_next_pos = str->length(); - str->q_append(SPIDER_SQL_FIRST_STR, SPIDER_SQL_FIRST_LEN); - sql_part2.length(0); - } - ha_where_pos = str->length(); - - if (sql_part2.length()) - { - str->append(sql_part2); - start_where = FALSE; - } - } - break; - default: - DBUG_PRINT("info",("spider default sql_type=%lu", sql_type)); - DBUG_RETURN(0); - } - error_num = append_condition(str, alias, alias_length, start_where, - sql_type); - DBUG_PRINT("info",("spider str=%s", str ? str->c_ptr_safe() : "NULL")); - DBUG_PRINT("info",("spider length=%u", str ? str->length() : 0)); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_condition( - spider_string *str, - const char *alias, - uint alias_length, - bool start_where, - ulong sql_type -) { - int error_num, restart_pos = 0, start_where_pos; - SPIDER_CONDITION *tmp_cond = spider->condition; - DBUG_ENTER("spider_oracle_handler::append_condition"); - DBUG_PRINT("info",("spider str=%p", str)); - DBUG_PRINT("info",("spider alias=%p", alias)); - DBUG_PRINT("info",("spider alias_length=%u", alias_length)); - DBUG_PRINT("info",("spider start_where=%s", start_where ? "TRUE" : "FALSE")); - DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); - if (str && start_where) - { - start_where_pos = str->length(); - } else { - start_where_pos = 0; - } - - if (spider->is_clone && !tmp_cond) - { - tmp_cond = spider->pt_clone_source_handler->condition; - } - - while (tmp_cond) - { - if (str) - { - restart_pos = str->length(); - if (start_where) - { - if (str->reserve(SPIDER_SQL_WHERE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN); - start_where = FALSE; - } else { - if (str->reserve(SPIDER_SQL_AND_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN); - } - } - if ((error_num = spider_db_print_item_type( - (Item *) tmp_cond->cond, NULL, spider, str, alias, alias_length, - spider_dbton_oracle.dbton_id, FALSE, NULL))) - { - if (str && error_num == ER_SPIDER_COND_SKIP_NUM) - { - DBUG_PRINT("info",("spider COND skip")); - str->length(restart_pos); - start_where = (restart_pos == start_where_pos); - } else - DBUG_RETURN(error_num); - } - tmp_cond = tmp_cond->next; - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_match_against_part( - ulong sql_type, - st_spider_ft_info *ft_info, - const char *alias, - uint alias_length -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_match_against_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_match_against(str, ft_info, alias, alias_length); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_match_against( - spider_string *str, - st_spider_ft_info *ft_info, - const char *alias, - uint alias_length -) { - SPIDER_SHARE *share = spider->share; - TABLE *table = spider->get_table(); - String *ft_init_key; - KEY *key_info; - uint key_name_length; - int key_count; - KEY_PART_INFO *key_part; - Field *field; - DBUG_ENTER("spider_oracle_handler::append_match_against"); - DBUG_PRINT("info",("spider this=%p", this)); - if (str->reserve(SPIDER_SQL_MATCH_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_MATCH_STR, SPIDER_SQL_MATCH_LEN); - - ft_init_key = ft_info->key; - key_info = &table->key_info[ft_info->inx]; - DBUG_PRINT("info", ("spider spider_user_defined_key_parts=%u", - spider_user_defined_key_parts(key_info))); - - for ( - key_part = key_info->key_part, - key_count = 0; - key_count < (int) spider_user_defined_key_parts(key_info); - key_part++, - key_count++ - ) { - field = key_part->field; - key_name_length = - oracle_share->column_name_str[field->field_index].length(); - if (alias_length) - { - if (str->reserve(alias_length + key_name_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(alias, alias_length); - } else { - if (str->reserve(key_name_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - oracle_share->append_column_name(str, field->field_index); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - str->length(str->length() - SPIDER_SQL_COMMA_LEN); - if (str->reserve(SPIDER_SQL_AGAINST_LEN + SPIDER_SQL_VALUE_QUOTE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_AGAINST_STR, SPIDER_SQL_AGAINST_LEN); - str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); - - char buf[MAX_FIELD_WIDTH]; - spider_string tmp_str(buf, MAX_FIELD_WIDTH, share->access_charset); - tmp_str.init_calc_mem(SPD_MID_ORACLE_HANDLER_APPEND_MATCH_AGAINST_1); - tmp_str.length(0); - if ( - tmp_str.append(ft_init_key->ptr(), ft_init_key->length(), - ft_init_key->charset()) || - str->reserve(tmp_str.length() * 2) || - spider_db_oracle_utility.append_escaped_util(str, tmp_str.get_str()) - ) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - - if (str->reserve( - SPIDER_SQL_VALUE_QUOTE_LEN + SPIDER_SQL_CLOSE_PAREN_LEN + - ((ft_info->flags & FT_BOOL) ? SPIDER_SQL_IN_BOOLEAN_MODE_LEN : 0) + - ((ft_info->flags & FT_EXPAND) ? - SPIDER_SQL_WITH_QUERY_EXPANSION_LEN : 0) - )) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); - if (ft_info->flags & FT_BOOL) - str->q_append(SPIDER_SQL_IN_BOOLEAN_MODE_STR, - SPIDER_SQL_IN_BOOLEAN_MODE_LEN); - if (ft_info->flags & FT_EXPAND) - str->q_append(SPIDER_SQL_WITH_QUERY_EXPANSION_STR, - SPIDER_SQL_WITH_QUERY_EXPANSION_LEN); - str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_match_select_part( - ulong sql_type, - const char *alias, - uint alias_length -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_match_select_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_match_select(str, alias, alias_length); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_match_select( - spider_string *str, - const char *alias, - uint alias_length -) { - int error_num; - DBUG_ENTER("spider_oracle_handler::append_match_select"); - DBUG_PRINT("info",("spider this=%p", this)); - if (spider->ft_current) - { - st_spider_ft_info *ft_info = spider->ft_first; - while (TRUE) - { - if ((error_num = append_match_against(str, ft_info, - alias, alias_length))) - DBUG_RETURN(error_num); - if (str->reserve(SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - if (ft_info == spider->ft_current) - break; - ft_info = ft_info->next; - } - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_sum_select_part( - ulong sql_type, - const char *alias, - uint alias_length -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_sum_select_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_sum_select(str, alias, alias_length); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_sum_select( - spider_string *str, - const char *alias, - uint alias_length -) { - int error_num; - st_select_lex *select_lex; - DBUG_ENTER("spider_oracle_handler::append_sum_select"); - DBUG_PRINT("info",("spider this=%p", this)); - select_lex = spider_get_select_lex(spider); - JOIN *join = select_lex->join; - Item_sum **item_sum_ptr; - for (item_sum_ptr = join->sum_funcs; *item_sum_ptr; ++item_sum_ptr) - { - if ((error_num = spider_db_oracle_utility.open_item_sum_func(*item_sum_ptr, - spider, str, alias, alias_length, FALSE, NULL))) - { - DBUG_RETURN(error_num); - } - if (str->reserve(SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - DBUG_RETURN(0); -} - -void spider_oracle_handler::set_order_pos( - ulong sql_type -) { - DBUG_ENTER("spider_oracle_handler::set_order_pos"); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - case SPIDER_SQL_TYPE_TMP_SQL: - order_pos = sql.length(); - break; - case SPIDER_SQL_TYPE_INSERT_SQL: - case SPIDER_SQL_TYPE_UPDATE_SQL: - case SPIDER_SQL_TYPE_DELETE_SQL: - case SPIDER_SQL_TYPE_BULK_UPDATE_SQL: - order_pos = update_sql.length(); - break; - case SPIDER_SQL_TYPE_HANDLER: - ha_next_pos = ha_sql.length(); - break; - default: - DBUG_ASSERT(0); - break; - } - DBUG_VOID_RETURN; -} - -void spider_oracle_handler::set_order_to_pos( - ulong sql_type -) { - DBUG_ENTER("spider_oracle_handler::set_order_to_pos"); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - case SPIDER_SQL_TYPE_TMP_SQL: - sql.length(order_pos); - break; - case SPIDER_SQL_TYPE_INSERT_SQL: - case SPIDER_SQL_TYPE_UPDATE_SQL: - case SPIDER_SQL_TYPE_DELETE_SQL: - case SPIDER_SQL_TYPE_BULK_UPDATE_SQL: - update_sql.length(order_pos); - break; - case SPIDER_SQL_TYPE_HANDLER: - ha_sql.length(ha_next_pos); - break; - default: - DBUG_ASSERT(0); - break; - } - DBUG_VOID_RETURN; -} - -int spider_oracle_handler::append_group_by_part( - const char *alias, - uint alias_length, - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_group_by_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - case SPIDER_SQL_TYPE_TMP_SQL: - str = &sql; - break; - case SPIDER_SQL_TYPE_INSERT_SQL: - case SPIDER_SQL_TYPE_UPDATE_SQL: - case SPIDER_SQL_TYPE_DELETE_SQL: - case SPIDER_SQL_TYPE_BULK_UPDATE_SQL: - str = &update_sql; - break; - case SPIDER_SQL_TYPE_HANDLER: - str = &ha_sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_group_by(str, alias, alias_length); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_group_by( - spider_string *str, - const char *alias, - uint alias_length -) { - int error_num; - st_select_lex *select_lex; - DBUG_ENTER("spider_oracle_handler::append_group_by"); - DBUG_PRINT("info",("spider this=%p", this)); - select_lex = spider_get_select_lex(spider); - ORDER *group = (ORDER *) select_lex->group_list.first; - if (group) - { - if (str->reserve(SPIDER_SQL_GROUP_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_GROUP_STR, SPIDER_SQL_GROUP_LEN); - for (; group; group = group->next) - { - if ((error_num = spider_db_print_item_type((*group->item), NULL, spider, - str, alias, alias_length, spider_dbton_oracle.dbton_id, FALSE, NULL))) - { - DBUG_RETURN(error_num); - } - if (str->reserve(SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - str->length(str->length() - SPIDER_SQL_COMMA_LEN); - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_key_order_for_merge_with_alias_part( - const char *alias, - uint alias_length, - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_key_order_for_merge_with_alias_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - case SPIDER_SQL_TYPE_TMP_SQL: - str = &sql; - break; - case SPIDER_SQL_TYPE_INSERT_SQL: - case SPIDER_SQL_TYPE_UPDATE_SQL: - case SPIDER_SQL_TYPE_DELETE_SQL: - case SPIDER_SQL_TYPE_BULK_UPDATE_SQL: - str = &update_sql; - break; - case SPIDER_SQL_TYPE_HANDLER: - str = &ha_sql; - ha_limit_pos = ha_sql.length(); - break; - default: - DBUG_RETURN(0); - } - error_num = append_key_order_for_merge_with_alias(str, alias, alias_length); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_key_order_for_merge_with_alias( - spider_string *str, - const char *alias, - uint alias_length -) { - /* sort for index merge */ - TABLE *table = spider->get_table(); - int length; - Field *field; - uint key_name_length; - DBUG_ENTER("spider_oracle_handler::append_key_order_for_merge_with_alias"); - DBUG_PRINT("info",("spider this=%p", this)); - if (spider->result_list.direct_aggregate) - { - int error_num; - if ((error_num = append_group_by(str, alias, alias_length))) - DBUG_RETURN(error_num); - } - if ( - spider->result_list.direct_order_limit || - spider->result_list.internal_limit < 9223372036854775807LL || - spider->result_list.split_read < 9223372036854775807LL || - spider->result_list.internal_offset - ) { - if (update_rownum_appended || select_rownum_appended) - { - if (str->reserve(SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_SELECT_WRAPPER_TAIL_STR, - SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN); - order_pos = str->length(); - limit_pos = str->length(); - DBUG_RETURN(0); - } - sql_part.length(0); - if (str == &update_sql) - { - if (sql_part.reserve(str->length() + SPIDER_SQL_UPDATE_WRAPPER_HEAD_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(str->ptr(), where_pos); - sql_part.q_append(SPIDER_SQL_UPDATE_WRAPPER_HEAD_STR, - SPIDER_SQL_UPDATE_WRAPPER_HEAD_LEN); - } else { - if (sql_part.reserve(str->length() + SPIDER_SQL_SELECT_WRAPPER_HEAD_LEN + - SPIDER_SQL_ROW_NUMBER_HEAD_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(SPIDER_SQL_SELECT_WRAPPER_HEAD_STR, - SPIDER_SQL_SELECT_WRAPPER_HEAD_LEN); - sql_part.q_append(str->ptr(), table_name_pos - SPIDER_SQL_FROM_LEN); - sql_part.q_append(SPIDER_SQL_ROW_NUMBER_HEAD_STR, - SPIDER_SQL_ROW_NUMBER_HEAD_LEN); - } - if (table->s->primary_key < MAX_KEY) - { - /* sort by primary key */ - KEY *key_info = &table->key_info[table->s->primary_key]; - KEY_PART_INFO *key_part; - for ( - key_part = key_info->key_part, - length = 1; - length <= (int) spider_user_defined_key_parts(key_info); - key_part++, - length++ - ) { - field = key_part->field; - key_name_length = - oracle_share->column_name_str[field->field_index].length(); - if (sql_part.reserve(alias_length + key_name_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(alias, alias_length); - oracle_share->append_column_name(&sql_part, field->field_index); - sql_part.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - } else { - /* sort by all columns */ - Field **fieldp; - for ( - fieldp = table->field, length = 1; - *fieldp; - fieldp++, length++ - ) { - key_name_length = - oracle_share->column_name_str[(*fieldp)->field_index].length(); - if (sql_part.reserve(alias_length + key_name_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(alias, alias_length); - oracle_share->append_column_name(&sql_part, (*fieldp)->field_index); - sql_part.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - } - uint pos_diff; - if (str == &update_sql) - { - uint table_name_size = (update_set_pos ? update_set_pos : where_pos) - - table_name_pos; - if (sql_part.reserve(SPIDER_SQL_ROW_NUMBER_TAIL_LEN + - SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN + str->length() - where_pos + - SPIDER_SQL_FROM_LEN + table_name_size)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(SPIDER_SQL_ROW_NUMBER_TAIL_STR, - SPIDER_SQL_ROW_NUMBER_TAIL_LEN); - sql_part.q_append(SPIDER_SQL_FROM_STR, SPIDER_SQL_FROM_LEN); - sql_part.q_append(str->ptr() + table_name_pos, table_name_size); - pos_diff = sql_part.length() - where_pos; - sql_part.q_append(str->ptr() + where_pos, str->length() - where_pos); - sql_part.q_append(SPIDER_SQL_SELECT_WRAPPER_TAIL_STR, - SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN); - update_rownum_appended = TRUE; - } else { - if (sql_part.reserve(SPIDER_SQL_ROW_NUMBER_TAIL_LEN + - SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN + str->length() - table_name_pos + - SPIDER_SQL_FROM_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(SPIDER_SQL_ROW_NUMBER_TAIL_STR, - SPIDER_SQL_ROW_NUMBER_TAIL_LEN); - pos_diff = sql_part.length() + SPIDER_SQL_FROM_LEN - table_name_pos; - sql_part.q_append(str->ptr() + table_name_pos - SPIDER_SQL_FROM_LEN, - str->length() - table_name_pos + SPIDER_SQL_FROM_LEN); - sql_part.q_append(SPIDER_SQL_SELECT_WRAPPER_TAIL_STR, - SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN); - select_rownum_appended = TRUE; - table_name_pos = table_name_pos + pos_diff; - } - if (str->copy(sql_part)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - where_pos = where_pos + pos_diff; - order_pos = str->length(); - limit_pos = str->length(); - DBUG_RETURN(0); - } - if (table->s->primary_key < MAX_KEY) - { - /* sort by primary key */ - KEY *key_info = &table->key_info[table->s->primary_key]; - KEY_PART_INFO *key_part; - for ( - key_part = key_info->key_part, - length = 1; - length <= (int) spider_user_defined_key_parts(key_info); - key_part++, - length++ - ) { - field = key_part->field; - key_name_length = - oracle_share->column_name_str[field->field_index].length(); - if (length == 1) - { - if (str->reserve(SPIDER_SQL_ORDER_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_ORDER_STR, SPIDER_SQL_ORDER_LEN); - } - if (str->reserve(alias_length + key_name_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(alias, alias_length); - oracle_share->append_column_name(str, field->field_index); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - if (length > 1) - { - str->length(str->length() - SPIDER_SQL_COMMA_LEN); - } - } else { - /* sort by all columns */ - Field **fieldp; - for ( - fieldp = table->field, length = 1; - *fieldp; - fieldp++, length++ - ) { - key_name_length = - oracle_share->column_name_str[(*fieldp)->field_index].length(); - if (length == 1) - { - if (str->reserve(SPIDER_SQL_ORDER_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_ORDER_STR, SPIDER_SQL_ORDER_LEN); - } - if (str->reserve(alias_length + key_name_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(alias, alias_length); - oracle_share->append_column_name(str, (*fieldp)->field_index); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - if (length > 1) - { - str->length(str->length() - SPIDER_SQL_COMMA_LEN); - } - } - limit_pos = str->length(); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_key_order_for_direct_order_limit_with_alias_part( - const char *alias, - uint alias_length, - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_key_order_for_direct_order_limit_with_alias_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - case SPIDER_SQL_TYPE_TMP_SQL: - str = &sql; - break; - case SPIDER_SQL_TYPE_INSERT_SQL: - case SPIDER_SQL_TYPE_UPDATE_SQL: - case SPIDER_SQL_TYPE_DELETE_SQL: - case SPIDER_SQL_TYPE_BULK_UPDATE_SQL: - str = &update_sql; - break; - case SPIDER_SQL_TYPE_HANDLER: - str = &ha_sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_key_order_for_direct_order_limit_with_alias( - str, alias, alias_length); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_key_order_for_direct_order_limit_with_alias( - spider_string *str, - const char *alias, - uint alias_length -) { - int error_num; - ORDER *order; - st_select_lex *select_lex; - longlong select_limit; - longlong offset_limit; - DBUG_ENTER("spider_oracle_handler::append_key_order_for_direct_order_limit_with_alias"); - DBUG_PRINT("info",("spider this=%p", this)); - if (spider->result_list.direct_aggregate) - { - if ((error_num = append_group_by(str, alias, alias_length))) - DBUG_RETURN(error_num); - } - spider_get_select_limit(spider, &select_lex, &select_limit, - &offset_limit); - if ( - spider->result_list.direct_order_limit || - spider->result_list.internal_limit < 9223372036854775807LL || - spider->result_list.split_read < 9223372036854775807LL || - spider->result_list.internal_offset - ) { - if (update_rownum_appended || select_rownum_appended) - { - if (str->reserve(SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_SELECT_WRAPPER_TAIL_STR, - SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN); - order_pos = str->length(); - limit_pos = str->length(); - DBUG_RETURN(0); - } - sql_part.length(0); - if (str == &update_sql) - { - if (sql_part.reserve(str->length() + SPIDER_SQL_UPDATE_WRAPPER_HEAD_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(str->ptr(), where_pos); - sql_part.q_append(SPIDER_SQL_UPDATE_WRAPPER_HEAD_STR, - SPIDER_SQL_UPDATE_WRAPPER_HEAD_LEN); - } else { - if (sql_part.reserve(str->length() + SPIDER_SQL_SELECT_WRAPPER_HEAD_LEN + - SPIDER_SQL_ROW_NUMBER_HEAD_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(SPIDER_SQL_SELECT_WRAPPER_HEAD_STR, - SPIDER_SQL_SELECT_WRAPPER_HEAD_LEN); - sql_part.q_append(str->ptr(), table_name_pos - SPIDER_SQL_FROM_LEN); - sql_part.q_append(SPIDER_SQL_ROW_NUMBER_HEAD_STR, - SPIDER_SQL_ROW_NUMBER_HEAD_LEN); - } - bool all_desc = TRUE; - if (select_lex->order_list.first) - { - for (order = (ORDER *) select_lex->order_list.first; order; - order = order->next) - { - if ((error_num = - spider_db_print_item_type((*order->item), NULL, spider, &sql_part, - alias, alias_length, spider_dbton_oracle.dbton_id, FALSE, NULL))) - { - DBUG_PRINT("info",("spider error=%d", error_num)); - DBUG_RETURN(error_num); - } - if (SPIDER_order_direction_is_asc(order)) - { - if (sql_part.reserve(SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - all_desc = FALSE; - } else { - if (sql_part.reserve(SPIDER_SQL_DESC_LEN + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(SPIDER_SQL_DESC_STR, SPIDER_SQL_DESC_LEN); - sql_part.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - } - } else { - all_desc = FALSE; - } - uint pos_diff; - if (str == &update_sql) - { - uint table_name_size = (update_set_pos ? update_set_pos : where_pos) - - table_name_pos; - if (all_desc) - { - if (sql_part.reserve(SPIDER_SQL_ROW_NUMBER_DESC_TAIL_LEN + - SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN + str->length() - where_pos + - SPIDER_SQL_FROM_LEN + table_name_size)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(SPIDER_SQL_ROW_NUMBER_DESC_TAIL_STR, - SPIDER_SQL_ROW_NUMBER_DESC_TAIL_LEN); - } else { - if (sql_part.reserve(SPIDER_SQL_ROW_NUMBER_TAIL_LEN + - SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN + str->length() - where_pos + - SPIDER_SQL_FROM_LEN + table_name_size)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(SPIDER_SQL_ROW_NUMBER_TAIL_STR, - SPIDER_SQL_ROW_NUMBER_TAIL_LEN); - } - sql_part.q_append(SPIDER_SQL_FROM_STR, SPIDER_SQL_FROM_LEN); - sql_part.q_append(str->ptr() + table_name_pos, table_name_size); - pos_diff = sql_part.length() - where_pos; - sql_part.q_append(str->ptr() + where_pos, str->length() - where_pos); - sql_part.q_append(SPIDER_SQL_SELECT_WRAPPER_TAIL_STR, - SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN); - update_rownum_appended = TRUE; - } else { - if (all_desc) - { - if (sql_part.reserve(SPIDER_SQL_ROW_NUMBER_DESC_TAIL_LEN + - SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN + str->length() - table_name_pos + - SPIDER_SQL_FROM_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(SPIDER_SQL_ROW_NUMBER_DESC_TAIL_STR, - SPIDER_SQL_ROW_NUMBER_DESC_TAIL_LEN); - } else { - if (sql_part.reserve(SPIDER_SQL_ROW_NUMBER_TAIL_LEN + - SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN + str->length() - table_name_pos + - SPIDER_SQL_FROM_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(SPIDER_SQL_ROW_NUMBER_TAIL_STR, - SPIDER_SQL_ROW_NUMBER_TAIL_LEN); - } - pos_diff = sql_part.length() + SPIDER_SQL_FROM_LEN - table_name_pos; - sql_part.q_append(str->ptr() + table_name_pos - SPIDER_SQL_FROM_LEN, - str->length() - table_name_pos + SPIDER_SQL_FROM_LEN); - sql_part.q_append(SPIDER_SQL_SELECT_WRAPPER_TAIL_STR, - SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN); - select_rownum_appended = TRUE; - table_name_pos = table_name_pos + pos_diff; - } - if (str->copy(sql_part)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - where_pos = where_pos + pos_diff; - order_pos = str->length(); - limit_pos = str->length(); - DBUG_RETURN(0); - } - if (select_lex->order_list.first) - { - if (str->reserve(SPIDER_SQL_ORDER_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_ORDER_STR, SPIDER_SQL_ORDER_LEN); - for (order = (ORDER *) select_lex->order_list.first; order; - order = order->next) - { - if ((error_num = - spider_db_print_item_type((*order->item), NULL, spider, str, alias, - alias_length, spider_dbton_oracle.dbton_id, FALSE, NULL))) - { - DBUG_PRINT("info",("spider error=%d", error_num)); - DBUG_RETURN(error_num); - } - if (SPIDER_order_direction_is_asc(order)) - { - if (str->reserve(SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } else { - if (str->reserve(SPIDER_SQL_DESC_LEN + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_DESC_STR, SPIDER_SQL_DESC_LEN); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - } - str->length(str->length() - SPIDER_SQL_COMMA_LEN); - } - limit_pos = str->length(); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_key_order_with_alias_part( - const char *alias, - uint alias_length, - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_key_order_with_alias_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - case SPIDER_SQL_TYPE_TMP_SQL: - str = &sql; - break; - case SPIDER_SQL_TYPE_INSERT_SQL: - case SPIDER_SQL_TYPE_UPDATE_SQL: - case SPIDER_SQL_TYPE_DELETE_SQL: - case SPIDER_SQL_TYPE_BULK_UPDATE_SQL: - str = &update_sql; - break; - case SPIDER_SQL_TYPE_HANDLER: - str = &ha_sql; - error_num = append_key_order_for_handler(str, alias, alias_length); - DBUG_RETURN(error_num); - default: - DBUG_RETURN(0); - } - error_num = append_key_order_with_alias(str, alias, alias_length); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_key_order_for_handler( - spider_string *str, - const char *alias, - uint alias_length -) { - DBUG_ENTER("spider_oracle_handler::append_key_order_for_handler"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_PRINT("info",("spider ha_next_pos=%d", ha_next_pos)); - DBUG_PRINT("info",("spider ha_where_pos=%d", ha_where_pos)); - str->q_append(alias, alias_length); - memset((char *) str->ptr() + str->length(), ' ', - ha_where_pos - ha_next_pos - alias_length); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_key_order_with_alias( - spider_string *str, - const char *alias, - uint alias_length -) { - SPIDER_RESULT_LIST *result_list = &spider->result_list; - KEY *key_info = result_list->key_info; - int length; - KEY_PART_INFO *key_part; - Field *field; - uint key_name_length; - DBUG_ENTER("spider_oracle_handler::append_key_order_with_alias"); - DBUG_PRINT("info",("spider this=%p", this)); - if (spider->result_list.direct_aggregate) - { - int error_num; - if ((error_num = append_group_by(str, alias, alias_length))) - DBUG_RETURN(error_num); - } - if ( - spider->result_list.direct_order_limit || - spider->result_list.internal_limit < 9223372036854775807LL || - spider->result_list.split_read < 9223372036854775807LL || - spider->result_list.internal_offset - ) { - if (update_rownum_appended || select_rownum_appended) - { - if (str->reserve(SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_SELECT_WRAPPER_TAIL_STR, - SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN); - order_pos = str->length(); - limit_pos = str->length(); - DBUG_RETURN(0); - } - sql_part.length(0); - if (str == &update_sql) - { - if (sql_part.reserve(str->length() + SPIDER_SQL_UPDATE_WRAPPER_HEAD_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(str->ptr(), where_pos); - sql_part.q_append(SPIDER_SQL_UPDATE_WRAPPER_HEAD_STR, - SPIDER_SQL_UPDATE_WRAPPER_HEAD_LEN); - } else { - if (sql_part.reserve(str->length() + SPIDER_SQL_SELECT_WRAPPER_HEAD_LEN + - SPIDER_SQL_ROW_NUMBER_HEAD_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(SPIDER_SQL_SELECT_WRAPPER_HEAD_STR, - SPIDER_SQL_SELECT_WRAPPER_HEAD_LEN); - sql_part.q_append(str->ptr(), table_name_pos - SPIDER_SQL_FROM_LEN); - sql_part.q_append(SPIDER_SQL_ROW_NUMBER_HEAD_STR, - SPIDER_SQL_ROW_NUMBER_HEAD_LEN); - } - if (result_list->sorted == TRUE) - { - if (result_list->desc_flg == TRUE) - { - for ( - key_part = key_info->key_part + result_list->key_order, - length = 1; - length + result_list->key_order <= - (int) spider_user_defined_key_parts(key_info) && - length <= result_list->max_order; - key_part++, - length++ - ) { - field = key_part->field; - key_name_length = - oracle_share->column_name_str[field->field_index].length(); - if (key_part->key_part_flag & HA_REVERSE_SORT) - { - if (sql_part.reserve(alias_length + key_name_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(alias, alias_length); - oracle_share->append_column_name(&sql_part, field->field_index); - sql_part.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } else { - if (sql_part.reserve(alias_length + key_name_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + - SPIDER_SQL_DESC_LEN + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(alias, alias_length); - oracle_share->append_column_name(&sql_part, field->field_index); - sql_part.q_append(SPIDER_SQL_DESC_STR, SPIDER_SQL_DESC_LEN); - sql_part.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - } - } else { - for ( - key_part = key_info->key_part + result_list->key_order, - length = 1; - length + result_list->key_order <= - (int) spider_user_defined_key_parts(key_info) && - length <= result_list->max_order; - key_part++, - length++ - ) { - field = key_part->field; - key_name_length = - oracle_share->column_name_str[field->field_index].length(); - if (key_part->key_part_flag & HA_REVERSE_SORT) - { - if (sql_part.reserve(alias_length + key_name_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + - SPIDER_SQL_DESC_LEN + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(alias, alias_length); - oracle_share->append_column_name(&sql_part, field->field_index); - sql_part.q_append(SPIDER_SQL_DESC_STR, SPIDER_SQL_DESC_LEN); - sql_part.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } else { - if (sql_part.reserve(alias_length + key_name_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(alias, alias_length); - oracle_share->append_column_name(&sql_part, field->field_index); - sql_part.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - } - } - } - uint pos_diff; - if (str == &update_sql) - { - uint table_name_size = (update_set_pos ? update_set_pos : where_pos) - - table_name_pos; - if (result_list->sorted == TRUE && result_list->desc_flg == TRUE) - { - if (sql_part.reserve(SPIDER_SQL_ROW_NUMBER_DESC_TAIL_LEN + - SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN + str->length() - where_pos + - SPIDER_SQL_FROM_LEN + table_name_size)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(SPIDER_SQL_ROW_NUMBER_DESC_TAIL_STR, - SPIDER_SQL_ROW_NUMBER_DESC_TAIL_LEN); - } else { - if (sql_part.reserve(SPIDER_SQL_ROW_NUMBER_TAIL_LEN + - SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN + str->length() - where_pos + - SPIDER_SQL_FROM_LEN + table_name_size)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(SPIDER_SQL_ROW_NUMBER_TAIL_STR, - SPIDER_SQL_ROW_NUMBER_TAIL_LEN); - } - sql_part.q_append(SPIDER_SQL_FROM_STR, SPIDER_SQL_FROM_LEN); - sql_part.q_append(str->ptr() + table_name_pos, - table_name_size); - pos_diff = sql_part.length() - where_pos; - sql_part.q_append(str->ptr() + where_pos, str->length() - where_pos); - sql_part.q_append(SPIDER_SQL_SELECT_WRAPPER_TAIL_STR, - SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN); - update_rownum_appended = TRUE; - } else { - if (result_list->sorted == TRUE && result_list->desc_flg == TRUE) - { - if (sql_part.reserve(SPIDER_SQL_ROW_NUMBER_DESC_TAIL_LEN + - SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN + str->length() - table_name_pos + - SPIDER_SQL_FROM_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(SPIDER_SQL_ROW_NUMBER_DESC_TAIL_STR, - SPIDER_SQL_ROW_NUMBER_DESC_TAIL_LEN); - } else { - if (sql_part.reserve(SPIDER_SQL_ROW_NUMBER_TAIL_LEN + - SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN + str->length() - table_name_pos + - SPIDER_SQL_FROM_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(SPIDER_SQL_ROW_NUMBER_TAIL_STR, - SPIDER_SQL_ROW_NUMBER_TAIL_LEN); - } - pos_diff = sql_part.length() + SPIDER_SQL_FROM_LEN - table_name_pos; - sql_part.q_append(str->ptr() + table_name_pos - SPIDER_SQL_FROM_LEN, - str->length() - table_name_pos + SPIDER_SQL_FROM_LEN); - sql_part.q_append(SPIDER_SQL_SELECT_WRAPPER_TAIL_STR, - SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN); - select_rownum_appended = TRUE; - table_name_pos = table_name_pos + pos_diff; - } - if (str->copy(sql_part)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - where_pos = where_pos + pos_diff; - order_pos = str->length(); - limit_pos = str->length(); - DBUG_RETURN(0); - } - if (result_list->sorted == TRUE) - { - if (result_list->desc_flg == TRUE) - { - for ( - key_part = key_info->key_part + result_list->key_order, - length = 1; - length + result_list->key_order < - (int) spider_user_defined_key_parts(key_info) && - length < result_list->max_order; - key_part++, - length++ - ) { - field = key_part->field; - key_name_length = - oracle_share->column_name_str[field->field_index].length(); - if (length == 1) - { - if (str->reserve(SPIDER_SQL_ORDER_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_ORDER_STR, SPIDER_SQL_ORDER_LEN); - } - if (key_part->key_part_flag & HA_REVERSE_SORT) - { - if (str->reserve(alias_length + key_name_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(alias, alias_length); - oracle_share->append_column_name(str, field->field_index); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } else { - if (str->reserve(alias_length + key_name_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + - SPIDER_SQL_DESC_LEN + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(alias, alias_length); - oracle_share->append_column_name(str, field->field_index); - str->q_append(SPIDER_SQL_DESC_STR, SPIDER_SQL_DESC_LEN); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - } - if ( - length + result_list->key_order <= - (int) spider_user_defined_key_parts(key_info) && - length <= result_list->max_order - ) { - field = key_part->field; - key_name_length = - oracle_share->column_name_str[field->field_index].length(); - if (length == 1) - { - if (str->reserve(SPIDER_SQL_ORDER_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_ORDER_STR, SPIDER_SQL_ORDER_LEN); - } - if (key_part->key_part_flag & HA_REVERSE_SORT) - { - if (str->reserve(alias_length + key_name_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(alias, alias_length); - oracle_share->append_column_name(str, field->field_index); - } else { - if (str->reserve(alias_length + key_name_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_DESC_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(alias, alias_length); - oracle_share->append_column_name(str, field->field_index); - str->q_append(SPIDER_SQL_DESC_STR, SPIDER_SQL_DESC_LEN); - } - } - } else { - for ( - key_part = key_info->key_part + result_list->key_order, - length = 1; - length + result_list->key_order < - (int) spider_user_defined_key_parts(key_info) && - length < result_list->max_order; - key_part++, - length++ - ) { - field = key_part->field; - key_name_length = - oracle_share->column_name_str[field->field_index].length(); - if (length == 1) - { - if (str->reserve(SPIDER_SQL_ORDER_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_ORDER_STR, SPIDER_SQL_ORDER_LEN); - } - if (key_part->key_part_flag & HA_REVERSE_SORT) - { - if (str->reserve(alias_length + key_name_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + - SPIDER_SQL_DESC_LEN + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(alias, alias_length); - oracle_share->append_column_name(str, field->field_index); - str->q_append(SPIDER_SQL_DESC_STR, SPIDER_SQL_DESC_LEN); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } else { - if (str->reserve(alias_length + key_name_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(alias, alias_length); - oracle_share->append_column_name(str, field->field_index); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - } - if ( - length + result_list->key_order <= - (int) spider_user_defined_key_parts(key_info) && - length <= result_list->max_order - ) { - field = key_part->field; - key_name_length = - oracle_share->column_name_str[field->field_index].length(); - if (length == 1) - { - if (str->reserve(SPIDER_SQL_ORDER_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_ORDER_STR, SPIDER_SQL_ORDER_LEN); - } - if (key_part->key_part_flag & HA_REVERSE_SORT) - { - if (str->reserve(alias_length + key_name_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_DESC_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(alias, alias_length); - oracle_share->append_column_name(str, field->field_index); - str->q_append(SPIDER_SQL_DESC_STR, SPIDER_SQL_DESC_LEN); - } else { - if (str->reserve(alias_length + key_name_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(alias, alias_length); - oracle_share->append_column_name(str, field->field_index); - } - } - } - } - limit_pos = str->length(); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_limit_part( - longlong offset, - longlong limit, - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_limit_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - limit_pos = str->length(); - break; - case SPIDER_SQL_TYPE_TMP_SQL: - str = &tmp_sql; - limit_pos = str->length(); - break; - case SPIDER_SQL_TYPE_INSERT_SQL: - case SPIDER_SQL_TYPE_UPDATE_SQL: - case SPIDER_SQL_TYPE_DELETE_SQL: - case SPIDER_SQL_TYPE_BULK_UPDATE_SQL: - str = &update_sql; - limit_pos = str->length(); - break; - case SPIDER_SQL_TYPE_HANDLER: - str = &ha_sql; - ha_limit_pos = str->length(); - break; - default: - DBUG_RETURN(0); - } - error_num = append_limit(str, offset, limit); - DBUG_PRINT("info",("spider str=%s", str->c_ptr_safe())); - DBUG_PRINT("info",("spider length=%u", str->length())); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::reappend_limit_part( - longlong offset, - longlong limit, - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::reappend_limit_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - str->length(limit_pos); - break; - case SPIDER_SQL_TYPE_TMP_SQL: - str = &tmp_sql; - str->length(limit_pos); - break; - case SPIDER_SQL_TYPE_INSERT_SQL: - case SPIDER_SQL_TYPE_UPDATE_SQL: - case SPIDER_SQL_TYPE_DELETE_SQL: - case SPIDER_SQL_TYPE_BULK_UPDATE_SQL: - str = &update_sql; - str->length(limit_pos); - break; - case SPIDER_SQL_TYPE_HANDLER: - str = &ha_sql; - str->length(ha_limit_pos); - break; - default: - DBUG_RETURN(0); - } - error_num = append_limit(str, offset, limit); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_limit( - spider_string *str, - longlong offset, - longlong limit -) { - char buf[SPIDER_LONGLONG_LEN + 1]; - uint32 length; - DBUG_ENTER("spider_oracle_handler::append_limit"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_PRINT("info", ("spider offset=%lld", offset)); - DBUG_PRINT("info", ("spider limit=%lld", limit)); - if (offset || limit < 9223372036854775807LL) - { - if ((int) str->length() == where_pos) - { - if (offset) - { - int error_num; - if ((error_num = append_key_order_for_direct_order_limit_with_alias( - str, NULL, 0))) - DBUG_RETURN(error_num); - } else { - if (str->reserve(SPIDER_SQL_WHERE_LEN + SPIDER_SQL_ROWNUM_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN); - str->q_append(SPIDER_SQL_ROWNUM_STR, SPIDER_SQL_ROWNUM_LEN); - } - } - if (offset) - { - if (str->reserve(SPIDER_SQL_BETWEEN_LEN + SPIDER_SQL_AND_LEN + - ((SPIDER_LONGLONG_LEN) * 2))) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_BETWEEN_STR, SPIDER_SQL_BETWEEN_LEN); - length = (uint32) (my_charset_bin.longlong10_to_str)( - buf, SPIDER_LONGLONG_LEN + 1, -10, offset + 1); - str->q_append(buf, length); - str->q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN); - length = (uint32) (my_charset_bin.longlong10_to_str)( - buf, SPIDER_LONGLONG_LEN + 1, -10, limit + offset); - str->q_append(buf, length); - } else { - if (str->reserve(SPIDER_SQL_HS_LTEQUAL_LEN + - (SPIDER_LONGLONG_LEN))) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_HS_LTEQUAL_STR, SPIDER_SQL_HS_LTEQUAL_LEN); - length = (uint32) (my_charset_bin.longlong10_to_str)( - buf, SPIDER_LONGLONG_LEN + 1, -10, limit); - str->q_append(buf, length); - } - if (update_rownum_appended) - { - if (str->reserve(SPIDER_SQL_CLOSE_PAREN_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN); - } - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_select_lock_part( - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_select_lock_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_select_lock(str); - DBUG_PRINT("info",("spider str=%s", str->c_ptr_safe())); - DBUG_PRINT("info",("spider length=%u", str->length())); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_select_lock( - spider_string *str -) { - int lock_mode = spider_conn_lock_mode(spider); - DBUG_ENTER("spider_oracle_handler::append_select_lock"); - DBUG_PRINT("info",("spider this=%p", this)); - if (select_rownum_appended) - { - table_lock_mode = lock_mode; - } else { - if (lock_mode == SPIDER_LOCK_MODE_EXCLUSIVE) - { - if (str->reserve(SPIDER_SQL_FOR_UPDATE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_FOR_UPDATE_STR, SPIDER_SQL_FOR_UPDATE_LEN); - } else if (lock_mode == SPIDER_LOCK_MODE_SHARED) - { - if (str->reserve(SPIDER_SQL_FOR_UPDATE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_FOR_UPDATE_STR, SPIDER_SQL_FOR_UPDATE_LEN); - } - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_union_all_start_part( - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_union_all_start_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_union_all_start(str); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_union_all_start( - spider_string *str -) { - DBUG_ENTER("spider_oracle_handler::append_union_all_start"); - DBUG_PRINT("info",("spider this=%p", this)); - if (str->reserve(SPIDER_SQL_OPEN_PAREN_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_union_all_part( - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_union_all_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_union_all(str); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_union_all( - spider_string *str -) { - DBUG_ENTER("spider_oracle_handler::append_union_all"); - DBUG_PRINT("info",("spider this=%p", this)); - if (str->reserve(SPIDER_SQL_UNION_ALL_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_UNION_ALL_STR, SPIDER_SQL_UNION_ALL_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_union_all_end_part( - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_union_all_end_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_union_all_end(str); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_union_all_end( - spider_string *str -) { - DBUG_ENTER("spider_oracle_handler::append_union_all_end"); - DBUG_PRINT("info",("spider this=%p", this)); - str->length(str->length() - - SPIDER_SQL_UNION_ALL_LEN + SPIDER_SQL_CLOSE_PAREN_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_multi_range_cnt_part( - ulong sql_type, - uint multi_range_cnt, - bool with_comma -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_multi_range_cnt_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - break; - case SPIDER_SQL_TYPE_TMP_SQL: - str = &tmp_sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_multi_range_cnt(str, multi_range_cnt, with_comma); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_multi_range_cnt( - spider_string *str, - uint multi_range_cnt, - bool with_comma -) { - int range_cnt_length; - char range_cnt_str[SPIDER_SQL_INT_LEN]; - DBUG_ENTER("spider_oracle_handler::append_multi_range_cnt"); - DBUG_PRINT("info",("spider this=%p", this)); - range_cnt_length = my_sprintf(range_cnt_str, (range_cnt_str, "%u", - multi_range_cnt)); - if (with_comma) - { - if (str->reserve(range_cnt_length + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(range_cnt_str, range_cnt_length); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } else { - if (str->reserve(range_cnt_length)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(range_cnt_str, range_cnt_length); - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_multi_range_cnt_with_name_part( - ulong sql_type, - uint multi_range_cnt -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_multi_range_cnt_with_name_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - break; - case SPIDER_SQL_TYPE_TMP_SQL: - str = &tmp_sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_multi_range_cnt_with_name(str, multi_range_cnt); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_multi_range_cnt_with_name( - spider_string *str, - uint multi_range_cnt -) { - int range_cnt_length; - char range_cnt_str[SPIDER_SQL_INT_LEN]; - DBUG_ENTER("spider_oracle_handler::append_multi_range_cnt_with_name"); - DBUG_PRINT("info",("spider this=%p", this)); - range_cnt_length = my_sprintf(range_cnt_str, (range_cnt_str, "%u", - multi_range_cnt)); - if (str->reserve(range_cnt_length + SPIDER_SQL_SPACE_LEN + - SPIDER_SQL_ID_LEN + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(range_cnt_str, range_cnt_length); - str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN); - str->q_append(SPIDER_SQL_ID_STR, SPIDER_SQL_ID_LEN); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_open_handler_part( - ulong sql_type, - uint handler_id, - SPIDER_CONN *conn, - int link_idx -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_open_handler_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_HANDLER: - str = &ha_sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_open_handler(str, handler_id, conn, link_idx); - exec_ha_sql = str; - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_open_handler( - spider_string *str, - uint handler_id, - SPIDER_CONN *conn, - int link_idx -) { - int error_num; - DBUG_ENTER("spider_oracle_handler::append_open_handler"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_PRINT("info",("spider link_idx=%d", link_idx)); - DBUG_PRINT("info",("spider m_handler_cid=%s", - spider->m_handler_cid[link_idx])); - if (str->reserve(SPIDER_SQL_HANDLER_LEN)) - { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - str->q_append(SPIDER_SQL_HANDLER_STR, SPIDER_SQL_HANDLER_LEN); - if ((error_num = oracle_share->append_table_name(str, - spider->conn_link_idx[link_idx]))) - DBUG_RETURN(error_num); - if (str->reserve(SPIDER_SQL_OPEN_LEN + SPIDER_SQL_AS_LEN + - SPIDER_SQL_HANDLER_CID_LEN)) - { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - str->q_append(SPIDER_SQL_OPEN_STR, SPIDER_SQL_OPEN_LEN); - str->q_append(SPIDER_SQL_AS_STR, SPIDER_SQL_AS_LEN); - str->q_append(spider->m_handler_cid[link_idx], SPIDER_SQL_HANDLER_CID_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_close_handler_part( - ulong sql_type, - int link_idx -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_close_handler_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_HANDLER: - str = &ha_sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_close_handler(str, link_idx); - exec_ha_sql = str; - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_close_handler( - spider_string *str, - int link_idx -) { - DBUG_ENTER("spider_oracle_handler::append_close_handler"); - DBUG_PRINT("info",("spider this=%p", this)); - if (str->reserve(SPIDER_SQL_HANDLER_LEN + SPIDER_SQL_CLOSE_LEN + - SPIDER_SQL_HANDLER_CID_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_HANDLER_STR, SPIDER_SQL_HANDLER_LEN); - str->q_append(spider->m_handler_cid[link_idx], - SPIDER_SQL_HANDLER_CID_LEN); - str->q_append(SPIDER_SQL_CLOSE_STR, SPIDER_SQL_CLOSE_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_insert_terminator_part( - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_insert_terminator_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_INSERT_SQL: - str = &insert_sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_insert_terminator(str); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_insert_terminator( - spider_string *str -) { - DBUG_ENTER("spider_oracle_handler::append_insert_terminator"); - DBUG_PRINT("info",("spider this=%p", this)); - if (spider->result_list.insert_dup_update_pushdown) - { - DBUG_PRINT("info",("spider add duplicate key update")); - str->length(str->length() - SPIDER_SQL_COMMA_LEN); - if (str->reserve(SPIDER_SQL_DUPLICATE_KEY_UPDATE_LEN + - dup_update_sql.length())) - { - str->length(0); - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - str->q_append(SPIDER_SQL_DUPLICATE_KEY_UPDATE_STR, - SPIDER_SQL_DUPLICATE_KEY_UPDATE_LEN); - if (str->append(dup_update_sql)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } else { - str->length(str->length() - SPIDER_SQL_COMMA_LEN); - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_insert_values_part( - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_insert_values_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_INSERT_SQL: - str = &insert_sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_insert_values(str); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_insert_values( - spider_string *str -) { - SPIDER_SHARE *share = spider->share; - TABLE *table = spider->get_table(); - Field **field; - bool add_value = FALSE; - DBUG_ENTER("spider_oracle_handler::append_insert_values"); - DBUG_PRINT("info",("spider this=%p", this)); - nextval_pos = 0; - if (str->reserve(SPIDER_SQL_OPEN_PAREN_LEN)) - { - str->length(0); - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN); - for (field = table->field; *field; field++) - { - DBUG_PRINT("info",("spider field_index=%u", (*field)->field_index)); - if ( - bitmap_is_set(table->write_set, (*field)->field_index) || - bitmap_is_set(table->read_set, (*field)->field_index) - ) { -#ifndef DBUG_OFF - my_bitmap_map *tmp_map = - dbug_tmp_use_all_columns(table, table->read_set); -#endif - add_value = TRUE; - DBUG_PRINT("info",("spider is_null()=%s", - (*field)->is_null() ? "TRUE" : "FALSE")); - DBUG_PRINT("info",("spider table->next_number_field=%p", - table->next_number_field)); - DBUG_PRINT("info",("spider *field=%p", *field)); - DBUG_PRINT("info",("spider force_auto_increment=%s", - (table->next_number_field && spider->force_auto_increment) ? - "TRUE" : "FALSE")); - if ( - table->next_number_field == *field && - !table->auto_increment_field_not_null && - !spider->force_auto_increment - ) { - nextval_pos = str->length(); - if (str->reserve(oracle_share->nextval_max_length + - SPIDER_SQL_COMMA_LEN)) - { -#ifndef DBUG_OFF - dbug_tmp_restore_column_map(table->read_set, tmp_map); -#endif - str->length(0); - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - str->length(str->length() + oracle_share->nextval_max_length); - } else if ((*field)->is_null()) - { - if (str->reserve(SPIDER_SQL_NULL_LEN + SPIDER_SQL_COMMA_LEN)) - { -#ifndef DBUG_OFF - dbug_tmp_restore_column_map(table->read_set, tmp_map); -#endif - str->length(0); - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - str->q_append(SPIDER_SQL_NULL_STR, SPIDER_SQL_NULL_LEN); - } else { - if ( - spider_db_oracle_utility. - append_column_value(spider, str, *field, NULL, - share->access_charset) || - str->reserve(SPIDER_SQL_COMMA_LEN) - ) { -#ifndef DBUG_OFF - dbug_tmp_restore_column_map(table->read_set, tmp_map); -#endif - str->length(0); - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - } - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); -#ifndef DBUG_OFF - dbug_tmp_restore_column_map(table->read_set, tmp_map); -#endif - } - } - if (add_value) - str->length(str->length() - SPIDER_SQL_COMMA_LEN); - if (str->reserve(SPIDER_SQL_CLOSE_PAREN_LEN + SPIDER_SQL_COMMA_LEN)) - { - str->length(0); - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_into_part( - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_into_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_INSERT_SQL: - str = &insert_sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_into(str); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_into( - spider_string *str -) { - const TABLE *table = spider->get_table(); - Field **field; - uint field_name_length = 0; - DBUG_ENTER("spider_oracle_handler::append_into"); - DBUG_PRINT("info",("spider this=%p", this)); - if (str->reserve(SPIDER_SQL_INTO_LEN + oracle_share->db_nm_max_length + - SPIDER_SQL_DOT_LEN + oracle_share->table_nm_max_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 4 + SPIDER_SQL_OPEN_PAREN_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_INTO_STR, SPIDER_SQL_INTO_LEN); - insert_table_name_pos = str->length(); - append_table_name_with_adjusting(str, first_link_idx, - SPIDER_SQL_TYPE_INSERT_SQL); - str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN); - for (field = table->field; *field; field++) - { - if ( - bitmap_is_set(table->write_set, (*field)->field_index) || - bitmap_is_set(table->read_set, (*field)->field_index) - ) { - field_name_length = - oracle_share->column_name_str[(*field)->field_index].length(); - if (str->reserve(field_name_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - oracle_share->append_column_name(str, (*field)->field_index); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - } - if (field_name_length) - str->length(str->length() - SPIDER_SQL_COMMA_LEN); - if (str->reserve(SPIDER_SQL_CLOSE_PAREN_LEN + SPIDER_SQL_VALUES_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN); - str->q_append(SPIDER_SQL_VALUES_STR, SPIDER_SQL_VALUES_LEN); - insert_pos = str->length(); - DBUG_RETURN(0); -} - -void spider_oracle_handler::set_insert_to_pos( - ulong sql_type -) { - DBUG_ENTER("spider_oracle_handler::set_insert_to_pos"); - switch (sql_type) - { - case SPIDER_SQL_TYPE_INSERT_SQL: - insert_sql.length(insert_pos); - break; - default: - DBUG_ASSERT(0); - break; - } - DBUG_VOID_RETURN; -} - -int spider_oracle_handler::append_from_part( - ulong sql_type, - int link_idx -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_from_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_HANDLER: - str = &ha_sql; - break; - case SPIDER_SQL_TYPE_UPDATE_SQL: - case SPIDER_SQL_TYPE_DELETE_SQL: - case SPIDER_SQL_TYPE_BULK_UPDATE_SQL: - str = &update_sql; - break; - default: - str = &sql; - break; - } - error_num = append_from(str, sql_type, link_idx); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_from( - spider_string *str, - ulong sql_type, - int link_idx -) { - DBUG_ENTER("spider_oracle_handler::append_from"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_PRINT("info",("spider link_idx=%d", link_idx)); - if (sql_type == SPIDER_SQL_TYPE_HANDLER) - { - ha_table_name_pos = str->length(); - DBUG_PRINT("info",("spider ha_table_name_pos=%u", ha_table_name_pos)); - ha_sql_handler_id = spider->m_handler_id[link_idx]; - DBUG_PRINT("info",("spider ha_sql_handler_id=%u", ha_sql_handler_id)); - if (str->reserve(SPIDER_SQL_HANDLER_CID_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(spider->m_handler_cid[link_idx], SPIDER_SQL_HANDLER_CID_LEN); - DBUG_PRINT("info",("spider m_handler_cid=%s", - spider->m_handler_cid[link_idx])); - } else { - if (str->reserve(SPIDER_SQL_FROM_LEN + oracle_share->db_nm_max_length + - SPIDER_SQL_DOT_LEN + oracle_share->table_nm_max_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 4 + SPIDER_SQL_OPEN_PAREN_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_FROM_STR, SPIDER_SQL_FROM_LEN); - table_name_pos = str->length(); - append_table_name_with_adjusting(str, link_idx, sql_type); - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_flush_tables_part( - ulong sql_type, - int link_idx, - bool lock -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_flush_tables_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_OTHER_SQL: - str = &spider->result_list.sqls[link_idx]; - break; - default: - DBUG_RETURN(0); - } - error_num = append_flush_tables(str, link_idx, lock); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_flush_tables( - spider_string *str, - int link_idx, - bool lock -) { - DBUG_ENTER("spider_oracle_handler::append_flush_tables"); - DBUG_PRINT("info",("spider this=%p", this)); - if (lock) - { - if (str->reserve(SPIDER_SQL_FLUSH_TABLES_LEN + - SPIDER_SQL_WITH_READ_LOCK_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_FLUSH_TABLES_STR, SPIDER_SQL_FLUSH_TABLES_LEN); - str->q_append(SPIDER_SQL_WITH_READ_LOCK_STR, - SPIDER_SQL_WITH_READ_LOCK_LEN); - } else { - if (str->reserve(SPIDER_SQL_FLUSH_TABLES_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_FLUSH_TABLES_STR, SPIDER_SQL_FLUSH_TABLES_LEN); - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_optimize_table_part( - ulong sql_type, - int link_idx -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_optimize_table_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_OTHER_SQL: - str = &spider->result_list.sqls[link_idx]; - break; - default: - DBUG_RETURN(0); - } - error_num = append_optimize_table(str, link_idx); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_optimize_table( - spider_string *str, - int link_idx -) { - SPIDER_SHARE *share = spider->share; - int conn_link_idx = spider->conn_link_idx[link_idx]; - int local_length = spider_param_internal_optimize_local( - spider->wide_handler->trx->thd, - share->internal_optimize_local) * SPIDER_SQL_SQL_LOCAL_LEN; - DBUG_ENTER("spider_oracle_handler::append_optimize_table"); - DBUG_PRINT("info",("spider this=%p", this)); - if (str->reserve(SPIDER_SQL_SQL_OPTIMIZE_LEN + SPIDER_SQL_SQL_TABLE_LEN + - local_length + - oracle_share->db_names_str[conn_link_idx].length() + - SPIDER_SQL_DOT_LEN + - oracle_share->table_names_str[conn_link_idx].length() + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 4)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_SQL_OPTIMIZE_STR, SPIDER_SQL_SQL_OPTIMIZE_LEN); - if (local_length) - str->q_append(SPIDER_SQL_SQL_LOCAL_STR, SPIDER_SQL_SQL_LOCAL_LEN); - str->q_append(SPIDER_SQL_SQL_TABLE_STR, SPIDER_SQL_SQL_TABLE_LEN); - oracle_share->append_table_name(str, conn_link_idx); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_analyze_table_part( - ulong sql_type, - int link_idx -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_analyze_table_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_OTHER_SQL: - str = &spider->result_list.sqls[link_idx]; - break; - default: - DBUG_RETURN(0); - } - error_num = append_analyze_table(str, link_idx); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_analyze_table( - spider_string *str, - int link_idx -) { - SPIDER_SHARE *share = spider->share; - int conn_link_idx = spider->conn_link_idx[link_idx]; - int local_length = spider_param_internal_optimize_local( - spider->wide_handler->trx->thd, - share->internal_optimize_local) * SPIDER_SQL_SQL_LOCAL_LEN; - DBUG_ENTER("spider_oracle_handler::append_analyze_table"); - DBUG_PRINT("info",("spider this=%p", this)); - if (str->reserve(SPIDER_SQL_SQL_ANALYZE_LEN + SPIDER_SQL_SQL_TABLE_LEN + - local_length + - oracle_share->db_names_str[conn_link_idx].length() + - SPIDER_SQL_DOT_LEN + - oracle_share->table_names_str[conn_link_idx].length() + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 4)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_SQL_ANALYZE_STR, SPIDER_SQL_SQL_ANALYZE_LEN); - if (local_length) - str->q_append(SPIDER_SQL_SQL_LOCAL_STR, SPIDER_SQL_SQL_LOCAL_LEN); - str->q_append(SPIDER_SQL_SQL_TABLE_STR, SPIDER_SQL_SQL_TABLE_LEN); - oracle_share->append_table_name(str, conn_link_idx); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_repair_table_part( - ulong sql_type, - int link_idx, - HA_CHECK_OPT* check_opt -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_repair_table_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_OTHER_SQL: - str = &spider->result_list.sqls[link_idx]; - break; - default: - DBUG_RETURN(0); - } - error_num = append_repair_table(str, link_idx, check_opt); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_repair_table( - spider_string *str, - int link_idx, - HA_CHECK_OPT* check_opt -) { - SPIDER_SHARE *share = spider->share; - int conn_link_idx = spider->conn_link_idx[link_idx]; - int local_length = spider_param_internal_optimize_local( - spider->wide_handler->trx->thd, - share->internal_optimize_local) * SPIDER_SQL_SQL_LOCAL_LEN; - DBUG_ENTER("spider_oracle_handler::append_repair_table"); - DBUG_PRINT("info",("spider this=%p", this)); - if (str->reserve(SPIDER_SQL_SQL_REPAIR_LEN + SPIDER_SQL_SQL_TABLE_LEN + - local_length + - oracle_share->db_names_str[conn_link_idx].length() + - SPIDER_SQL_DOT_LEN + - oracle_share->table_names_str[conn_link_idx].length() + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 4)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_SQL_REPAIR_STR, SPIDER_SQL_SQL_REPAIR_LEN); - if (local_length) - str->q_append(SPIDER_SQL_SQL_LOCAL_STR, SPIDER_SQL_SQL_LOCAL_LEN); - str->q_append(SPIDER_SQL_SQL_TABLE_STR, SPIDER_SQL_SQL_TABLE_LEN); - oracle_share->append_table_name(str, conn_link_idx); - if (check_opt->flags & T_QUICK) - { - if (str->reserve(SPIDER_SQL_SQL_QUICK_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_SQL_QUICK_STR, SPIDER_SQL_SQL_QUICK_LEN); - } - if (check_opt->flags & T_EXTEND) - { - if (str->reserve(SPIDER_SQL_SQL_EXTENDED_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_SQL_EXTENDED_STR, SPIDER_SQL_SQL_EXTENDED_LEN); - } - if (check_opt->sql_flags & TT_USEFRM) - { - if (str->reserve(SPIDER_SQL_SQL_USE_FRM_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_SQL_USE_FRM_STR, SPIDER_SQL_SQL_USE_FRM_LEN); - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_check_table_part( - ulong sql_type, - int link_idx, - HA_CHECK_OPT* check_opt -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_check_table_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_OTHER_SQL: - str = &spider->result_list.sqls[link_idx]; - break; - default: - DBUG_RETURN(0); - } - error_num = append_check_table(str, link_idx, check_opt); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_check_table( - spider_string *str, - int link_idx, - HA_CHECK_OPT* check_opt -) { - int conn_link_idx = spider->conn_link_idx[link_idx]; - DBUG_ENTER("spider_oracle_handler::append_check_table"); - DBUG_PRINT("info",("spider this=%p", this)); - if (str->reserve(SPIDER_SQL_SQL_CHECK_TABLE_LEN + - oracle_share->db_names_str[conn_link_idx].length() + - SPIDER_SQL_DOT_LEN + - oracle_share->table_names_str[conn_link_idx].length() + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 4)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_SQL_CHECK_TABLE_STR, - SPIDER_SQL_SQL_CHECK_TABLE_LEN); - oracle_share->append_table_name(str, conn_link_idx); - if (check_opt->flags & T_QUICK) - { - if (str->reserve(SPIDER_SQL_SQL_QUICK_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_SQL_QUICK_STR, SPIDER_SQL_SQL_QUICK_LEN); - } - if (check_opt->flags & T_FAST) - { - if (str->reserve(SPIDER_SQL_SQL_FAST_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_SQL_FAST_STR, SPIDER_SQL_SQL_FAST_LEN); - } - if (check_opt->flags & T_MEDIUM) - { - if (str->reserve(SPIDER_SQL_SQL_MEDIUM_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_SQL_MEDIUM_STR, SPIDER_SQL_SQL_MEDIUM_LEN); - } - if (check_opt->flags & T_EXTEND) - { - if (str->reserve(SPIDER_SQL_SQL_EXTENDED_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_SQL_EXTENDED_STR, SPIDER_SQL_SQL_EXTENDED_LEN); - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_enable_keys_part( - ulong sql_type, - int link_idx -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_enable_keys_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_OTHER_SQL: - str = &spider->result_list.sqls[link_idx]; - break; - default: - DBUG_RETURN(0); - } - error_num = append_enable_keys(str, link_idx); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_enable_keys( - spider_string *str, - int link_idx -) { - int conn_link_idx = spider->conn_link_idx[link_idx]; - DBUG_ENTER("spider_oracle_handler::append_enable_keys"); - DBUG_PRINT("info",("spider this=%p", this)); - if (str->reserve(SPIDER_SQL_SQL_ALTER_TABLE_LEN + - oracle_share->db_names_str[conn_link_idx].length() + - SPIDER_SQL_DOT_LEN + - oracle_share->table_names_str[conn_link_idx].length() + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 4 + SPIDER_SQL_SQL_ENABLE_KEYS_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_SQL_ALTER_TABLE_STR, - SPIDER_SQL_SQL_ALTER_TABLE_LEN); - oracle_share->append_table_name(str, conn_link_idx); - str->q_append(SPIDER_SQL_SQL_ENABLE_KEYS_STR, - SPIDER_SQL_SQL_ENABLE_KEYS_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_disable_keys_part( - ulong sql_type, - int link_idx -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_disable_keys_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_OTHER_SQL: - str = &spider->result_list.sqls[link_idx]; - break; - default: - DBUG_RETURN(0); - } - error_num = append_disable_keys(str, link_idx); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_disable_keys( - spider_string *str, - int link_idx -) { - int conn_link_idx = spider->conn_link_idx[link_idx]; - DBUG_ENTER("spider_oracle_handler::append_disable_keys"); - DBUG_PRINT("info",("spider this=%p", this)); - if (str->reserve(SPIDER_SQL_SQL_ALTER_TABLE_LEN + - oracle_share->db_names_str[conn_link_idx].length() + - SPIDER_SQL_DOT_LEN + - oracle_share->table_names_str[conn_link_idx].length() + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 4 + SPIDER_SQL_SQL_DISABLE_KEYS_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_SQL_ALTER_TABLE_STR, - SPIDER_SQL_SQL_ALTER_TABLE_LEN); - oracle_share->append_table_name(str, conn_link_idx); - str->q_append(SPIDER_SQL_SQL_DISABLE_KEYS_STR, - SPIDER_SQL_SQL_DISABLE_KEYS_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_delete_all_rows_part( - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_delete_all_rows_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_DELETE_SQL: - str = &update_sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_delete_all_rows(str, sql_type); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_delete_all_rows( - spider_string *str, - ulong sql_type -) { - int error_num; - DBUG_ENTER("spider_oracle_handler::append_delete_all_rows"); - DBUG_PRINT("info",("spider this=%p", this)); - if (spider->sql_command == SQLCOM_TRUNCATE) - { - if ((error_num = append_truncate(str, sql_type, first_link_idx))) - DBUG_RETURN(error_num); - } else { - if ( - (error_num = append_delete(str)) || - (error_num = append_from(str, sql_type, first_link_idx)) - ) - DBUG_RETURN(error_num); - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_truncate( - spider_string *str, - ulong sql_type, - int link_idx -) { - DBUG_ENTER("spider_oracle_handler::append_truncate"); - if (str->reserve(SPIDER_SQL_TRUNCATE_TABLE_LEN + - oracle_share->db_nm_max_length + - SPIDER_SQL_DOT_LEN + oracle_share->table_nm_max_length + - /* SPIDER_SQL_NAME_QUOTE_LEN */ 4 + SPIDER_SQL_OPEN_PAREN_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_TRUNCATE_TABLE_STR, SPIDER_SQL_TRUNCATE_TABLE_LEN); - table_name_pos = str->length(); - append_table_name_with_adjusting(str, link_idx, sql_type); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_explain_select_part( - const key_range *start_key, - const key_range *end_key, - ulong sql_type, - int link_idx -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_explain_select_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_OTHER_SQL: - str = &spider->result_list.sqls[link_idx]; - break; - default: - DBUG_RETURN(0); - } - error_num = - append_explain_select(str, start_key, end_key, sql_type, link_idx); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_explain_select( - spider_string *str, - const key_range *start_key, - const key_range *end_key, - ulong sql_type, - int link_idx -) { - int error_num; - DBUG_ENTER("spider_oracle_handler::append_explain_select"); - DBUG_PRINT("info",("spider this=%p", this)); - if (str->reserve(SPIDER_SQL_EXPLAIN_SELECT_LEN)) - { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - str->q_append(SPIDER_SQL_EXPLAIN_SELECT_STR, SPIDER_SQL_EXPLAIN_SELECT_LEN); - if ( - (error_num = append_from(str, sql_type, link_idx)) || - (error_num = append_key_where(str, NULL, NULL, start_key, end_key, - sql_type, FALSE)) - ) { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - DBUG_RETURN(0); -} - -/******************************************************************** - * Determine whether the current query's projection list - * consists solely of the specified column. - * - * Params IN - field_index: - * Field index of the column of interest within - * its table. - * - * Returns TRUE - if the query's projection list consists - * solely of the specified column. - * FALSE - otherwise. - ********************************************************************/ -bool spider_oracle_handler::is_sole_projection_field( uint16 field_index ) -{ - // Determine whether the projection list consists solely of the field of interest - bool is_field_in_projection_list = FALSE; - TABLE* table = spider->get_table(); - uint16 projection_field_count = 0; - uint16 projection_field_index; - Field** field; - DBUG_ENTER( "spider_oracle_handler::is_sole_projection_field" ); - - for ( field = table->field; *field; field++ ) - { - projection_field_index = ( *field )->field_index; - - if ( !( minimum_select_bit_is_set( projection_field_index ) ) ) - { - // Current field is not in the projection list - continue; - } - - projection_field_count++; - - if ( !is_field_in_projection_list ) - { - if (field_index == projection_field_index) - { - // Field of interest is in the projection list - is_field_in_projection_list = TRUE; - } - } - - if ( is_field_in_projection_list && ( projection_field_count != 1 ) ) - { - // Field of interest is not the sole column in the projection list - DBUG_RETURN( FALSE ); - } - } - - if ( is_field_in_projection_list && ( projection_field_count == 1 ) ) - { - // Field of interest is the only column in the projection list - DBUG_RETURN( TRUE ); - } - - DBUG_RETURN( FALSE ); -} - -bool spider_oracle_handler::is_bulk_insert_exec_period( - bool bulk_end -) { - DBUG_ENTER("spider_oracle_handler::is_bulk_insert_exec_period"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_PRINT("info",("spider insert_sql.length=%u", insert_sql.length())); - DBUG_PRINT("info",("spider insert_pos=%d", insert_pos)); - DBUG_PRINT("info",("spider insert_sql=%s", insert_sql.c_ptr_safe())); - if ( -/* - (bulk_end || (int) insert_sql.length() >= spider->bulk_size) && -*/ - (int) insert_sql.length() > insert_pos - ) { - DBUG_RETURN(TRUE); - } - DBUG_RETURN(FALSE); -} - -bool spider_oracle_handler::sql_is_filled_up( - ulong sql_type -) { - DBUG_ENTER("spider_oracle_handler::sql_is_filled_up"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(filled_up); -} - -bool spider_oracle_handler::sql_is_empty( - ulong sql_type -) { - bool is_empty; - DBUG_ENTER("spider_oracle_handler::sql_is_empty"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - is_empty = (sql.length() == 0); - break; - case SPIDER_SQL_TYPE_INSERT_SQL: - is_empty = (insert_sql.length() == 0); - break; - case SPIDER_SQL_TYPE_UPDATE_SQL: - case SPIDER_SQL_TYPE_DELETE_SQL: - case SPIDER_SQL_TYPE_BULK_UPDATE_SQL: - is_empty = (update_sql.length() == 0); - break; - case SPIDER_SQL_TYPE_TMP_SQL: - is_empty = (tmp_sql.length() == 0); - break; - case SPIDER_SQL_TYPE_HANDLER: - is_empty = (ha_sql.length() == 0); - break; - default: - is_empty = TRUE; - break; - } - DBUG_RETURN(is_empty); -} - -bool spider_oracle_handler::support_multi_split_read() -{ - DBUG_ENTER("spider_oracle_handler::support_multi_split_read"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(FALSE); -} - -bool spider_oracle_handler::support_bulk_update() -{ - DBUG_ENTER("spider_oracle_handler::support_bulk_update"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(FALSE); -} - -int spider_oracle_handler::bulk_tmp_table_insert() -{ - int error_num; - DBUG_ENTER("spider_oracle_handler::bulk_tmp_table_insert"); - DBUG_PRINT("info",("spider this=%p", this)); - error_num = store_sql_to_bulk_tmp_table(&update_sql, upd_tmp_tbl); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::bulk_tmp_table_insert( - int link_idx -) { - int error_num; - DBUG_ENTER("spider_oracle_handler::bulk_tmp_table_insert"); - DBUG_PRINT("info",("spider this=%p", this)); - error_num = store_sql_to_bulk_tmp_table( - &spider->result_list.update_sqls[link_idx], - spider->result_list.upd_tmp_tbls[link_idx]); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::bulk_tmp_table_end_bulk_insert() -{ - int error_num; - DBUG_ENTER("spider_oracle_handler::bulk_tmp_table_end_bulk_insert"); - DBUG_PRINT("info",("spider this=%p", this)); - if ((error_num = upd_tmp_tbl->file->ha_end_bulk_insert())) - { - DBUG_RETURN(error_num); - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::bulk_tmp_table_rnd_init() -{ - int error_num; - DBUG_ENTER("spider_oracle_handler::bulk_tmp_table_rnd_init"); - DBUG_PRINT("info",("spider this=%p", this)); - upd_tmp_tbl->file->extra(HA_EXTRA_CACHE); - if ((error_num = upd_tmp_tbl->file->ha_rnd_init(TRUE))) - { - DBUG_RETURN(error_num); - } - reading_from_bulk_tmp_table = TRUE; - DBUG_RETURN(0); -} - -int spider_oracle_handler::bulk_tmp_table_rnd_next() -{ - int error_num; - DBUG_ENTER("spider_oracle_handler::bulk_tmp_table_rnd_next"); - DBUG_PRINT("info",("spider this=%p", this)); - error_num = upd_tmp_tbl->file->ha_rnd_next(upd_tmp_tbl->record[0]); - if (!error_num) - { - error_num = restore_sql_from_bulk_tmp_table(&insert_sql, upd_tmp_tbl); - } - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::bulk_tmp_table_rnd_end() -{ - int error_num; - DBUG_ENTER("spider_oracle_handler::bulk_tmp_table_rnd_end"); - DBUG_PRINT("info",("spider this=%p", this)); - reading_from_bulk_tmp_table = FALSE; - if ((error_num = upd_tmp_tbl->file->ha_rnd_end())) - { - DBUG_RETURN(error_num); - } - DBUG_RETURN(0); -} - -bool spider_oracle_handler::need_copy_for_update( - int link_idx -) { - int all_link_idx = spider->conn_link_idx[link_idx]; - DBUG_ENTER("spider_oracle_handler::need_copy_for_update"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(!oracle_share->same_db_table_name || - spider->share->link_statuses[all_link_idx] == SPIDER_LINK_STATUS_RECOVERY); -} - -bool spider_oracle_handler::bulk_tmp_table_created() -{ - DBUG_ENTER("spider_oracle_handler::bulk_tmp_table_created"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(upd_tmp_tbl); -} - -int spider_oracle_handler::mk_bulk_tmp_table_and_bulk_start() -{ - THD *thd = spider->wide_handler->trx->thd; - TABLE *table = spider->get_table(); - DBUG_ENTER("spider_oracle_handler::mk_bulk_tmp_table_and_bulk_start"); - DBUG_PRINT("info",("spider this=%p", this)); - if (!upd_tmp_tbl) - { -#ifdef SPIDER_use_LEX_CSTRING_for_Field_blob_constructor - LEX_CSTRING field_name = {STRING_WITH_LEN("a")}; - if (!(upd_tmp_tbl = spider_mk_sys_tmp_table( - thd, table, &upd_tmp_tbl_prm, &field_name, update_sql.charset()))) -#else - if (!(upd_tmp_tbl = spider_mk_sys_tmp_table( - thd, table, &upd_tmp_tbl_prm, "a", update_sql.charset()))) -#endif - { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - upd_tmp_tbl->file->extra(HA_EXTRA_WRITE_CACHE); - upd_tmp_tbl->file->ha_start_bulk_insert((ha_rows) 0); - } - DBUG_RETURN(0); -} - -void spider_oracle_handler::rm_bulk_tmp_table() -{ - DBUG_ENTER("spider_oracle_handler::rm_bulk_tmp_table"); - DBUG_PRINT("info",("spider this=%p", this)); - if (upd_tmp_tbl) - { - spider_rm_sys_tmp_table(spider->wide_handler->trx->thd, upd_tmp_tbl, - &upd_tmp_tbl_prm); - upd_tmp_tbl = NULL; - } - DBUG_VOID_RETURN; -} - -int spider_oracle_handler::store_sql_to_bulk_tmp_table( - spider_string *str, - TABLE *tmp_table -) { - int error_num; - DBUG_ENTER("spider_oracle_handler::store_sql_to_bulk_tmp_table"); - DBUG_PRINT("info",("spider this=%p", this)); - tmp_table->field[0]->set_notnull(); - tmp_table->field[0]->store(str->ptr(), str->length(), str->charset()); - if ((error_num = tmp_table->file->ha_write_row(tmp_table->record[0]))) - DBUG_RETURN(error_num); - DBUG_RETURN(0); -} - -int spider_oracle_handler::restore_sql_from_bulk_tmp_table( - spider_string *str, - TABLE *tmp_table -) { - DBUG_ENTER("spider_oracle_handler::restore_sql_from_bulk_tmp_table"); - DBUG_PRINT("info",("spider this=%p", this)); - tmp_table->field[0]->val_str(str->get_str()); - str->mem_calc(); - DBUG_RETURN(0); -} - -int spider_oracle_handler::insert_lock_tables_list( - SPIDER_CONN *conn, - int link_idx -) { - spider_db_oracle *db_conn = (spider_db_oracle *) conn->db_conn; - SPIDER_LINK_FOR_HASH *tmp_link_for_hash2 = &link_for_hash[link_idx]; - DBUG_ENTER("spider_oracle_handler::insert_lock_tables_list"); - DBUG_PRINT("info",("spider this=%p", this)); - uint old_elements = - db_conn->lock_table_hash.array.max_element; - if (my_hash_insert(&db_conn->lock_table_hash, - (uchar*) tmp_link_for_hash2)) - { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - if (db_conn->lock_table_hash.array.max_element > old_elements) - { - spider_alloc_calc_mem(spider_current_trx, - db_conn->lock_table_hash, - (db_conn->lock_table_hash.array.max_element - old_elements) * - db_conn->lock_table_hash.array.size_of_element); - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_lock_tables_list( - SPIDER_CONN *conn, - int link_idx, - int *appended -) { - int error_num; - SPIDER_LINK_FOR_HASH *tmp_link_for_hash, *tmp_link_for_hash2; - int conn_link_idx = spider->conn_link_idx[link_idx]; - spider_db_oracle *db_conn = (spider_db_oracle *) conn->db_conn; - DBUG_ENTER("spider_oracle_handler::append_lock_tables_list"); - DBUG_PRINT("info",("spider this=%p", this)); - tmp_link_for_hash2 = &link_for_hash[link_idx]; - tmp_link_for_hash2->db_table_str = - &oracle_share->db_table_str[conn_link_idx]; - tmp_link_for_hash2->db_table_str_hash_value = - oracle_share->db_table_str_hash_value[conn_link_idx]; - if (!(tmp_link_for_hash = (SPIDER_LINK_FOR_HASH *) - my_hash_search_using_hash_value( - &db_conn->lock_table_hash, - tmp_link_for_hash2->db_table_str_hash_value, - (uchar*) tmp_link_for_hash2->db_table_str->ptr(), - tmp_link_for_hash2->db_table_str->length()))) - { - if ((error_num = insert_lock_tables_list(conn, link_idx))) - DBUG_RETURN(error_num); - *appended = 1; - } else { - if (tmp_link_for_hash->spider->wide_handler->lock_type < - spider->wide_handler->lock_type) - { - my_hash_delete(&db_conn->lock_table_hash, - (uchar*) tmp_link_for_hash); - uint old_elements = - db_conn->lock_table_hash.array.max_element; - if (my_hash_insert(&db_conn->lock_table_hash, - (uchar*) tmp_link_for_hash2)) - { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - if (db_conn->lock_table_hash.array.max_element > old_elements) - { - spider_alloc_calc_mem(spider_current_trx, - db_conn->lock_table_hash, - (db_conn->lock_table_hash.array.max_element - old_elements) * - db_conn->lock_table_hash.array.size_of_element); - } - } - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::realloc_sql( - ulong *realloced -) { - THD *thd = spider->wide_handler->trx->thd; - st_spider_share *share = spider->share; - int init_sql_alloc_size = - spider_param_init_sql_alloc_size(thd, share->init_sql_alloc_size); - DBUG_ENTER("spider_oracle_handler::realloc_sql"); - DBUG_PRINT("info",("spider this=%p", this)); - if ((int) sql.alloced_length() > init_sql_alloc_size * 2) - { - sql.free(); - if (sql.real_alloc(init_sql_alloc_size)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - *realloced |= SPIDER_SQL_TYPE_SELECT_SQL; - } - if ((int) ha_sql.alloced_length() > init_sql_alloc_size * 2) - { - ha_sql.free(); - if (ha_sql.real_alloc(init_sql_alloc_size)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - *realloced |= SPIDER_SQL_TYPE_SELECT_SQL; - } - if ((int) dup_update_sql.alloced_length() > init_sql_alloc_size * 2) - { - dup_update_sql.free(); - if (dup_update_sql.real_alloc(init_sql_alloc_size)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - if ((int) insert_sql.alloced_length() > init_sql_alloc_size * 2) - { - insert_sql.free(); - if (insert_sql.real_alloc(init_sql_alloc_size)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - *realloced |= SPIDER_SQL_TYPE_INSERT_SQL; - } - if ((int) update_sql.alloced_length() > init_sql_alloc_size * 2) - { - update_sql.free(); - if (update_sql.real_alloc(init_sql_alloc_size)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - *realloced |= (SPIDER_SQL_TYPE_UPDATE_SQL | SPIDER_SQL_TYPE_DELETE_SQL); - } - update_sql.length(0); - if ((int) tmp_sql.alloced_length() > init_sql_alloc_size * 2) - { - tmp_sql.free(); - if (tmp_sql.real_alloc(init_sql_alloc_size)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - *realloced |= SPIDER_SQL_TYPE_TMP_SQL; - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::reset_sql( - ulong sql_type -) { - DBUG_ENTER("spider_oracle_handler::reset_sql"); - DBUG_PRINT("info",("spider this=%p", this)); - if (sql_type & SPIDER_SQL_TYPE_SELECT_SQL) - { - table_lock_mode = 0; - select_rownum_appended = FALSE; - sql.length(0); - } - if (sql_type & SPIDER_SQL_TYPE_INSERT_SQL) - { - insert_sql.length(0); - } - if (sql_type & (SPIDER_SQL_TYPE_UPDATE_SQL | SPIDER_SQL_TYPE_DELETE_SQL | - SPIDER_SQL_TYPE_BULK_UPDATE_SQL)) - { - update_rownum_appended = FALSE; - update_set_pos = 0; - update_sql.length(0); - } - if (sql_type & SPIDER_SQL_TYPE_TMP_SQL) - { - tmp_sql.length(0); - } - if (sql_type & SPIDER_SQL_TYPE_HANDLER) - { - ha_sql.length(0); - } - DBUG_RETURN(0); -} - - -bool spider_oracle_handler::need_lock_before_set_sql_for_exec( - ulong sql_type -) { - DBUG_ENTER("spider_oracle_handler::need_lock_before_set_sql_for_exec"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(FALSE); -} - -int spider_oracle_handler::set_sql_for_exec( - ulong sql_type, - int link_idx, - SPIDER_LINK_IDX_CHAIN *link_idx_chain -) { - int error_num; - SPIDER_RESULT_LIST *result_list = &spider->result_list; - int all_link_idx = spider->conn_link_idx[link_idx]; - DBUG_ENTER("spider_oracle_handler::set_sql_for_exec"); - DBUG_PRINT("info",("spider this=%p", this)); - if (sql_type & SPIDER_SQL_TYPE_SELECT_SQL) - { - if (table_lock_mode) - { - spider_string *str = &result_list->insert_sqls[link_idx]; - str->length(0); - if (str->reserve(SPIDER_SQL_LOCK_TABLE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_LOCK_TABLE_STR, SPIDER_SQL_LOCK_TABLE_LEN); - if ((error_num = oracle_share->append_table_name(str, all_link_idx))) - DBUG_RETURN(error_num); - if (table_lock_mode == SPIDER_LOCK_MODE_EXCLUSIVE) - { - if (str->reserve(SPIDER_SQL_LOCK_TABLE_EXCLUSIVE_MODE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_LOCK_TABLE_EXCLUSIVE_MODE_STR, - SPIDER_SQL_LOCK_TABLE_EXCLUSIVE_MODE_LEN); - } else if (table_lock_mode == SPIDER_LOCK_MODE_SHARED) - { - if (str->reserve(SPIDER_SQL_LOCK_TABLE_SHARE_MODE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_LOCK_TABLE_SHARE_MODE_STR, - SPIDER_SQL_LOCK_TABLE_SHARE_MODE_LEN); - } - exec_lock_sql = str; - } - - if ((error_num = spider_db_oracle_utility.reappend_tables( - spider->fields, link_idx_chain, &sql))) - DBUG_RETURN(error_num); - exec_sql = &sql; - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::set_sql_for_exec( - ulong sql_type, - int link_idx -) { - int error_num; - uint tmp_pos; - SPIDER_SHARE *share = spider->share; - SPIDER_RESULT_LIST *result_list = &spider->result_list; - int all_link_idx = spider->conn_link_idx[link_idx]; - DBUG_ENTER("spider_oracle_handler::set_sql_for_exec"); - DBUG_PRINT("info",("spider this=%p", this)); - if (sql_type & (SPIDER_SQL_TYPE_SELECT_SQL | SPIDER_SQL_TYPE_TMP_SQL)) - { - if (table_lock_mode) - { - spider_string *str = &result_list->insert_sqls[link_idx]; - str->length(0); - if (str->reserve(SPIDER_SQL_LOCK_TABLE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_LOCK_TABLE_STR, SPIDER_SQL_LOCK_TABLE_LEN); - if ((error_num = oracle_share->append_table_name(str, all_link_idx))) - DBUG_RETURN(error_num); - if (table_lock_mode == SPIDER_LOCK_MODE_EXCLUSIVE) - { - if (str->reserve(SPIDER_SQL_LOCK_TABLE_EXCLUSIVE_MODE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_LOCK_TABLE_EXCLUSIVE_MODE_STR, - SPIDER_SQL_LOCK_TABLE_EXCLUSIVE_MODE_LEN); - } else if (table_lock_mode == SPIDER_LOCK_MODE_SHARED) - { - if (str->reserve(SPIDER_SQL_LOCK_TABLE_SHARE_MODE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_LOCK_TABLE_SHARE_MODE_STR, - SPIDER_SQL_LOCK_TABLE_SHARE_MODE_LEN); - } - exec_lock_sql = str; - } - - if (oracle_share->same_db_table_name || link_idx == first_link_idx) - { - if (sql_type & SPIDER_SQL_TYPE_SELECT_SQL) - exec_sql = &sql; - if (sql_type & SPIDER_SQL_TYPE_TMP_SQL) - exec_tmp_sql = &tmp_sql; - } else { - char tmp_table_name[MAX_FIELD_WIDTH * 2], - tgt_table_name[MAX_FIELD_WIDTH * 2]; - int tmp_table_name_length; - spider_string tgt_table_name_str(tgt_table_name, - MAX_FIELD_WIDTH * 2, - oracle_share->db_names_str[link_idx].charset()); - const char *table_names[2], *table_aliases[2]; - uint table_name_lengths[2], table_alias_lengths[2]; - tgt_table_name_str.init_calc_mem(SPD_MID_ORACLE_HANDLER_SET_SQL_FOR_EXEC_1); - tgt_table_name_str.length(0); - if (result_list->tmp_table_join && spider->bka_mode != 2) - { - create_tmp_bka_table_name(tmp_table_name, &tmp_table_name_length, - link_idx); - append_table_name_with_adjusting(&tgt_table_name_str, link_idx, - SPIDER_SQL_TYPE_TMP_SQL); - table_names[0] = tmp_table_name; - table_names[1] = tgt_table_name_str.ptr(); - table_name_lengths[0] = tmp_table_name_length; - table_name_lengths[1] = tgt_table_name_str.length(); - table_aliases[0] = SPIDER_SQL_A_STR; - table_aliases[1] = SPIDER_SQL_B_STR; - table_alias_lengths[0] = SPIDER_SQL_A_LEN; - table_alias_lengths[1] = SPIDER_SQL_B_LEN; - } - if (sql_type & SPIDER_SQL_TYPE_SELECT_SQL) - { - exec_sql = &result_list->sqls[link_idx]; - if (exec_sql->copy(sql)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - else if (result_list->use_union) - { - if ((error_num = reset_union_table_name(exec_sql, link_idx, - SPIDER_SQL_TYPE_SELECT_SQL))) - DBUG_RETURN(error_num); - } else { - tmp_pos = exec_sql->length(); - exec_sql->length(table_name_pos); - if (result_list->tmp_table_join && spider->bka_mode != 2) - { - if ((error_num = spider_db_oracle_utility.append_from_with_alias( - exec_sql, table_names, table_name_lengths, - table_aliases, table_alias_lengths, 2, - &table_name_pos, TRUE)) - ) - DBUG_RETURN(error_num); - exec_sql->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN); - } else { - append_table_name_with_adjusting(exec_sql, link_idx, - SPIDER_SQL_TYPE_SELECT_SQL); - } - exec_sql->length(tmp_pos); - } - } - if (sql_type & SPIDER_SQL_TYPE_TMP_SQL) - { - exec_tmp_sql = &result_list->tmp_sqls[link_idx]; - if (result_list->tmp_table_join && spider->bka_mode != 2) - { - if (exec_tmp_sql->copy(tmp_sql)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - else { - tmp_pos = exec_tmp_sql->length(); - exec_tmp_sql->length(tmp_sql_pos1); - exec_tmp_sql->q_append(tmp_table_name, tmp_table_name_length); - exec_tmp_sql->length(tmp_sql_pos2); - exec_tmp_sql->q_append(tmp_table_name, tmp_table_name_length); - exec_tmp_sql->length(tmp_sql_pos3); - exec_tmp_sql->q_append(tmp_table_name, tmp_table_name_length); - exec_tmp_sql->length(tmp_pos); - } - } - } - } - } - if (sql_type & SPIDER_SQL_TYPE_INSERT_SQL) - { - if (oracle_share->same_db_table_name || link_idx == first_link_idx) - exec_insert_sql = &insert_sql; - else { - exec_insert_sql = &result_list->insert_sqls[link_idx]; - if (exec_insert_sql->copy(insert_sql)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - DBUG_PRINT("info",("spider exec_insert_sql=%s", - exec_insert_sql->c_ptr_safe())); - tmp_pos = exec_insert_sql->length(); - exec_insert_sql->length(insert_table_name_pos); - append_table_name_with_adjusting(exec_insert_sql, link_idx, - sql_type); - exec_insert_sql->length(tmp_pos); - DBUG_PRINT("info",("spider exec_insert_sql->length=%u", - exec_insert_sql->length())); - DBUG_PRINT("info",("spider exec_insert_sql=%s", - exec_insert_sql->c_ptr_safe())); - } - if (nextval_pos) - { - memcpy((uchar *) exec_insert_sql->ptr() + nextval_pos, - oracle_share->nextval_str[all_link_idx].ptr(), - oracle_share->nextval_max_length); - } - } - if (sql_type & SPIDER_SQL_TYPE_BULK_UPDATE_SQL) - { - if (reading_from_bulk_tmp_table) - { - if ( - oracle_share->same_db_table_name && - share->link_statuses[all_link_idx] != SPIDER_LINK_STATUS_RECOVERY - ) { - exec_update_sql = &insert_sql; - } else if (!spider->result_list.upd_tmp_tbls[link_idx]) - { - DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM); - } else { - exec_update_sql = &spider->result_list.insert_sqls[link_idx]; - if ((error_num = restore_sql_from_bulk_tmp_table(exec_update_sql, - spider->result_list.upd_tmp_tbls[link_idx]))) - { - DBUG_RETURN(error_num); - } - } - } else { - if ( - oracle_share->same_db_table_name && - share->link_statuses[all_link_idx] != SPIDER_LINK_STATUS_RECOVERY - ) { - exec_update_sql = &update_sql; - } else { - exec_update_sql = &spider->result_list.update_sqls[link_idx]; - } - } - DBUG_PRINT("info",("spider exec_update_sql=%s", - exec_update_sql->c_ptr_safe())); - } else if (sql_type & - (SPIDER_SQL_TYPE_UPDATE_SQL | SPIDER_SQL_TYPE_DELETE_SQL)) - { - if (oracle_share->same_db_table_name || link_idx == first_link_idx) - exec_update_sql = &update_sql; - else { - exec_update_sql = &spider->result_list.update_sqls[link_idx]; - if (exec_update_sql->copy(update_sql)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - tmp_pos = exec_update_sql->length(); - exec_update_sql->length(table_name_pos); - append_table_name_with_adjusting(exec_update_sql, link_idx, - sql_type); - exec_update_sql->length(tmp_pos); - } - DBUG_PRINT("info",("spider exec_update_sql=%s", - exec_update_sql->c_ptr_safe())); - } - if (sql_type & SPIDER_SQL_TYPE_HANDLER) - { - if (spider->m_handler_id[link_idx] == ha_sql_handler_id) - exec_ha_sql = &ha_sql; - else { - exec_ha_sql = &result_list->sqls[link_idx]; - if (exec_ha_sql->copy(ha_sql)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - else { - tmp_pos = exec_ha_sql->length(); - exec_ha_sql->length(ha_table_name_pos); - append_table_name_with_adjusting(exec_ha_sql, link_idx, - SPIDER_SQL_TYPE_HANDLER); - exec_ha_sql->length(tmp_pos); - } - } - DBUG_PRINT("info",("spider exec_ha_sql=%s", - exec_ha_sql->c_ptr_safe())); - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::set_sql_for_exec( - spider_db_copy_table *tgt_ct, - ulong sql_type -) { - spider_oracle_copy_table *oracle_ct = (spider_oracle_copy_table *) tgt_ct; - DBUG_ENTER("spider_oracle_handler::set_sql_for_exec"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_INSERT_SQL: - exec_insert_sql = &oracle_ct->sql; - break; - default: - DBUG_ASSERT(0); - break; - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::execute_sql( - ulong sql_type, - SPIDER_CONN *conn, - int quick_mode, - int *need_mon -) { - spider_string *tgt_sql; - uint tgt_length; - DBUG_ENTER("spider_oracle_handler::execute_sql"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - DBUG_PRINT("info",("spider SPIDER_SQL_TYPE_SELECT_SQL")); - tgt_sql = exec_sql; - tgt_length = tgt_sql->length(); - if (table_lock_mode) - { - DBUG_PRINT("info",("spider table_lock_mode=%d", table_lock_mode)); - spider_db_oracle *db_conn = (spider_db_oracle *) conn->db_conn; - db_conn->table_lock_mode = table_lock_mode; - db_conn->exec_lock_sql = exec_lock_sql; - table_lock_mode = 0; - } - break; - case SPIDER_SQL_TYPE_INSERT_SQL: - DBUG_PRINT("info",("spider SPIDER_SQL_TYPE_SELECT_SQL")); - tgt_sql = exec_insert_sql; - tgt_length = tgt_sql->length(); - break; - case SPIDER_SQL_TYPE_UPDATE_SQL: - case SPIDER_SQL_TYPE_DELETE_SQL: - case SPIDER_SQL_TYPE_BULK_UPDATE_SQL: - DBUG_PRINT("info",("spider %s", - sql_type == SPIDER_SQL_TYPE_UPDATE_SQL ? "SPIDER_SQL_TYPE_UPDATE_SQL" : - sql_type == SPIDER_SQL_TYPE_DELETE_SQL ? "SPIDER_SQL_TYPE_DELETE_SQL" : - "SPIDER_SQL_TYPE_BULK_UPDATE_SQL" - )); - tgt_sql = exec_update_sql; - tgt_length = tgt_sql->length(); - break; - case SPIDER_SQL_TYPE_TMP_SQL: - DBUG_PRINT("info",("spider SPIDER_SQL_TYPE_TMP_SQL")); - tgt_sql = exec_tmp_sql; - tgt_length = tgt_sql->length(); - break; - case SPIDER_SQL_TYPE_DROP_TMP_TABLE_SQL: - DBUG_PRINT("info",("spider SPIDER_SQL_TYPE_DROP_TMP_TABLE_SQL")); - tgt_sql = exec_tmp_sql; - tgt_length = tmp_sql_pos5; - break; - case SPIDER_SQL_TYPE_HANDLER: - DBUG_PRINT("info",("spider SPIDER_SQL_TYPE_HANDLER")); - tgt_sql = exec_ha_sql; - tgt_length = tgt_sql->length(); - break; - default: - /* nothing to do */ - DBUG_PRINT("info",("spider default")); - DBUG_RETURN(0); - } - DBUG_RETURN(spider_db_query( - conn, - tgt_sql->ptr(), - tgt_length, - quick_mode, - need_mon - )); -} - -int spider_oracle_handler::reset() -{ - DBUG_ENTER("spider_oracle_handler::reset"); - DBUG_PRINT("info",("spider this=%p", this)); - update_sql.length(0); - DBUG_RETURN(0); -} - -int spider_oracle_handler::sts_mode_exchange( - int sts_mode -) { - DBUG_ENTER("spider_oracle_handler::sts_mode_exchange"); - DBUG_PRINT("info",("spider sts_mode=%d", sts_mode)); - DBUG_RETURN(1); -} - -int spider_oracle_handler::show_table_status( - int link_idx, - int sts_mode, - uint flag -) { - int error_num; - SPIDER_CONN *conn = spider->conns[link_idx]; - SPIDER_DB_RESULT *res; - SPIDER_SHARE *share = spider->share; - uint pos = (2 * spider->conn_link_idx[link_idx]); - ulonglong auto_increment_value = 0; - DBUG_ENTER("spider_oracle_handler::show_table_status"); - DBUG_PRINT("info",("spider sts_mode=%d", sts_mode)); - if ( - (flag & HA_STATUS_AUTO) && - (error_num = show_autoinc(link_idx)) - ) { - DBUG_RETURN(error_num); - } - - if (sts_mode == 1) - { - if (!share->stat.records) - share->stat.records = 10000; - share->stat.mean_rec_length = 65535; - share->stat.data_file_length = 65535; - share->stat.max_data_file_length = 65535; - share->stat.index_file_length = 65535; - share->stat.create_time = (time_t) 0; - share->stat.update_time = (time_t) 0; - share->stat.check_time = (time_t) 0; - } else { - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - spider_conn_set_timeout_from_share(conn, link_idx, - spider->wide_handler->trx->thd, - share); - if ( - (error_num = spider_db_set_names(spider, conn, link_idx)) || - ( - spider_db_query( - conn, - oracle_share->show_table_status[1 + pos].ptr(), - oracle_share->show_table_status[1 + pos].length(), - -1, - &spider->need_mons[link_idx]) && - (error_num = spider_db_errorno(conn)) - ) - ) { - if ( - error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM && - !conn->disable_reconnect - ) { - /* retry */ - if ((error_num = spider_db_ping(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } - if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } - spider_conn_set_timeout_from_share(conn, link_idx, - spider->wide_handler->trx->thd, - share); - if (spider_db_query( - conn, - oracle_share->show_table_status[1 + pos].ptr(), - oracle_share->show_table_status[1 + pos].length(), - -1, - &spider->need_mons[link_idx]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - } else { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } - } - st_spider_db_request_key request_key; - request_key.spider_thread_id = spider->wide_handler->trx->spider_thread_id; - request_key.query_id = spider->wide_handler->trx->thd->query_id; - request_key.handler = spider; - request_key.request_id = 1; - request_key.next = NULL; - if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - if (error_num || (error_num = spider_db_errorno(conn))) - DBUG_RETURN(error_num); - else - DBUG_RETURN(ER_QUERY_ON_FOREIGN_DATA_SOURCE); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - error_num = res->fetch_table_status( - sts_mode, - share->stat - ); - auto_increment_value = share->stat.auto_increment_value; - res->free_result(); - delete res; - if (error_num) - DBUG_RETURN(error_num); - } - if (auto_increment_value > share->lgtm_tblhnd_share->auto_increment_value) - { - share->lgtm_tblhnd_share->auto_increment_value = auto_increment_value; - DBUG_PRINT("info",("spider auto_increment_value=%llu", - share->lgtm_tblhnd_share->auto_increment_value)); - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::crd_mode_exchange( - int crd_mode -) { - DBUG_ENTER("spider_oracle_handler::crd_mode_exchange"); - DBUG_PRINT("info",("spider crd_mode=%d", crd_mode)); - DBUG_RETURN(1); -} - -int spider_oracle_handler::show_index( - int link_idx, - int crd_mode -) { - int error_num; - SPIDER_CONN *conn = spider->conns[link_idx]; - SPIDER_SHARE *share = spider->share; - TABLE *table = spider->get_table(); - SPIDER_DB_RESULT *res; - int roop_count; - longlong *tmp_cardinality; - uint pos = (2 * spider->conn_link_idx[link_idx]); - DBUG_ENTER("spider_oracle_handler::show_index"); - DBUG_PRINT("info",("spider crd_mode=%d", crd_mode)); - if (crd_mode == 1) - { - for (roop_count = 0, tmp_cardinality = share->cardinality; - roop_count < (int) table->s->fields; - roop_count++, tmp_cardinality++) - { - if (!spider_bit_is_set(share->cardinality_upd, roop_count)) - { - DBUG_PRINT("info", - ("spider init column cardinality id=%d", roop_count)); - *tmp_cardinality = 1; - } - } - } else { - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - spider_conn_set_timeout_from_share(conn, link_idx, - spider->wide_handler->trx->thd, - share); - if ( - (error_num = spider_db_set_names(spider, conn, link_idx)) || - ( - spider_db_query( - conn, - oracle_share->show_index[1 + pos].ptr(), - oracle_share->show_index[1 + pos].length(), - -1, - &spider->need_mons[link_idx]) && - (error_num = spider_db_errorno(conn)) - ) - ) { - if ( - error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM && - !conn->disable_reconnect - ) { - /* retry */ - if ((error_num = spider_db_ping(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } - if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } - spider_conn_set_timeout_from_share(conn, link_idx, - spider->wide_handler->trx->thd, - share); - if (spider_db_query( - conn, - oracle_share->show_index[1 + pos].ptr(), - oracle_share->show_index[1 + pos].length(), - -1, - &spider->need_mons[link_idx]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - } else { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } - } - st_spider_db_request_key request_key; - request_key.spider_thread_id = spider->wide_handler->trx->spider_thread_id; - request_key.query_id = spider->wide_handler->trx->thd->query_id; - request_key.handler = spider; - request_key.request_id = 1; - request_key.next = NULL; - if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num))) - { - if (error_num || (error_num = spider_db_errorno(conn))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } - /* no record is ok */ - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - if (res) - { - error_num = res->fetch_table_cardinality( - crd_mode, - table, - share->cardinality, - share->cardinality_upd, - share->bitmap_size - ); - } - for (roop_count = 0, tmp_cardinality = share->cardinality; - roop_count < (int) table->s->fields; - roop_count++, tmp_cardinality++) - { - if (!spider_bit_is_set(share->cardinality_upd, roop_count)) - { - DBUG_PRINT("info", - ("spider init column cardinality id=%d", roop_count)); - *tmp_cardinality = 1; - } - } - if (res) - { - res->free_result(); - delete res; - } - if (error_num) - DBUG_RETURN(error_num); - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::show_records( - int link_idx -) { - int error_num; - SPIDER_CONN *conn = spider->conns[link_idx]; - SPIDER_DB_RESULT *res; - SPIDER_SHARE *share = spider->share; - uint pos = spider->conn_link_idx[link_idx]; - DBUG_ENTER("spider_oracle_handler::show_records"); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - spider_conn_set_timeout_from_share(conn, link_idx, - spider->wide_handler->trx->thd, - share); - if ( - (error_num = spider_db_set_names(spider, conn, link_idx)) || - ( - spider_db_query( - conn, - oracle_share->show_records[pos].ptr(), - oracle_share->show_records[pos].length(), - -1, - &spider->need_mons[link_idx]) && - (error_num = spider_db_errorno(conn)) - ) - ) { - if ( - error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM && - !conn->disable_reconnect - ) { - /* retry */ - if ((error_num = spider_db_ping(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_PRINT("info", ("spider error_num=%d 1", error_num)); - DBUG_RETURN(error_num); - } - if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_PRINT("info", ("spider error_num=%d 2", error_num)); - DBUG_RETURN(error_num); - } - spider_conn_set_timeout_from_share(conn, link_idx, - spider->wide_handler->trx->thd, - share); - if (spider_db_query( - conn, - oracle_share->show_records[pos].ptr(), - oracle_share->show_records[pos].length(), - -1, - &spider->need_mons[link_idx]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_PRINT("info", ("spider error_num=%d 3", error_num)); - DBUG_RETURN(spider_db_errorno(conn)); - } - } else { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_PRINT("info", ("spider error_num=%d 4", error_num)); - DBUG_RETURN(error_num); - } - } - st_spider_db_request_key request_key; - request_key.spider_thread_id = spider->wide_handler->trx->spider_thread_id; - request_key.query_id = spider->wide_handler->trx->thd->query_id; - request_key.handler = spider; - request_key.request_id = 1; - request_key.next = NULL; - if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - if (error_num) - { - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_PRINT("info", ("spider error_num=%d 5", error_num)); - DBUG_RETURN(error_num); - } - else if (error_num || (error_num = spider_db_errorno(conn))) - { - DBUG_PRINT("info", ("spider error_num=%d 6", error_num)); - DBUG_RETURN(error_num); - } else { - DBUG_PRINT("info", ("spider error_num=%d 7", - ER_QUERY_ON_FOREIGN_DATA_SOURCE)); - DBUG_RETURN(ER_QUERY_ON_FOREIGN_DATA_SOURCE); - } - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - error_num = res->fetch_table_records( - 1, - spider->table_rows - ); - res->free_result(); - delete res; - if (error_num) - { - DBUG_PRINT("info", ("spider error_num=%d 7", error_num)); - DBUG_RETURN(error_num); - } - spider->wide_handler->trx->direct_aggregate_count++; - DBUG_RETURN(0); -} - -int spider_oracle_handler::show_autoinc( - int link_idx -) { - int error_num; - SPIDER_CONN *conn = spider->conns[link_idx]; - SPIDER_DB_RESULT *res; - SPIDER_SHARE *share = spider->share; - uint pos = spider->conn_link_idx[link_idx]; - ulonglong auto_increment_value; - DBUG_ENTER("spider_oracle_handler::show_autoinc"); - if (!oracle_share->show_autoinc) - DBUG_RETURN(0); - - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - spider_conn_set_timeout_from_share(conn, link_idx, - spider->wide_handler->trx->thd, - share); - if ( - (error_num = spider_db_set_names(spider, conn, link_idx)) || - ( - spider_db_query( - conn, - oracle_share->show_autoinc[pos].ptr(), - oracle_share->show_autoinc[pos].length(), - -1, - &spider->need_mons[link_idx]) && - (error_num = spider_db_errorno(conn)) - ) - ) { - if ( - error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM && - !conn->disable_reconnect - ) { - /* retry */ - if ((error_num = spider_db_ping(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_PRINT("info", ("spider error_num=%d 1", error_num)); - DBUG_RETURN(error_num); - } - if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_PRINT("info", ("spider error_num=%d 2", error_num)); - DBUG_RETURN(error_num); - } - spider_conn_set_timeout_from_share(conn, link_idx, - spider->wide_handler->trx->thd, - share); - if (spider_db_query( - conn, - oracle_share->show_records[pos].ptr(), - oracle_share->show_records[pos].length(), - -1, - &spider->need_mons[link_idx]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_PRINT("info", ("spider error_num=%d 3", error_num)); - DBUG_RETURN(spider_db_errorno(conn)); - } - } else { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_PRINT("info", ("spider error_num=%d 4", error_num)); - DBUG_RETURN(error_num); - } - } - st_spider_db_request_key request_key; - request_key.spider_thread_id = spider->wide_handler->trx->spider_thread_id; - request_key.query_id = spider->wide_handler->trx->thd->query_id; - request_key.handler = spider; - request_key.request_id = 1; - request_key.next = NULL; - if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - if (error_num) - { - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_PRINT("info", ("spider error_num=%d 5", error_num)); - DBUG_RETURN(error_num); - } - else if ((error_num = spider_db_errorno(conn))) - { - DBUG_PRINT("info", ("spider error_num=%d 6", error_num)); - DBUG_RETURN(error_num); - } else { - DBUG_PRINT("info", ("spider error_num=%d 7", - ER_QUERY_ON_FOREIGN_DATA_SOURCE)); - DBUG_RETURN(ER_QUERY_ON_FOREIGN_DATA_SOURCE); - } - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - error_num = res->fetch_table_records( - 1, - auto_increment_value - ); - res->free_result(); - delete res; - if (error_num) - { - DBUG_PRINT("info", ("spider error_num=%d 7", error_num)); - DBUG_RETURN(error_num); - } - if (auto_increment_value >= - share->lgtm_tblhnd_share->auto_increment_value) - { - share->lgtm_tblhnd_share->auto_increment_value = - auto_increment_value + 1; - DBUG_PRINT("info",("spider auto_increment_value=%llu", - share->lgtm_tblhnd_share->auto_increment_value)); - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::show_last_insert_id( - int link_idx, - ulonglong &last_insert_id -) { - int error_num; - SPIDER_CONN *conn = spider->conns[link_idx]; - SPIDER_DB_RESULT *res; - uint pos = spider->conn_link_idx[link_idx]; - spider_db_oracle *db_oracle = (spider_db_oracle *) conn->db_conn; - DBUG_ENTER("spider_oracle_handler::show_last_insert_id"); - if (!oracle_share->show_last_insert_id) - { - DBUG_ASSERT(0); - last_insert_id = 0; - db_oracle->stored_last_insert_id = 0; - DBUG_RETURN(0); - } - - if ( - spider_db_query( - conn, - oracle_share->show_last_insert_id[pos].ptr(), - oracle_share->show_last_insert_id[pos].length(), - -1, - &spider->need_mons[link_idx]) && - (error_num = spider_db_errorno(conn)) - ) { - DBUG_PRINT("info", ("spider error_num=%d 4", error_num)); - DBUG_RETURN(error_num); - } - st_spider_db_request_key request_key; - request_key.spider_thread_id = spider->wide_handler->trx->spider_thread_id; - request_key.query_id = spider->wide_handler->trx->thd->query_id; - request_key.handler = spider; - request_key.request_id = 1; - request_key.next = NULL; - if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num))) - { - if (error_num || (error_num = spider_db_errorno(conn))) - { - DBUG_PRINT("info", ("spider error_num=%d 5", error_num)); - DBUG_RETURN(error_num); - } else { - DBUG_PRINT("info", ("spider error_num=%d 6", - ER_QUERY_ON_FOREIGN_DATA_SOURCE)); - DBUG_RETURN(ER_QUERY_ON_FOREIGN_DATA_SOURCE); - } - } - error_num = res->fetch_table_records( - 1, - last_insert_id - ); - res->free_result(); - delete res; - if (error_num) - { - DBUG_PRINT("info", ("spider error_num=%d 7", error_num)); - DBUG_RETURN(error_num); - } - db_oracle->stored_last_insert_id = last_insert_id; - DBUG_RETURN(0); -} - -ha_rows spider_oracle_handler::explain_select( - const key_range *start_key, - const key_range *end_key, - int link_idx -) { - int error_num; - SPIDER_CONN *conn = spider->conns[link_idx]; - SPIDER_RESULT_LIST *result_list = &spider->result_list; - spider_string *str = &result_list->sqls[link_idx]; - SPIDER_DB_RESULT *res; - ha_rows rows; - spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id]; - DBUG_ENTER("spider_oracle_handler::explain_select"); - if ((error_num = dbton_hdl->append_explain_select_part( - start_key, end_key, SPIDER_SQL_TYPE_OTHER_SQL, link_idx))) - { - my_errno = error_num; - DBUG_RETURN(HA_POS_ERROR); - } - - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - spider_conn_set_timeout_from_share(conn, link_idx, - spider->wide_handler->trx->thd, - spider->share); - if ( - (error_num = spider_db_set_names(spider, conn, link_idx)) || - ( - spider_db_query( - conn, - str->ptr(), - str->length(), - -1, - &spider->need_mons[link_idx]) && - (error_num = spider_db_errorno(conn)) - ) - ) { - if ( - error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM && - !conn->disable_reconnect - ) { - /* retry */ - if ((error_num = spider_db_ping(spider, conn, link_idx))) - { - if (spider->check_error_mode(error_num)) - my_errno = error_num; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(HA_POS_ERROR); - } - if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - if (spider->check_error_mode(error_num)) - my_errno = error_num; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(HA_POS_ERROR); - } - spider_conn_set_timeout_from_share(conn, link_idx, - spider->wide_handler->trx->thd, - spider->share); - if (spider_db_query( - conn, - str->ptr(), - str->length(), - -1, - &spider->need_mons[link_idx]) - ) { - error_num = spider_db_errorno(conn); - if (spider->check_error_mode(error_num)) - my_errno = error_num; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(HA_POS_ERROR); - } - } else { - if (spider->check_error_mode(error_num)) - my_errno = error_num; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(HA_POS_ERROR); - } - } - st_spider_db_request_key request_key; - request_key.spider_thread_id = spider->wide_handler->trx->spider_thread_id; - request_key.query_id = spider->wide_handler->trx->thd->query_id; - request_key.handler = spider; - request_key.request_id = 1; - request_key.next = NULL; - if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num))) - { - if (error_num || (error_num = spider_db_errorno(conn))) - { - if (spider->check_error_mode(error_num)) - my_errno = error_num; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(HA_POS_ERROR); - } else { - my_errno = ER_QUERY_ON_FOREIGN_DATA_SOURCE; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(HA_POS_ERROR); - } - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - error_num = res->fetch_table_records( - 2, - rows - ); - res->free_result(); - delete res; - if (error_num) - { - my_errno = error_num; - DBUG_RETURN(HA_POS_ERROR); - } - DBUG_RETURN(rows); -} - -int spider_oracle_handler::lock_tables( - int link_idx -) { - int error_num; - SPIDER_CONN *conn = spider->conns[link_idx]; - spider_string *str = &sql; - DBUG_ENTER("spider_oracle_handler::lock_tables"); - do { - str->length(0); - if ((error_num = conn->db_conn->append_lock_tables(str))) - { - DBUG_RETURN(error_num); - } - if (str->length()) - { - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } - spider_conn_set_timeout_from_share(conn, link_idx, - spider->wide_handler->trx->thd, - spider->share); - if (spider_db_query( - conn, - str->ptr(), - str->length(), - -1, - &spider->need_mons[link_idx]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - } - if (!conn->table_locked) - { - conn->table_locked = TRUE; - spider->wide_handler->trx->locked_connections++; - } - } while (str->length()); - DBUG_RETURN(0); -} - -int spider_oracle_handler::unlock_tables( - int link_idx -) { - int error_num; - SPIDER_CONN *conn = spider->conns[link_idx]; - DBUG_ENTER("spider_oracle_handler::unlock_tables"); - if (conn->table_locked) - { - if ((error_num = conn->db_conn->commit(&spider->need_mons[link_idx]))) - { - DBUG_RETURN(error_num); - } - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::disable_keys( - SPIDER_CONN *conn, - int link_idx -) { - int error_num; - SPIDER_SHARE *share = spider->share; - spider_string *str = &spider->result_list.sqls[link_idx]; - DBUG_ENTER("spider_oracle_handler::disable_keys"); - DBUG_PRINT("info",("spider this=%p", this)); - str->length(0); - if ((error_num = append_disable_keys_part(SPIDER_SQL_TYPE_OTHER_HS, - link_idx))) - { - DBUG_RETURN(error_num); - } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } - spider_conn_set_timeout_from_share(conn, link_idx, - spider->wide_handler->trx->thd, - share); - if (spider_db_query( - conn, - str->ptr(), - str->length(), - -1, - &spider->need_mons[link_idx]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); - DBUG_RETURN(error_num); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); -} - -int spider_oracle_handler::enable_keys( - SPIDER_CONN *conn, - int link_idx -) { - int error_num; - SPIDER_SHARE *share = spider->share; - spider_string *str = &spider->result_list.sqls[link_idx]; - DBUG_ENTER("spider_oracle_handler::enable_keys"); - DBUG_PRINT("info",("spider this=%p", this)); - str->length(0); - if ((error_num = append_enable_keys_part(SPIDER_SQL_TYPE_OTHER_HS, - link_idx))) - { - DBUG_RETURN(error_num); - } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } - spider_conn_set_timeout_from_share(conn, link_idx, - spider->wide_handler->trx->thd, - share); - if (spider_db_query( - conn, - str->ptr(), - str->length(), - -1, - &spider->need_mons[link_idx]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); - DBUG_RETURN(error_num); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); -} - -int spider_oracle_handler::check_table( - SPIDER_CONN *conn, - int link_idx, - HA_CHECK_OPT* check_opt -) { - int error_num; - SPIDER_SHARE *share = spider->share; - spider_string *str = &spider->result_list.sqls[link_idx]; - DBUG_ENTER("spider_oracle_handler::check_table"); - DBUG_PRINT("info",("spider this=%p", this)); - str->length(0); - if ((error_num = append_check_table_part(SPIDER_SQL_TYPE_OTHER_HS, - link_idx, check_opt))) - { - DBUG_RETURN(error_num); - } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } - spider_conn_set_timeout_from_share(conn, link_idx, - spider->wide_handler->trx->thd, - share); - if (spider_db_query( - conn, - str->ptr(), - str->length(), - -1, - &spider->need_mons[link_idx]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); - DBUG_RETURN(error_num); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); -} - -int spider_oracle_handler::repair_table( - SPIDER_CONN *conn, - int link_idx, - HA_CHECK_OPT* check_opt -) { - int error_num; - SPIDER_SHARE *share = spider->share; - spider_string *str = &spider->result_list.sqls[link_idx]; - DBUG_ENTER("spider_oracle_handler::repair_table"); - DBUG_PRINT("info",("spider this=%p", this)); - str->length(0); - if ((error_num = append_repair_table_part(SPIDER_SQL_TYPE_OTHER_HS, - link_idx, check_opt))) - { - DBUG_RETURN(error_num); - } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } - spider_conn_set_timeout_from_share(conn, link_idx, - spider->wide_handler->trx->thd, - share); - if (spider_db_query( - conn, - str->ptr(), - str->length(), - -1, - &spider->need_mons[link_idx]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); - DBUG_RETURN(error_num); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); -} - -int spider_oracle_handler::analyze_table( - SPIDER_CONN *conn, - int link_idx -) { - int error_num; - SPIDER_SHARE *share = spider->share; - spider_string *str = &spider->result_list.sqls[link_idx]; - DBUG_ENTER("spider_oracle_handler::analyze_table"); - DBUG_PRINT("info",("spider this=%p", this)); - str->length(0); - if ((error_num = append_analyze_table_part(SPIDER_SQL_TYPE_OTHER_HS, - link_idx))) - { - DBUG_RETURN(error_num); - } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } - spider_conn_set_timeout_from_share(conn, link_idx, - spider->wide_handler->trx->thd, - share); - if (spider_db_query( - conn, - str->ptr(), - str->length(), - -1, - &spider->need_mons[link_idx]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); - DBUG_RETURN(error_num); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); -} - -int spider_oracle_handler::optimize_table( - SPIDER_CONN *conn, - int link_idx -) { - int error_num; - SPIDER_SHARE *share = spider->share; - spider_string *str = &spider->result_list.sqls[link_idx]; - DBUG_ENTER("spider_oracle_handler::optimize_table"); - DBUG_PRINT("info",("spider this=%p", this)); - str->length(0); - if ((error_num = append_optimize_table_part(SPIDER_SQL_TYPE_OTHER_HS, - link_idx))) - { - DBUG_RETURN(error_num); - } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } - spider_conn_set_timeout_from_share(conn, link_idx, - spider->wide_handler->trx->thd, - share); - if (spider_db_query( - conn, - str->ptr(), - str->length(), - -1, - &spider->need_mons[link_idx]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); - DBUG_RETURN(error_num); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); -} - -int spider_oracle_handler::flush_tables( - SPIDER_CONN *conn, - int link_idx, - bool lock -) { - int error_num; - SPIDER_SHARE *share = spider->share; - spider_string *str = &spider->result_list.sqls[link_idx]; - DBUG_ENTER("spider_oracle_handler::flush_tables"); - DBUG_PRINT("info",("spider this=%p", this)); - str->length(0); - if ((error_num = append_flush_tables_part(SPIDER_SQL_TYPE_OTHER_HS, - link_idx, lock))) - { - DBUG_RETURN(error_num); - } - spider_conn_set_timeout_from_share(conn, link_idx, - spider->wide_handler->trx->thd, - share); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - str->ptr(), - str->length(), - -1, - &spider->need_mons[link_idx]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); - DBUG_RETURN(error_num); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); -} - -int spider_oracle_handler::flush_logs( - SPIDER_CONN *conn, - int link_idx -) { - int error_num; - SPIDER_SHARE *share = spider->share; - DBUG_ENTER("spider_oracle_handler::flush_logs"); - DBUG_PRINT("info",("spider this=%p", this)); - spider_conn_set_timeout_from_share(conn, link_idx, - spider->wide_handler->trx->thd, - share); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - SPIDER_SQL_FLUSH_LOGS_STR, - SPIDER_SQL_FLUSH_LOGS_LEN, - -1, - &spider->need_mons[link_idx]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); - DBUG_RETURN(error_num); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); -} - -int spider_oracle_handler::insert_opened_handler( - SPIDER_CONN *conn, - int link_idx -) { - spider_db_oracle *db_conn = (spider_db_oracle *) conn->db_conn; - SPIDER_LINK_FOR_HASH *tmp_link_for_hash = &link_for_hash[link_idx]; - DBUG_ASSERT(tmp_link_for_hash->spider == spider); - DBUG_ASSERT(tmp_link_for_hash->link_idx == link_idx); - uint old_elements = db_conn->handler_open_array.max_element; - DBUG_ENTER("spider_oracle_handler::insert_opened_handler"); - DBUG_PRINT("info",("spider this=%p", this)); - if (insert_dynamic(&db_conn->handler_open_array, - (uchar*) &tmp_link_for_hash)) - { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - if (db_conn->handler_open_array.max_element > old_elements) - { - spider_alloc_calc_mem(spider_current_trx, - db_conn->handler_open_array, - (db_conn->handler_open_array.max_element - old_elements) * - db_conn->handler_open_array.size_of_element); - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::delete_opened_handler( - SPIDER_CONN *conn, - int link_idx -) { - spider_db_oracle *db_conn = (spider_db_oracle *) conn->db_conn; - uint roop_count, elements = db_conn->handler_open_array.elements; - SPIDER_LINK_FOR_HASH *tmp_link_for_hash; - DBUG_ENTER("spider_oracle_handler::delete_opened_handler"); - DBUG_PRINT("info",("spider this=%p", this)); - for (roop_count = 0; roop_count < elements; roop_count++) - { - get_dynamic(&db_conn->handler_open_array, (uchar *) &tmp_link_for_hash, - roop_count); - if (tmp_link_for_hash == &link_for_hash[link_idx]) - { - delete_dynamic_element(&db_conn->handler_open_array, roop_count); - break; - } - } - DBUG_ASSERT(roop_count < elements); - DBUG_RETURN(0); -} - -int spider_oracle_handler::sync_from_clone_source( - spider_db_handler *dbton_hdl -) { - DBUG_ENTER("spider_oracle_handler::sync_from_clone_source"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(0); -} - -bool spider_oracle_handler::support_use_handler( - int use_handler -) { - DBUG_ENTER("spider_oracle_handler::support_use_handler"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(FALSE); -} - -void spider_oracle_handler::minimum_select_bitmap_create() -{ - TABLE *table = spider->get_table(); - Field **field_p; - DBUG_ENTER("spider_oracle_handler::minimum_select_bitmap_create"); - memset(minimum_select_bitmap, 0, no_bytes_in_map(table->read_set)); - if ( - spider->use_index_merge || - spider->is_clone - ) { - /* need preparing for cmp_ref */ - TABLE_SHARE *table_share = table->s; - if ( - table_share->primary_key == MAX_KEY - ) { - /* need all columns */ - memset(minimum_select_bitmap, 0xFF, no_bytes_in_map(table->read_set)); - DBUG_VOID_RETURN; - } else { - /* need primary key columns */ - uint roop_count; - KEY *key_info; - KEY_PART_INFO *key_part; - Field *field; - key_info = &table_share->key_info[table_share->primary_key]; - key_part = key_info->key_part; - for (roop_count = 0; - roop_count < spider_user_defined_key_parts(key_info); - roop_count++) - { - field = key_part[roop_count].field; - spider_set_bit(minimum_select_bitmap, field->field_index); - } - } - } - for (field_p = table->field; *field_p; field_p++) - { - uint field_index = (*field_p)->field_index; - if ( - spider_bit_is_set(spider->searched_bitmap, field_index) || - bitmap_is_set(table->read_set, field_index) || - bitmap_is_set(table->write_set, field_index) - ) { - spider_set_bit(minimum_select_bitmap, field_index); - } - } - DBUG_VOID_RETURN; -} - -bool spider_oracle_handler::minimum_select_bit_is_set( - uint field_index -) { - DBUG_ENTER("spider_oracle_handler::minimum_select_bit_is_set"); - DBUG_PRINT("info",("spider field_index=%u", field_index)); - DBUG_PRINT("info",("spider minimum_select_bitmap=%s", - spider_bit_is_set(minimum_select_bitmap, field_index) ? - "TRUE" : "FALSE")); - DBUG_RETURN(spider_bit_is_set(minimum_select_bitmap, field_index)); -} - -void spider_oracle_handler::copy_minimum_select_bitmap( - uchar *bitmap -) { - int roop_count; - TABLE *table = spider->get_table(); - DBUG_ENTER("spider_oracle_handler::copy_minimum_select_bitmap"); - for (roop_count = 0; - roop_count < (int) ((table->s->fields + 7) / 8); - roop_count++) - { - bitmap[roop_count] = - minimum_select_bitmap[roop_count]; - DBUG_PRINT("info",("spider roop_count=%d", roop_count)); - DBUG_PRINT("info",("spider bitmap=%d", - bitmap[roop_count])); - } - DBUG_VOID_RETURN; -} - -int spider_oracle_handler::init_union_table_name_pos() -{ - DBUG_ENTER("spider_oracle_handler::init_union_table_name_pos"); - DBUG_PRINT("info",("spider this=%p", this)); - if (!union_table_name_pos_first) - { - if (!spider_bulk_malloc(spider_current_trx, SPD_MID_ORACLE_HANDLER_INIT_UNION_TABLE_NAME_POS_1, MYF(MY_WME), - &union_table_name_pos_first, (uint) (sizeof(SPIDER_INT_HLD)), - NullS) - ) { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - union_table_name_pos_first->next = NULL; - } - union_table_name_pos_current = union_table_name_pos_first; - union_table_name_pos_current->tgt_num = 0; - DBUG_RETURN(0); -} - -int spider_oracle_handler::set_union_table_name_pos() -{ - DBUG_ENTER("spider_oracle_handler::set_union_table_name_pos"); - DBUG_PRINT("info",("spider this=%p", this)); - if (union_table_name_pos_current->tgt_num >= SPIDER_INT_HLD_TGT_SIZE) - { - if (!union_table_name_pos_current->next) - { - if (!spider_bulk_malloc(spider_current_trx, SPD_MID_ORACLE_HANDLER_SET_UNION_TABLE_NAME_POS_1, MYF(MY_WME), - &union_table_name_pos_current->next, (uint) (sizeof(SPIDER_INT_HLD)), - NullS) - ) { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - union_table_name_pos_current->next->next = NULL; - } - union_table_name_pos_current = union_table_name_pos_current->next; - union_table_name_pos_current->tgt_num = 0; - } - union_table_name_pos_current->tgt[union_table_name_pos_current->tgt_num] = - table_name_pos; - ++union_table_name_pos_current->tgt_num; - DBUG_RETURN(0); -} - -int spider_oracle_handler::reset_union_table_name( - spider_string *str, - int link_idx, - ulong sql_type -) { - DBUG_ENTER("spider_oracle_handler::reset_union_table_name"); - DBUG_PRINT("info",("spider this=%p", this)); - if (!union_table_name_pos_current) - DBUG_RETURN(0); - - SPIDER_INT_HLD *tmp_pos = union_table_name_pos_first; - uint cur_num, pos_backup = str->length(); - while(TRUE) - { - for (cur_num = 0; cur_num < tmp_pos->tgt_num; ++cur_num) - { - str->length(tmp_pos->tgt[cur_num]); - append_table_name_with_adjusting(str, link_idx, sql_type); - } - if (tmp_pos == union_table_name_pos_current) - break; - tmp_pos = tmp_pos->next; - } - str->length(pos_backup); - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_from_and_tables_part( - spider_fields *fields, - ulong sql_type -) { - int error_num; - spider_string *str; - SPIDER_TABLE_HOLDER *table_holder; - TABLE_LIST *table_list; - DBUG_ENTER("spider_oracle_handler::append_from_and_tables_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - break; - default: - DBUG_RETURN(0); - } - fields->set_pos_to_first_table_holder(); - table_holder = fields->get_next_table_holder(); - table_list = table_holder->table->pos_in_table_list; - error_num = spider_db_oracle_utility.append_from_and_tables(fields, str, - table_list); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::reappend_tables_part( - spider_fields *fields, - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::reappend_tables_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - break; - default: - DBUG_RETURN(0); - } - error_num = spider_db_oracle_utility.reappend_tables(fields, - link_idx_chain, str); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_where_part( - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_where_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - break; - default: - DBUG_RETURN(0); - } - error_num = spider_db_oracle_utility.append_where(str); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_having_part( - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_having_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - break; - default: - DBUG_RETURN(0); - } - error_num = spider_db_oracle_utility.append_having(str); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_item_type_part( - Item *item, - const char *alias, - uint alias_length, - bool use_fields, - spider_fields *fields, - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_item_type_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - break; - default: - DBUG_RETURN(0); - } - error_num = spider_db_print_item_type(item, NULL, spider, str, - alias, alias_length, spider_dbton_oracle.dbton_id, use_fields, fields); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_list_item_select_part( - List *select, - const char *alias, - uint alias_length, - bool use_fields, - spider_fields *fields, - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_list_item_select_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_list_item_select(select, str, alias, alias_length, - use_fields, fields); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_list_item_select( - List *select, - spider_string *str, - const char *alias, - uint alias_length, - bool use_fields, - spider_fields *fields -) { - int error_num; - uint dbton_id = spider_dbton_oracle.dbton_id, length; - uint32 begin; - List_iterator_fast it(*select); - Item *item; - Field *field; - const char *item_name; - DBUG_ENTER("spider_oracle_handler::append_list_item_select"); - DBUG_PRINT("info",("spider this=%p", this)); - begin = str->length(); - while ((item = it++)) - { - if (item->const_item()) - { - DBUG_PRINT("info",("spider const item")); - continue; - } - if ((error_num = spider_db_print_item_type(item, NULL, spider, str, - alias, alias_length, dbton_id, use_fields, fields))) - { - DBUG_RETURN(error_num); - } - field = *(fields->get_next_field_ptr()); - if (field) - { - item_name = SPIDER_field_name_str(field); - length = SPIDER_field_name_length(field); - } else { - item_name = SPIDER_item_name_str(item); - length = SPIDER_item_name_length(item); - } - if (str->reserve( - SPIDER_SQL_COMMA_LEN + /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + - SPIDER_SQL_SPACE_LEN + length - )) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN); - if ((error_num = spider_db_oracle_utility.append_escaped_name(str, - item_name, length))) - { - DBUG_RETURN(error_num); - } - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - if (begin == str->length()) - { - /* no columns */ - if (str->reserve(SPIDER_SQL_ONE_LEN)) - { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - str->q_append(SPIDER_SQL_ONE_STR, SPIDER_SQL_ONE_LEN); - } else { - str->length(str->length() - SPIDER_SQL_COMMA_LEN); - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_group_by_part( - ORDER *order, - const char *alias, - uint alias_length, - bool use_fields, - spider_fields *fields, - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_group_by_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_group_by(order, str, alias, alias_length, - use_fields, fields); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_group_by( - ORDER *order, - spider_string *str, - const char *alias, - uint alias_length, - bool use_fields, - spider_fields *fields -) { - int error_num; - uint dbton_id = spider_dbton_oracle.dbton_id; - DBUG_ENTER("spider_oracle_handler::append_group_by"); - DBUG_PRINT("info",("spider this=%p", this)); - if (order) - { - if (str->reserve(SPIDER_SQL_GROUP_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_GROUP_STR, SPIDER_SQL_GROUP_LEN); - for (; order; order = order->next) - { - if ((error_num = spider_db_print_item_type((*order->item), NULL, spider, - str, alias, alias_length, dbton_id, use_fields, fields))) - { - DBUG_RETURN(error_num); - } - if (str->reserve(SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - str->length(str->length() - SPIDER_SQL_COMMA_LEN); - } - DBUG_RETURN(0); -} - -int spider_oracle_handler::append_order_by_part( - ORDER *order, - const char *alias, - uint alias_length, - bool use_fields, - spider_fields *fields, - ulong sql_type -) { - int error_num; - spider_string *str; - DBUG_ENTER("spider_oracle_handler::append_order_by_part"); - DBUG_PRINT("info",("spider this=%p", this)); - switch (sql_type) - { - case SPIDER_SQL_TYPE_SELECT_SQL: - str = &sql; - break; - default: - DBUG_RETURN(0); - } - error_num = append_order_by(order, str, alias, alias_length, - use_fields, fields); - DBUG_RETURN(error_num); -} - -int spider_oracle_handler::append_order_by( - ORDER *order, - spider_string *str, - const char *alias, - uint alias_length, - bool use_fields, - spider_fields *fields -) { - int error_num; - uint dbton_id = spider_dbton_oracle.dbton_id; - DBUG_ENTER("spider_oracle_handler::append_order_by"); - DBUG_PRINT("info",("spider this=%p", this)); - if (order) - { - if (str->reserve(SPIDER_SQL_ORDER_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_ORDER_STR, SPIDER_SQL_ORDER_LEN); - for (; order; order = order->next) - { - if ((error_num = spider_db_print_item_type((*order->item), NULL, spider, - str, alias, alias_length, dbton_id, use_fields, fields))) - { - DBUG_RETURN(error_num); - } -#ifdef SPIDER_ORDER_HAS_ENUM_ORDER - if (order->direction == ORDER::ORDER_DESC) -#else - if (!order->asc) -#endif - { - if (str->reserve(SPIDER_SQL_COMMA_LEN + SPIDER_SQL_DESC_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_DESC_STR, SPIDER_SQL_DESC_LEN); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } else { - if (str->reserve(SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - } - str->length(str->length() - SPIDER_SQL_COMMA_LEN); - } - DBUG_RETURN(0); -} - -spider_oracle_copy_table::spider_oracle_copy_table( - spider_oracle_share *db_share -) : spider_db_copy_table( - db_share -), - oracle_share(db_share), - pos(0), - table_name_pos(0), - pos_diff(0), - table_lock_mode(0), - select_rownum_appended(FALSE), - first_str(NULL), - current_str(NULL) -{ - DBUG_ENTER("spider_oracle_copy_table::spider_oracle_copy_table"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_VOID_RETURN; -} - -spider_oracle_copy_table::~spider_oracle_copy_table() -{ - DBUG_ENTER("spider_oracle_copy_table::~spider_oracle_copy_table"); - DBUG_PRINT("info",("spider this=%p", this)); - while (first_str) - { - current_str = first_str; - first_str = first_str->next; - delete [] current_str; - } - DBUG_VOID_RETURN; -} - -int spider_oracle_copy_table::init() -{ - DBUG_ENTER("spider_oracle_copy_table::init"); - DBUG_PRINT("info",("spider this=%p", this)); - sql.init_calc_mem(SPD_MID_ORACLE_COPY_TABLE_INIT_1); - sql_part.init_calc_mem(SPD_MID_ORACLE_COPY_TABLE_INIT_2); - DBUG_RETURN(0); -} - -void spider_oracle_copy_table::set_sql_charset( - CHARSET_INFO *cs -) { - DBUG_ENTER("spider_oracle_copy_table::set_sql_charset"); - DBUG_PRINT("info",("spider this=%p", this)); - sql.set_charset(cs); - DBUG_VOID_RETURN; -} - -int spider_oracle_copy_table::append_select_str() -{ - DBUG_ENTER("spider_oracle_copy_table::append_select_str"); - DBUG_PRINT("info",("spider this=%p", this)); - if (sql.reserve(SPIDER_SQL_SELECT_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql.q_append(SPIDER_SQL_SELECT_STR, SPIDER_SQL_SELECT_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_copy_table::append_insert_str( - int insert_flg -) { - DBUG_ENTER("spider_oracle_copy_table::append_insert_str"); - DBUG_PRINT("info",("spider this=%p", this)); - if (sql.reserve(SPIDER_SQL_INSERT_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql.q_append(SPIDER_SQL_INSERT_STR, SPIDER_SQL_INSERT_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_copy_table::append_table_columns( - TABLE_SHARE *table_share -) { - int error_num; - Field **field; - DBUG_ENTER("spider_oracle_copy_table::append_table_columns"); - DBUG_PRINT("info",("spider this=%p", this)); - for (field = table_share->field; *field; field++) - { - if (sql.reserve(SPIDER_SQL_NAME_QUOTE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql.q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); - if ((error_num = spider_db_append_name_with_quote_str(&sql, - (*field)->field_name, spider_dbton_oracle.dbton_id))) - DBUG_RETURN(error_num); - if (sql.reserve(SPIDER_SQL_NAME_QUOTE_LEN + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql.q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); - sql.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - sql.length(sql.length() - SPIDER_SQL_COMMA_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_copy_table::append_from_str() -{ - DBUG_ENTER("spider_oracle_copy_table::append_from_str"); - DBUG_PRINT("info",("spider this=%p", this)); - if (sql.reserve(SPIDER_SQL_FROM_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql.q_append(SPIDER_SQL_FROM_STR, SPIDER_SQL_FROM_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_copy_table::append_table_name( - int link_idx -) { - int error_num; - DBUG_ENTER("spider_oracle_copy_table::append_table_name"); - DBUG_PRINT("info",("spider this=%p", this)); - table_name_pos = sql.length(); - error_num = oracle_share->append_table_name(&sql, link_idx); - store_link_idx = link_idx; - DBUG_RETURN(error_num); -} - -void spider_oracle_copy_table::set_sql_pos() -{ - DBUG_ENTER("spider_oracle_copy_table::set_sql_pos"); - DBUG_PRINT("info",("spider this=%p", this)); - pos = sql.length(); - DBUG_VOID_RETURN; -} - -void spider_oracle_copy_table::set_sql_to_pos() -{ - DBUG_ENTER("spider_oracle_copy_table::set_sql_to_pos"); - DBUG_PRINT("info",("spider this=%p", this)); - sql.length(pos); - DBUG_VOID_RETURN; -} - -int spider_oracle_copy_table::append_copy_where( - spider_db_copy_table *source_ct, - KEY *key_info, - ulong *last_row_pos, - ulong *last_lengths -) { - int error_num, roop_count, roop_count2; - DBUG_ENTER("spider_oracle_copy_table::append_copy_where"); - DBUG_PRINT("info",("spider this=%p", this)); - if (sql.reserve(SPIDER_SQL_WHERE_LEN + SPIDER_SQL_OPEN_PAREN_LEN)) - { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - sql.q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN); - sql.q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN); - Field *field; - KEY_PART_INFO *key_part = key_info->key_part; - for (roop_count = spider_user_defined_key_parts(key_info) - 1; - roop_count >= 0; roop_count--) - { - for (roop_count2 = 0; roop_count2 < roop_count; roop_count2++) - { - field = key_part[roop_count2].field; - if ((error_num = copy_key_row(source_ct, - field, &last_row_pos[field->field_index], - &last_lengths[field->field_index], - SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN))) - { - DBUG_RETURN(error_num); - } - } - field = key_part[roop_count2].field; - if ((error_num = copy_key_row(source_ct, - field, &last_row_pos[field->field_index], - &last_lengths[field->field_index], - SPIDER_SQL_GT_STR, SPIDER_SQL_GT_LEN))) - { - DBUG_RETURN(error_num); - } - sql.length(sql.length() - SPIDER_SQL_AND_LEN); - if (sql.reserve(SPIDER_SQL_CLOSE_PAREN_LEN + - SPIDER_SQL_OR_LEN + SPIDER_SQL_OPEN_PAREN_LEN)) - { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - sql.q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN); - sql.q_append(SPIDER_SQL_OR_STR, SPIDER_SQL_OR_LEN); - sql.q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN); - } - sql.length(sql.length() - SPIDER_SQL_OR_LEN - SPIDER_SQL_OPEN_PAREN_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_copy_table::append_key_order_str( - KEY *key_info, - int start_pos, - bool desc_flg -) { - int length, error_num; - KEY_PART_INFO *key_part; - Field *field; - DBUG_ENTER("spider_oracle_copy_table::append_key_order_str"); - DBUG_PRINT("info",("spider this=%p", this)); - if (select_rownum_appended) - { - if (sql.reserve(SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql.q_append(SPIDER_SQL_SELECT_WRAPPER_TAIL_STR, - SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN); - DBUG_RETURN(0); - } - sql_part.length(0); - if (sql_part.reserve(sql.length() + SPIDER_SQL_SELECT_WRAPPER_HEAD_LEN + - SPIDER_SQL_ROW_NUMBER_HEAD_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(SPIDER_SQL_SELECT_WRAPPER_HEAD_STR, - SPIDER_SQL_SELECT_WRAPPER_HEAD_LEN); - sql_part.q_append(sql.ptr(), table_name_pos - SPIDER_SQL_FROM_LEN); - sql_part.q_append(SPIDER_SQL_ROW_NUMBER_HEAD_STR, - SPIDER_SQL_ROW_NUMBER_HEAD_LEN); - if ((int) spider_user_defined_key_parts(key_info) > start_pos) - { - if (desc_flg == TRUE) - { - for ( - key_part = key_info->key_part + start_pos, - length = 0; - length + start_pos < (int) spider_user_defined_key_parts(key_info); - key_part++, - length++ - ) { - field = key_part->field; - if (sql_part.reserve(SPIDER_SQL_NAME_QUOTE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(SPIDER_SQL_NAME_QUOTE_STR, - SPIDER_SQL_NAME_QUOTE_LEN); - if ((error_num = spider_db_append_name_with_quote_str(&sql_part, - field->field_name, spider_dbton_oracle.dbton_id))) - DBUG_RETURN(error_num); - if (key_part->key_part_flag & HA_REVERSE_SORT) - { - if (sql_part.reserve(SPIDER_SQL_NAME_QUOTE_LEN + - SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(SPIDER_SQL_NAME_QUOTE_STR, - SPIDER_SQL_NAME_QUOTE_LEN); - sql_part.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } else { - if (sql_part.reserve(SPIDER_SQL_NAME_QUOTE_LEN + - SPIDER_SQL_DESC_LEN + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(SPIDER_SQL_NAME_QUOTE_STR, - SPIDER_SQL_NAME_QUOTE_LEN); - sql_part.q_append(SPIDER_SQL_DESC_STR, SPIDER_SQL_DESC_LEN); - sql_part.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - } - } else { - for ( - key_part = key_info->key_part + start_pos, - length = 0; - length + start_pos < (int) spider_user_defined_key_parts(key_info); - key_part++, - length++ - ) { - field = key_part->field; - if (sql_part.reserve(SPIDER_SQL_NAME_QUOTE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(SPIDER_SQL_NAME_QUOTE_STR, - SPIDER_SQL_NAME_QUOTE_LEN); - if ((error_num = spider_db_append_name_with_quote_str(&sql_part, - field->field_name, spider_dbton_oracle.dbton_id))) - DBUG_RETURN(error_num); - if (key_part->key_part_flag & HA_REVERSE_SORT) - { - if (sql_part.reserve(SPIDER_SQL_NAME_QUOTE_LEN + - SPIDER_SQL_DESC_LEN + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(SPIDER_SQL_NAME_QUOTE_STR, - SPIDER_SQL_NAME_QUOTE_LEN); - sql_part.q_append(SPIDER_SQL_DESC_STR, SPIDER_SQL_DESC_LEN); - sql_part.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } else { - if (sql_part.reserve(SPIDER_SQL_NAME_QUOTE_LEN + - SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(SPIDER_SQL_NAME_QUOTE_STR, - SPIDER_SQL_NAME_QUOTE_LEN); - sql_part.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - } - } - } - if (desc_flg == TRUE) - { - if (sql_part.reserve(SPIDER_SQL_ROW_NUMBER_DESC_TAIL_LEN + - SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN + sql.length() - table_name_pos + - SPIDER_SQL_FROM_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(SPIDER_SQL_ROW_NUMBER_DESC_TAIL_STR, - SPIDER_SQL_ROW_NUMBER_DESC_TAIL_LEN); - } else { - if (sql_part.reserve(SPIDER_SQL_ROW_NUMBER_TAIL_LEN + - SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN + sql.length() - table_name_pos + - SPIDER_SQL_FROM_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(SPIDER_SQL_ROW_NUMBER_TAIL_STR, - SPIDER_SQL_ROW_NUMBER_TAIL_LEN); - } - pos_diff = sql_part.length() + SPIDER_SQL_FROM_LEN - table_name_pos; - sql_part.q_append(sql.ptr() + table_name_pos - SPIDER_SQL_FROM_LEN, - sql.length() - table_name_pos + SPIDER_SQL_FROM_LEN); - sql_part.q_append(SPIDER_SQL_SELECT_WRAPPER_TAIL_STR, - SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN); - - if ((int) spider_user_defined_key_parts(key_info) > start_pos) - { - if (sql.reserve(SPIDER_SQL_ORDER_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql.q_append(SPIDER_SQL_ORDER_STR, SPIDER_SQL_ORDER_LEN); - if (desc_flg == TRUE) - { - for ( - key_part = key_info->key_part + start_pos, - length = 0; - length + start_pos < (int) spider_user_defined_key_parts(key_info); - key_part++, - length++ - ) { - field = key_part->field; - if (sql.reserve(SPIDER_SQL_NAME_QUOTE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql.q_append(SPIDER_SQL_NAME_QUOTE_STR, - SPIDER_SQL_NAME_QUOTE_LEN); - if ((error_num = spider_db_append_name_with_quote_str(&sql, - field->field_name, spider_dbton_oracle.dbton_id))) - DBUG_RETURN(error_num); - if (key_part->key_part_flag & HA_REVERSE_SORT) - { - if (sql.reserve(SPIDER_SQL_NAME_QUOTE_LEN + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql.q_append(SPIDER_SQL_NAME_QUOTE_STR, - SPIDER_SQL_NAME_QUOTE_LEN); - sql.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } else { - if (sql.reserve(SPIDER_SQL_NAME_QUOTE_LEN + SPIDER_SQL_DESC_LEN + - SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql.q_append(SPIDER_SQL_NAME_QUOTE_STR, - SPIDER_SQL_NAME_QUOTE_LEN); - sql.q_append(SPIDER_SQL_DESC_STR, SPIDER_SQL_DESC_LEN); - sql.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - } - } else { - for ( - key_part = key_info->key_part + start_pos, - length = 0; - length + start_pos < (int) spider_user_defined_key_parts(key_info); - key_part++, - length++ - ) { - field = key_part->field; - if (sql.reserve(SPIDER_SQL_NAME_QUOTE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql.q_append(SPIDER_SQL_NAME_QUOTE_STR, - SPIDER_SQL_NAME_QUOTE_LEN); - if ((error_num = spider_db_append_name_with_quote_str(&sql, - field->field_name, spider_dbton_oracle.dbton_id))) - DBUG_RETURN(error_num); - if (key_part->key_part_flag & HA_REVERSE_SORT) - { - if (sql.reserve(SPIDER_SQL_NAME_QUOTE_LEN + SPIDER_SQL_DESC_LEN + - SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql.q_append(SPIDER_SQL_NAME_QUOTE_STR, - SPIDER_SQL_NAME_QUOTE_LEN); - sql.q_append(SPIDER_SQL_DESC_STR, SPIDER_SQL_DESC_LEN); - sql.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } else { - if (sql.reserve(SPIDER_SQL_NAME_QUOTE_LEN + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql.q_append(SPIDER_SQL_NAME_QUOTE_STR, - SPIDER_SQL_NAME_QUOTE_LEN); - sql.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - } - } - sql.length(sql.length() - SPIDER_SQL_COMMA_LEN); - } - DBUG_RETURN(0); -} - -int spider_oracle_copy_table::append_limit( - longlong offset, - longlong limit -) { - char buf[SPIDER_LONGLONG_LEN + 1]; - uint32 length; - DBUG_ENTER("spider_oracle_copy_table::append_limit"); - DBUG_PRINT("info",("spider this=%p", this)); - if (offset || limit < 9223372036854775807LL) - { - if (!select_rownum_appended) - { - select_rownum_appended = TRUE; - table_name_pos = table_name_pos + pos_diff; - if (sql.copy(sql_part)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - pos = pos + pos_diff; - } - if (offset) - { - if (sql.reserve(SPIDER_SQL_BETWEEN_LEN + SPIDER_SQL_AND_LEN + - ((SPIDER_LONGLONG_LEN) * 2))) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql.q_append(SPIDER_SQL_BETWEEN_STR, SPIDER_SQL_BETWEEN_LEN); - length = (uint32) (my_charset_bin.longlong10_to_str)( - buf, SPIDER_LONGLONG_LEN + 1, -10, offset); - sql.q_append(buf, length); - sql.q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN); - length = (uint32) (my_charset_bin.longlong10_to_str)( - buf, SPIDER_LONGLONG_LEN + 1, -10, limit); - sql.q_append(buf, length); - } else { - if (sql.reserve(SPIDER_SQL_HS_LTEQUAL_LEN + - (SPIDER_LONGLONG_LEN))) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql.q_append(SPIDER_SQL_HS_LTEQUAL_STR, SPIDER_SQL_HS_LTEQUAL_LEN); - length = (uint32) (my_charset_bin.longlong10_to_str)( - buf, SPIDER_LONGLONG_LEN + 1, -10, limit); - sql.q_append(buf, length); - } - } - DBUG_RETURN(0); -} - -int spider_oracle_copy_table::append_into_str() -{ - DBUG_ENTER("spider_oracle_copy_table::append_into_str"); - DBUG_PRINT("info",("spider this=%p", this)); - if (sql.reserve(SPIDER_SQL_INTO_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql.q_append(SPIDER_SQL_INTO_STR, SPIDER_SQL_INTO_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_copy_table::append_open_paren_str() -{ - DBUG_ENTER("spider_oracle_copy_table::append_open_paren_str"); - DBUG_PRINT("info",("spider this=%p", this)); - if (sql.reserve(SPIDER_SQL_OPEN_PAREN_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql.q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_copy_table::append_values_str() -{ - DBUG_ENTER("spider_oracle_copy_table::append_values_str"); - DBUG_PRINT("info",("spider this=%p", this)); - if (sql.reserve(SPIDER_SQL_CLOSE_PAREN_LEN + SPIDER_SQL_VALUES_LEN + - SPIDER_SQL_OPEN_PAREN_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql.q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN); - sql.q_append(SPIDER_SQL_VALUES_STR, SPIDER_SQL_VALUES_LEN); - sql.q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_copy_table::append_select_lock_str( - int lock_mode -) { - DBUG_ENTER("spider_oracle_copy_table::append_select_lock_str"); - DBUG_PRINT("info",("spider this=%p", this)); - if (select_rownum_appended) - { - int error_num; - table_lock_mode = lock_mode; - sql_part.length(0); - if (sql_part.reserve(SPIDER_SQL_LOCK_TABLE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(SPIDER_SQL_LOCK_TABLE_STR, SPIDER_SQL_LOCK_TABLE_LEN); - if ((error_num = oracle_share->append_table_name(&sql_part, - store_link_idx))) - DBUG_RETURN(error_num); - if (lock_mode == SPIDER_LOCK_MODE_EXCLUSIVE) - { - if (sql_part.reserve(SPIDER_SQL_LOCK_TABLE_EXCLUSIVE_MODE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(SPIDER_SQL_LOCK_TABLE_EXCLUSIVE_MODE_STR, - SPIDER_SQL_LOCK_TABLE_EXCLUSIVE_MODE_LEN); - } else if (lock_mode == SPIDER_LOCK_MODE_SHARED) - { - if (sql_part.reserve(SPIDER_SQL_LOCK_TABLE_SHARE_MODE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql_part.q_append(SPIDER_SQL_LOCK_TABLE_SHARE_MODE_STR, - SPIDER_SQL_LOCK_TABLE_SHARE_MODE_LEN); - } - } else { - if (lock_mode == SPIDER_LOCK_MODE_EXCLUSIVE) - { - if (sql.reserve(SPIDER_SQL_FOR_UPDATE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql.q_append(SPIDER_SQL_FOR_UPDATE_STR, SPIDER_SQL_FOR_UPDATE_LEN); - } else if (lock_mode == SPIDER_LOCK_MODE_SHARED) - { - if (sql.reserve(SPIDER_SQL_FOR_UPDATE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql.q_append(SPIDER_SQL_FOR_UPDATE_STR, SPIDER_SQL_FOR_UPDATE_LEN); - } - } - DBUG_RETURN(0); -} - -int spider_oracle_copy_table::exec_query( - SPIDER_CONN *conn, - int quick_mode, - int *need_mon -) { - int error_num = 0; - DBUG_ENTER("spider_oracle_copy_table::exec_query"); - DBUG_PRINT("info",("spider this=%p", this)); - if (current_str) - { - spider_string *tmp_str = first_str; - while (tmp_str && tmp_str != current_str) - { - if ( - (error_num = spider_db_query(conn, tmp_str->ptr(), tmp_str->length(), - quick_mode, need_mon)) && - error_num != HA_ERR_FOUND_DUPP_KEY - ) { - break; - } - tmp_str = tmp_str->next; - } - if (tmp_str == current_str) - { - error_num = spider_db_query(conn, tmp_str->ptr(), tmp_str->length(), - quick_mode, need_mon); - } - if (error_num == HA_ERR_FOUND_DUPP_KEY) - error_num = 0; - current_str = NULL; - } else { - if (table_lock_mode) - { - DBUG_PRINT("info",("spider table_lock_mode=%d", table_lock_mode)); - spider_db_oracle *db_conn = (spider_db_oracle *) conn->db_conn; - db_conn->table_lock_mode = table_lock_mode; - db_conn->exec_lock_sql = &sql_part; - table_lock_mode = 0; - } - error_num = spider_db_query(conn, sql.ptr(), sql.length(), quick_mode, - need_mon); - } - DBUG_RETURN(error_num); -} - -int spider_oracle_copy_table::copy_key_row( - spider_db_copy_table *source_ct, - Field *field, - ulong *row_pos, - ulong *length, - const char *joint_str, - const int joint_length -) { - int error_num; - spider_string *source_str = &((spider_oracle_copy_table *) source_ct)->sql; - DBUG_ENTER("spider_oracle_copy_table::copy_key_row"); - DBUG_PRINT("info",("spider this=%p", this)); - if (sql.reserve(SPIDER_SQL_NAME_QUOTE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql.q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); - if ((error_num = spider_db_append_name_with_quote_str(&sql, - field->field_name, spider_dbton_oracle.dbton_id))) - DBUG_RETURN(error_num); - if (sql.reserve(SPIDER_SQL_NAME_QUOTE_LEN + joint_length + *length + - SPIDER_SQL_AND_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - sql.q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); - sql.q_append(joint_str, joint_length); - sql.q_append(source_str->ptr() + *row_pos, *length); - sql.q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_copy_table::copy_row( - Field *field, - SPIDER_DB_ROW *row -) { - int error_num; - DBUG_ENTER("spider_oracle_copy_table::copy_row"); - DBUG_PRINT("info",("spider this=%p", this)); - if (row->is_null()) - { - DBUG_PRINT("info",("spider column is null")); - if (current_str->reserve(SPIDER_SQL_NULL_LEN + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - current_str->q_append(SPIDER_SQL_NULL_STR, SPIDER_SQL_NULL_LEN); - } else if (field->str_needs_quotes()) - { - DBUG_PRINT("info",("spider str_needs_quotes")); - if (current_str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - current_str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, - SPIDER_SQL_VALUE_QUOTE_LEN); - if ((error_num = row->append_escaped_to_str(current_str, - spider_dbton_oracle.dbton_id))) - DBUG_RETURN(error_num); - if (current_str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN + - SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - current_str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, - SPIDER_SQL_VALUE_QUOTE_LEN); - } else { - DBUG_PRINT("info",("spider without_quotes")); - if ((error_num = row->append_to_str(current_str))) - DBUG_RETURN(error_num); - if (current_str->reserve(SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - current_str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - DBUG_RETURN(0); -} - -int spider_oracle_copy_table::copy_rows( - TABLE *table, - SPIDER_DB_ROW *row, - ulong **last_row_pos, - ulong **last_lengths -) { - int error_num; - Field **field; - ulong *lengths2, *row_pos2; - DBUG_ENTER("spider_oracle_copy_table::copy_rows"); - DBUG_PRINT("info",("spider this=%p", this)); - if (!current_str) - { - if (!first_str) - { - if (!(first_str = new spider_string[1])) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - first_str->init_calc_mem(SPD_MID_ORACLE_COPY_TABLE_COPY_ROWS_1); - first_str->set_charset(sql.charset()); - if (first_str->reserve(sql.length())) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - first_str->q_append(sql.ptr(), sql.length()); - } else { - first_str->length(sql.length()); - } - current_str = first_str; - } else { - if (!current_str->next) - { - if (!(current_str->next = new spider_string[1])) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - current_str->next->init_calc_mem(SPD_MID_ORACLE_COPY_TABLE_COPY_ROWS_2); - current_str->next->set_charset(sql.charset()); - if (current_str->next->reserve(sql.length())) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - current_str->next->q_append(sql.ptr(), sql.length()); - } else { - current_str->next->length(sql.length()); - } - current_str = current_str->next; - } - row_pos2 = *last_row_pos; - lengths2 = *last_lengths; - - for ( - field = table->field; - *field; - field++, - lengths2++ - ) { - *row_pos2 = current_str->length(); - if ((error_num = - copy_row(*field, row))) - DBUG_RETURN(error_num); - *lengths2 = current_str->length() - *row_pos2 - SPIDER_SQL_COMMA_LEN; - row->next(); - row_pos2++; - } - current_str->length(current_str->length() - SPIDER_SQL_COMMA_LEN); - if (current_str->reserve(SPIDER_SQL_CLOSE_PAREN_LEN)) - { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - current_str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, - SPIDER_SQL_CLOSE_PAREN_LEN); - DBUG_PRINT("info",("spider current_str=%s", current_str->c_ptr_safe())); - DBUG_RETURN(0); -} - -int spider_oracle_copy_table::copy_rows( - TABLE *table, - SPIDER_DB_ROW *row -) { - int error_num; - Field **field; - DBUG_ENTER("spider_oracle_copy_table::copy_rows"); - DBUG_PRINT("info",("spider this=%p", this)); - if (!current_str) - { - if (!first_str) - { - if (!(first_str = new spider_string[1])) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - first_str->init_calc_mem(SPD_MID_ORACLE_COPY_TABLE_COPY_ROWS_3); - first_str->set_charset(sql.charset()); - if (first_str->reserve(sql.length())) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - first_str->q_append(sql.ptr(), sql.length()); - } else { - first_str->length(sql.length()); - } - current_str = first_str; - } else { - if (!current_str->next) - { - if (!(current_str->next = new spider_string[1])) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - current_str->next->init_calc_mem(SPD_MID_ORACLE_COPY_TABLE_COPY_ROWS_4); - current_str->next->set_charset(sql.charset()); - if (current_str->next->reserve(sql.length())) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - current_str->next->q_append(sql.ptr(), sql.length()); - } else { - current_str->next->length(sql.length()); - } - current_str = current_str->next; - } - - for ( - field = table->field; - *field; - field++ - ) { - if ((error_num = - copy_row(*field, row))) - DBUG_RETURN(error_num); - row->next(); - } - current_str->length(current_str->length() - SPIDER_SQL_COMMA_LEN); - if (current_str->reserve(SPIDER_SQL_CLOSE_PAREN_LEN)) - { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - current_str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, - SPIDER_SQL_CLOSE_PAREN_LEN); - DBUG_PRINT("info",("spider current_str=%s", current_str->c_ptr_safe())); - DBUG_RETURN(0); -} - -int spider_oracle_copy_table::append_insert_terminator() -{ - DBUG_ENTER("spider_oracle_copy_table::append_insert_terminator"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(0); -} - -int spider_oracle_copy_table::copy_insert_values( - spider_db_copy_table *source_ct -) { - spider_oracle_copy_table *tmp_ct = (spider_oracle_copy_table *) source_ct; - spider_string *source_str = &tmp_ct->sql; - int values_length = source_str->length() - tmp_ct->pos; - const char *values_ptr = source_str->ptr() + tmp_ct->pos; - DBUG_ENTER("spider_oracle_copy_table::copy_insert_values"); - DBUG_PRINT("info",("spider this=%p", this)); - if (sql.reserve(values_length)) - { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - sql.q_append(values_ptr, values_length); - DBUG_RETURN(0); -} -#endif diff --git a/storage/spider/spd_db_oracle.h b/storage/spider/spd_db_oracle.h deleted file mode 100644 index 5f7f4e8ff1f..00000000000 --- a/storage/spider/spd_db_oracle.h +++ /dev/null @@ -1,1543 +0,0 @@ -/* Copyright (C) 2012-2018 Kentoku Shiba - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ - -class spider_db_oracle; -class spider_db_oracle_result; - -class spider_db_oracle_util: public spider_db_util -{ -public: - spider_db_oracle_util(); - ~spider_db_oracle_util(); - int append_name( - spider_string *str, - const char *name, - uint name_length - ); - int append_name_with_charset( - spider_string *str, - const char *name, - uint name_length, - CHARSET_INFO *name_charset - ); - int append_escaped_name( - spider_string *str, - const char *name, - uint name_length - ); - int append_escaped_name_with_charset( - spider_string *str, - const char *name, - uint name_length, - CHARSET_INFO *name_charset - ); - bool is_name_quote( - const char head_code - ); - int append_escaped_name_quote( - spider_string *str - ); - int append_column_value( - ha_spider *spider, - spider_string *str, - Field *field, - const uchar *new_ptr, - CHARSET_INFO *access_charset - ); - int append_from_with_alias( - spider_string *str, - const char **table_names, - uint *table_name_lengths, - const char **table_aliases, - uint *table_alias_lengths, - uint table_count, - int *table_name_pos, - bool over_write - ); - int append_trx_isolation( - spider_string *str, - int trx_isolation - ); - int append_autocommit( - spider_string *str, - bool autocommit - ); - int append_sql_log_off( - spider_string *str, - bool sql_log_off - ); - int append_wait_timeout( - spider_string *str, - int wait_timeout - ); - int append_sql_mode( - spider_string *str, - sql_mode_t sql_mode - ); - int append_time_zone( - spider_string *str, - Time_zone *time_zone - ); - int append_start_transaction( - spider_string *str - ); - int append_xa_start( - spider_string *str, - XID *xid - ); - int append_lock_table_head( - spider_string *str - ); - int append_lock_table_body( - spider_string *str, - const char *db_name, - uint db_name_length, - CHARSET_INFO *db_name_charset, - const char *table_name, - uint table_name_length, - CHARSET_INFO *table_name_charset, - int lock_type - ); - int append_lock_table_tail( - spider_string *str - ); - int append_unlock_table( - spider_string *str - ); - int open_item_func( - Item_func *item_func, - ha_spider *spider, - spider_string *str, - const char *alias, - uint alias_length, - bool use_fields, - spider_fields *fields - ); - int open_item_sum_func( - Item_sum *item_sum, - ha_spider *spider, - spider_string *str, - const char *alias, - uint alias_length, - bool use_fields, - spider_fields *fields - ); - size_t escape_string( - char *to, - const char *from, - size_t from_length, - CHARSET_INFO *access_charset - ); - int append_escaped_util( - spider_string *to, - String *from - ); - int append_from_and_tables( - ha_spider *spider, - spider_fields *fields, - spider_string *str, - TABLE_LIST *table_list, - uint table_count - ); - int reappend_tables( - spider_fields *fields, - SPIDER_LINK_IDX_CHAIN *link_idx_chain, - spider_string *str - ); - int append_where( - spider_string *str - ); - int append_having( - spider_string *str - ); -}; - -class spider_db_oracle_row: public spider_db_row -{ -public: - spider_db_oracle *db_conn; - spider_db_oracle_result *result; - sb2 *ind; - char **val; - ub2 *rlen; - sb2 *ind_first; - char **val_first; - ub2 *rlen_first; - spider_string *val_str; - spider_string *val_str_first; - OCIDefine **defnp; - OCILobLocator **lobhp; - OCIParam **colhp; - ub2 *coltp; - ub2 *colsz; - uint field_count; - uint record_size; - ulong *row_size; - ulong *row_size_first; - CHARSET_INFO *access_charset; - bool cloned; - spider_db_oracle_util util; - - spider_db_oracle_row(); - ~spider_db_oracle_row(); - int store_to_field( - Field *field, - CHARSET_INFO *access_charset - ); - int append_to_str( - spider_string *str - ); - int append_escaped_to_str( - spider_string *str, - uint dbton_id - ); - void first(); - void next(); - bool is_null(); - int val_int(); - double val_real(); - my_decimal *val_decimal( - my_decimal *decimal_value, - CHARSET_INFO *access_charset - ); - SPIDER_DB_ROW *clone(); - int store_to_tmp_table( - TABLE *tmp_table, - spider_string *str - ); - uint get_byte_size(); - /* for oracle */ - int init(); - void deinit(); - int define(); - int fetch(); -}; - -class spider_db_oracle_result: public spider_db_result -{ -public: - spider_db_oracle *db_conn; - OCIStmt *stmtp; - uint field_count; - CHARSET_INFO *access_charset; - bool fetched; - spider_db_oracle_row row; - int store_error_num; - - spider_db_oracle_result(SPIDER_DB_CONN *in_db_conn); - ~spider_db_oracle_result(); - bool has_result(); - void free_result(); - SPIDER_DB_ROW *current_row(); - SPIDER_DB_ROW *fetch_row(); - SPIDER_DB_ROW *fetch_row_from_result_buffer( - spider_db_result_buffer *spider_res_buf - ); - SPIDER_DB_ROW *fetch_row_from_tmp_table( - TABLE *tmp_table - ); - int fetch_table_status( - int mode, - ha_statistics &stat - ); - int fetch_table_records( - int mode, - ha_rows &records - ); - int fetch_table_cardinality( - int mode, - TABLE *table, - longlong *cardinality, - uchar *cardinality_upd, - int bitmap_size - ); - int fetch_table_mon_status( - int &status - ); - longlong num_rows(); - uint num_fields(); - void move_to_pos( - longlong pos - ); - int get_errno(); -#ifdef SPIDER_HAS_DISCOVER_TABLE_STRUCTURE - int fetch_columns_for_discover_table_structure( - spider_string *str, - CHARSET_INFO *access_charset - ); - int fetch_index_for_discover_table_structure( - spider_string *str, - CHARSET_INFO *access_charset - ); - int fetch_table_for_discover_table_structure( - spider_string *str, - SPIDER_SHARE *spider_share, - CHARSET_INFO *access_charset - ); -#endif - /* for oracle */ - int set_column_info(); -}; - -class spider_db_oracle: public spider_db_conn -{ -public: - OCIEnv *envhp; - OCIError *errhp; - OCIServer *srvhp; - OCISvcCtx *svchp; - OCISession *usrhp; - OCIStmt *stmtp; - OCITrans *txnhp; - spider_db_oracle_result *result; - int stored_error_num; - const char *stored_error; - uint update_rows; - int table_lock_mode; - spider_string *exec_lock_sql; - spider_db_oracle_util util; - ulonglong stored_last_insert_id; - HASH lock_table_hash; - bool lock_table_hash_inited; - uint lock_table_hash_id; - const char *lock_table_hash_func_name; - const char *lock_table_hash_file_name; - ulong lock_table_hash_line_no; - DYNAMIC_ARRAY handler_open_array; - bool handler_open_array_inited; - uint handler_open_array_id; - const char *handler_open_array_func_name; - const char *handler_open_array_file_name; - ulong handler_open_array_line_no; - - /* for bg_connect */ - char stored_error_msg[MYSQL_ERRMSG_SIZE]; - char *tgt_host; - char *tgt_username; - char *tgt_password; - long tgt_port; - char *tgt_socket; - char *server_name; - int connect_retry_count; - longlong connect_retry_interval; - - spider_db_oracle( - SPIDER_CONN *conn - ); - ~spider_db_oracle(); - int init(); - bool is_connected(); - void bg_connect(); - int connect( - char *tgt_host, - char *tgt_username, - char *tgt_password, - long tgt_port, - char *tgt_socket, - char *server_name, - int connect_retry_count, - longlong connect_retry_interval - ); - int ping(); - void bg_disconnect(); - void disconnect(); - int set_net_timeout(); - int exec_query( - const char *query, - uint length, - int quick_mode - ); - int get_errno(); - const char *get_error(); - bool is_server_gone_error( - int error_num - ); - bool is_dup_entry_error( - int error_num - ); - bool is_xa_nota_error( - int error_num - ); - spider_db_result *store_result( - spider_db_result_buffer **spider_res_buf, - st_spider_db_request_key *request_key, - int *error_num - ); - spider_db_result *use_result( - ha_spider *spider, - st_spider_db_request_key *request_key, - int *error_num - ); - int next_result(); - uint affected_rows(); - uint matched_rows(); - bool inserted_info( - spider_db_handler *handler, - ha_copy_info *copy_info - ); - ulonglong last_insert_id(); - int set_character_set( - const char *csname - ); - int select_db( - const char *dbname - ); - int consistent_snapshot( - int *need_mon - ); - bool trx_start_in_bulk_sql(); - int start_transaction( - int *need_mon - ); - int commit( - int *need_mon - ); - int rollback( - int *need_mon - ); - bool xa_start_in_bulk_sql(); - int xa_start( - XID *xid, - int *need_mon - ); - int xa_end( - XID *xid, - int *need_mon - ); - int xa_prepare( - XID *xid, - int *need_mon - ); - int xa_commit( - XID *xid, - int *need_mon - ); - int xa_rollback( - XID *xid, - int *need_mon - ); - bool set_trx_isolation_in_bulk_sql(); - int set_trx_isolation( - int trx_isolation, - int *need_mon - ); - bool set_autocommit_in_bulk_sql(); - int set_autocommit( - bool autocommit, - int *need_mon - ); - bool set_sql_log_off_in_bulk_sql(); - int set_sql_log_off( - bool sql_log_off, - int *need_mon - ); - bool set_wait_timeout_in_bulk_sql(); - int set_wait_timeout( - int wait_timeout, - int *need_mon - ); - bool set_sql_mode_in_bulk_sql(); - int set_sql_mode( - sql_mode_t sql_mode, - int *need_mon - ); - bool set_time_zone_in_bulk_sql(); - int set_time_zone( - Time_zone *time_zone, - int *need_mon - ); - int show_master_status( - SPIDER_TRX *trx, - SPIDER_SHARE *share, - int all_link_idx, - int *need_mon, - TABLE *table, - spider_string *str, - int mode, - SPIDER_DB_RESULT **res1, - SPIDER_DB_RESULT **res2 - ); - size_t escape_string( - char *to, - const char *from, - size_t from_length - ); - bool have_lock_table_list(); - int append_lock_tables( - spider_string *str - ); - int append_unlock_tables( - spider_string *str - ); - uint get_lock_table_hash_count(); - void reset_lock_table_hash(); - uint get_opened_handler_count(); - void reset_opened_handler(); - void set_dup_key_idx( - ha_spider *spider, - int link_idx - ); - bool cmp_request_key_to_snd( - st_spider_db_request_key *request_key - ); -private: - int set_error( - sword res, - dvoid *hndlp, - int error_num, - const char *error1, - const char *error2 - ); -}; - -class spider_oracle_share: public spider_db_share -{ -public: - spider_string *table_select; - int table_select_pos; - spider_string *key_select; - int *key_select_pos; - spider_string *key_hint; - spider_string *show_table_status; - spider_string *show_records; - spider_string *show_autoinc; - spider_string *show_last_insert_id; - spider_string *show_index; - spider_string *table_names_str; - spider_string *db_names_str; - spider_string *db_table_str; - spider_string *nextval_str; - my_hash_value_type *db_table_str_hash_value; - uint table_nm_max_length; - uint db_nm_max_length; - uint nextval_max_length; - spider_string *column_name_str; - bool same_db_table_name; - int first_all_link_idx; - - spider_oracle_share( - st_spider_share *share - ); - ~spider_oracle_share(); - int init(); - uint get_column_name_length( - uint field_index - ); - int append_column_name( - spider_string *str, - uint field_index - ); - int append_column_name_with_alias( - spider_string *str, - uint field_index, - const char *alias, - uint alias_length - ); - int append_table_name( - spider_string *str, - int all_link_idx - ); - int append_table_name_with_adjusting( - spider_string *str, - int all_link_idx - ); - int append_from_with_adjusted_table_name( - spider_string *str, - int *table_name_pos - ); - bool need_change_db_table_name(); -#ifdef SPIDER_HAS_DISCOVER_TABLE_STRUCTURE - int discover_table_structure( - SPIDER_TRX *trx, - SPIDER_SHARE *spider_share, - spider_string *str - ); -#endif -private: - int create_table_names_str(); - void free_table_names_str(); - int create_column_name_str(); - void free_column_name_str(); - int convert_key_hint_str(); - int append_show_table_status(); - void free_show_table_status(); - int append_show_records(); - void free_show_records(); - int append_show_autoinc(); - void free_show_autoinc(); - int append_show_last_insert_id(); - void free_show_last_insert_id(); - int append_show_index(); - void free_show_index(); - int append_table_select(); - int append_key_select( - uint idx - ); -}; - -class spider_oracle_handler: public spider_db_handler -{ - spider_string sql; - spider_string sql_part; - spider_string sql_part2; - spider_string ha_sql; - int where_pos; - int order_pos; - int limit_pos; -public: - int table_name_pos; -private: - int update_set_pos; - int ha_read_pos; - int ha_next_pos; - int ha_where_pos; - int ha_limit_pos; - int ha_table_name_pos; - uint ha_sql_handler_id; - spider_string insert_sql; - int insert_pos; - int insert_table_name_pos; - int nextval_pos; - spider_string update_sql; - TABLE *upd_tmp_tbl; - TMP_TABLE_PARAM upd_tmp_tbl_prm; - spider_string tmp_sql; - int tmp_sql_pos1; /* drop db nm pos at tmp_table_join */ - int tmp_sql_pos2; /* create db nm pos at tmp_table_join */ - int tmp_sql_pos3; /* insert db nm pos at tmp_table_join */ - int tmp_sql_pos4; /* insert val pos at tmp_table_join */ - int tmp_sql_pos5; /* end of drop tbl at tmp_table_join */ - spider_string dup_update_sql; - spider_string *exec_sql; - spider_string *exec_insert_sql; - spider_string *exec_update_sql; - spider_string *exec_tmp_sql; - spider_string *exec_ha_sql; - spider_string *exec_lock_sql; - int table_lock_mode; - bool reading_from_bulk_tmp_table; - bool filled_up; - bool select_rownum_appended; - bool update_rownum_appended; - SPIDER_INT_HLD *union_table_name_pos_first; - SPIDER_INT_HLD *union_table_name_pos_current; -public: - spider_oracle_share *oracle_share; - SPIDER_LINK_FOR_HASH *link_for_hash; - uchar *minimum_select_bitmap; - spider_oracle_handler( - ha_spider *spider, - spider_oracle_share *share - ); - ~spider_oracle_handler(); - int init(); - int spider_oracle_handler::append_index_hint( - spider_string *str, - int link_idx, - ulong sql_type - ); - int append_table_name_with_adjusting( - spider_string *str, - int link_idx, - ulong sql_type - ); - int append_key_column_types( - const key_range *start_key, - spider_string *str - ); - int append_key_join_columns_for_bka( - const key_range *start_key, - spider_string *str, - const char **table_aliases, - uint *table_alias_lengths - ); - int append_tmp_table_and_sql_for_bka( - const key_range *start_key - ); - int reuse_tmp_table_and_sql_for_bka(); - void create_tmp_bka_table_name( - char *tmp_table_name, - int *tmp_table_name_length, - int link_idx - ); - int append_create_tmp_bka_table( - const key_range *start_key, - spider_string *str, - char *tmp_table_name, - int tmp_table_name_length, - int *db_name_pos, - CHARSET_INFO *table_charset - ); - int append_drop_tmp_bka_table( - spider_string *str, - char *tmp_table_name, - int tmp_table_name_length, - int *db_name_pos, - int *drop_table_end_pos, - bool with_semicolon - ); - int append_insert_tmp_bka_table( - const key_range *start_key, - spider_string *str, - char *tmp_table_name, - int tmp_table_name_length, - int *db_name_pos - ); - int append_union_table_and_sql_for_bka( - const key_range *start_key - ); - int reuse_union_table_and_sql_for_bka(); - int append_insert_for_recovery( - ulong sql_type, - int link_idx - ); - int append_update( - const TABLE *table, - my_ptrdiff_t ptr_diff - ); - int append_update( - const TABLE *table, - my_ptrdiff_t ptr_diff, - int link_idx - ); - int append_delete( - const TABLE *table, - my_ptrdiff_t ptr_diff - ); - int append_delete( - const TABLE *table, - my_ptrdiff_t ptr_diff, - int link_idx - ); - int append_insert_part(); - int append_insert( - spider_string *str, - int link_idx - ); - int append_update_part(); - int append_update( - spider_string *str, - int link_idx - ); - int append_delete_part(); - int append_delete( - spider_string *str - ); - int append_update_set_part(); - int append_update_set( - spider_string *str - ); - int append_direct_update_set_part(); - int append_direct_update_set( - spider_string *str - ); - int append_dup_update_pushdown_part( - const char *alias, - uint alias_length - ); - int append_update_columns_part( - const char *alias, - uint alias_length - ); - int check_update_columns_part(); - int append_update_columns( - spider_string *str, - const char *alias, - uint alias_length - ); - int append_select_part( - ulong sql_type - ); - int append_select( - spider_string *str, - ulong sql_type - ); - int append_table_select_part( - ulong sql_type - ); - int append_table_select( - spider_string *str - ); - int append_key_select_part( - ulong sql_type, - uint idx - ); - int append_key_select( - spider_string *str, - uint idx - ); - int append_minimum_select_part( - ulong sql_type - ); - int append_minimum_select( - spider_string *str, - ulong sql_type - ); - int append_table_select_with_alias( - spider_string *str, - const char *alias, - uint alias_length - ); - int append_key_select_with_alias( - spider_string *str, - const KEY *key_info, - const char *alias, - uint alias_length - ); - int append_minimum_select_with_alias( - spider_string *str, - const char *alias, - uint alias_length - ); - int append_select_columns_with_alias( - spider_string *str, - const char *alias, - uint alias_length - ); - int append_hint_after_table_part( - ulong sql_type - ); - int append_hint_after_table( - spider_string *str - ); - void set_where_pos( - ulong sql_type - ); - void set_where_to_pos( - ulong sql_type - ); - int check_item_type( - Item *item - ); - int append_values_connector_part( - ulong sql_type - ); - int append_values_connector( - spider_string *str - ); - int append_values_terminator_part( - ulong sql_type - ); - int append_values_terminator( - spider_string *str - ); - int append_union_table_connector_part( - ulong sql_type - ); - int append_union_table_connector( - spider_string *str - ); - int append_union_table_terminator_part( - ulong sql_type - ); - int append_union_table_terminator( - spider_string *str - ); - int append_key_column_values_part( - const key_range *start_key, - ulong sql_type - ); - int append_key_column_values( - spider_string *str, - const key_range *start_key - ); - int append_key_column_values_with_name_part( - const key_range *start_key, - ulong sql_type - ); - int append_key_column_values_with_name( - spider_string *str, - const key_range *start_key - ); - int append_key_where_part( - const key_range *start_key, - const key_range *end_key, - ulong sql_type - ); - int append_key_where( - spider_string *str, - spider_string *str_part, - spider_string *str_part2, - const key_range *start_key, - const key_range *end_key, - ulong sql_type, - bool set_order - ); - int append_is_null_part( - ulong sql_type, - KEY_PART_INFO *key_part, - const key_range *key, - const uchar **ptr, - bool key_eq, - bool tgt_final - ); - int append_is_null( - ulong sql_type, - spider_string *str, - spider_string *str_part, - spider_string *str_part2, - KEY_PART_INFO *key_part, - const key_range *key, - const uchar **ptr, - bool key_eq, - bool tgt_final - ); - int append_where_terminator_part( - ulong sql_type, - bool set_order, - int key_count - ); - int append_where_terminator( - ulong sql_type, - spider_string *str, - spider_string *str_part, - spider_string *str_part2, - bool set_order, - int key_count - ); - int append_match_where_part( - ulong sql_type - ); - int append_match_where( - spider_string *str - ); - int append_update_where( - spider_string *str, - const TABLE *table, - my_ptrdiff_t ptr_diff - ); - int append_condition_part( - const char *alias, - uint alias_length, - ulong sql_type, - bool test_flg - ); - int append_condition( - spider_string *str, - const char *alias, - uint alias_length, - bool start_where, - ulong sql_type - ); - int append_match_against_part( - ulong sql_type, - st_spider_ft_info *ft_info, - const char *alias, - uint alias_length - ); - int append_match_against( - spider_string *str, - st_spider_ft_info *ft_info, - const char *alias, - uint alias_length - ); - int append_match_select_part( - ulong sql_type, - const char *alias, - uint alias_length - ); - int append_match_select( - spider_string *str, - const char *alias, - uint alias_length - ); - int append_sum_select_part( - ulong sql_type, - const char *alias, - uint alias_length - ); - int append_sum_select( - spider_string *str, - const char *alias, - uint alias_length - ); - void set_order_pos( - ulong sql_type - ); - void set_order_to_pos( - ulong sql_type - ); - int append_group_by_part( - const char *alias, - uint alias_length, - ulong sql_type - ); - int append_group_by( - spider_string *str, - const char *alias, - uint alias_length - ); - int append_key_order_for_merge_with_alias_part( - const char *alias, - uint alias_length, - ulong sql_type - ); - int append_key_order_for_merge_with_alias( - spider_string *str, - const char *alias, - uint alias_length - ); - int append_key_order_for_direct_order_limit_with_alias_part( - const char *alias, - uint alias_length, - ulong sql_type - ); - int append_key_order_for_direct_order_limit_with_alias( - spider_string *str, - const char *alias, - uint alias_length - ); - int append_key_order_with_alias_part( - const char *alias, - uint alias_length, - ulong sql_type - ); - int append_key_order_for_handler( - spider_string *str, - const char *alias, - uint alias_length - ); - int append_key_order_with_alias( - spider_string *str, - const char *alias, - uint alias_length - ); - int append_limit_part( - longlong offset, - longlong limit, - ulong sql_type - ); - int reappend_limit_part( - longlong offset, - longlong limit, - ulong sql_type - ); - int append_limit( - spider_string *str, - longlong offset, - longlong limit - ); - int append_select_lock_part( - ulong sql_type - ); - int append_select_lock( - spider_string *str - ); - int append_union_all_start_part( - ulong sql_type - ); - int append_union_all_start( - spider_string *str - ); - int append_union_all_part( - ulong sql_type - ); - int append_union_all( - spider_string *str - ); - int append_union_all_end_part( - ulong sql_type - ); - int append_union_all_end( - spider_string *str - ); - int append_multi_range_cnt_part( - ulong sql_type, - uint multi_range_cnt, - bool with_comma - ); - int append_multi_range_cnt( - spider_string *str, - uint multi_range_cnt, - bool with_comma - ); - int append_multi_range_cnt_with_name_part( - ulong sql_type, - uint multi_range_cnt - ); - int append_multi_range_cnt_with_name( - spider_string *str, - uint multi_range_cnt - ); - int append_open_handler_part( - ulong sql_type, - uint handler_id, - SPIDER_CONN *conn, - int link_idx - ); - int append_open_handler( - spider_string *str, - uint handler_id, - SPIDER_CONN *conn, - int link_idx - ); - int append_close_handler_part( - ulong sql_type, - int link_idx - ); - int append_close_handler( - spider_string *str, - int link_idx - ); - int append_insert_terminator_part( - ulong sql_type - ); - int append_insert_terminator( - spider_string *str - ); - int append_insert_values_part( - ulong sql_type - ); - int append_insert_values( - spider_string *str - ); - int append_into_part( - ulong sql_type - ); - int append_into( - spider_string *str - ); - void set_insert_to_pos( - ulong sql_type - ); - int append_from_part( - ulong sql_type, - int link_idx - ); - int append_from( - spider_string *str, - ulong sql_type, - int link_idx - ); - int append_flush_tables_part( - ulong sql_type, - int link_idx, - bool lock - ); - int append_flush_tables( - spider_string *str, - int link_idx, - bool lock - ); - int append_optimize_table_part( - ulong sql_type, - int link_idx - ); - int append_optimize_table( - spider_string *str, - int link_idx - ); - int append_analyze_table_part( - ulong sql_type, - int link_idx - ); - int append_analyze_table( - spider_string *str, - int link_idx - ); - int append_repair_table_part( - ulong sql_type, - int link_idx, - HA_CHECK_OPT* check_opt - ); - int append_repair_table( - spider_string *str, - int link_idx, - HA_CHECK_OPT* check_opt - ); - int append_check_table_part( - ulong sql_type, - int link_idx, - HA_CHECK_OPT* check_opt - ); - int append_check_table( - spider_string *str, - int link_idx, - HA_CHECK_OPT* check_opt - ); - int append_enable_keys_part( - ulong sql_type, - int link_idx - ); - int append_enable_keys( - spider_string *str, - int link_idx - ); - int append_disable_keys_part( - ulong sql_type, - int link_idx - ); - int append_disable_keys( - spider_string *str, - int link_idx - ); - int append_delete_all_rows_part( - ulong sql_type - ); - int append_delete_all_rows( - spider_string *str, - ulong sql_type - ); - int append_truncate( - spider_string *str, - ulong sql_type, - int link_idx - ); - int append_explain_select_part( - const key_range *start_key, - const key_range *end_key, - ulong sql_type, - int link_idx - ); - int append_explain_select( - spider_string *str, - const key_range *start_key, - const key_range *end_key, - ulong sql_type, - int link_idx - ); - bool is_sole_projection_field( - uint16 field_index - ); - bool is_bulk_insert_exec_period( - bool bulk_end - ); - bool sql_is_filled_up( - ulong sql_type - ); - bool sql_is_empty( - ulong sql_type - ); - bool support_multi_split_read(); - bool support_bulk_update(); - int bulk_tmp_table_insert(); - int bulk_tmp_table_insert( - int link_idx - ); - int bulk_tmp_table_end_bulk_insert(); - int bulk_tmp_table_rnd_init(); - int bulk_tmp_table_rnd_next(); - int bulk_tmp_table_rnd_end(); - bool need_copy_for_update( - int link_idx - ); - bool bulk_tmp_table_created(); - int mk_bulk_tmp_table_and_bulk_start(); - void rm_bulk_tmp_table(); - int store_sql_to_bulk_tmp_table( - spider_string *str, - TABLE *tmp_table - ); - int restore_sql_from_bulk_tmp_table( - spider_string *str, - TABLE *tmp_table - ); - int insert_lock_tables_list( - SPIDER_CONN *conn, - int link_idx - ); - int append_lock_tables_list( - SPIDER_CONN *conn, - int link_idx, - int *appended - ); - int realloc_sql( - ulong *realloced - ); - int reset_sql( - ulong sql_type - ); - bool need_lock_before_set_sql_for_exec( - ulong sql_type - ); - int set_sql_for_exec( - ulong sql_type, - int link_idx, - SPIDER_LINK_IDX_CHAIN *link_idx_chain - ); - int set_sql_for_exec( - ulong sql_type, - int link_idx - ); - int set_sql_for_exec( - spider_db_copy_table *tgt_ct, - ulong sql_type - ); - int execute_sql( - ulong sql_type, - SPIDER_CONN *conn, - int quick_mode, - int *need_mon - ); - int reset(); - int sts_mode_exchange( - int sts_mode - ); - int show_table_status( - int link_idx, - int sts_mode, - uint flag - ); - int crd_mode_exchange( - int crd_mode - ); - int show_index( - int link_idx, - int crd_mode - ); - int show_records( - int link_idx - ); - int show_autoinc( - int link_idx - ); - int show_last_insert_id( - int link_idx, - ulonglong &last_insert_id - ); - ha_rows explain_select( - const key_range *start_key, - const key_range *end_key, - int link_idx - ); - int lock_tables( - int link_idx - ); - int unlock_tables( - int link_idx - ); - int disable_keys( - SPIDER_CONN *conn, - int link_idx - ); - int enable_keys( - SPIDER_CONN *conn, - int link_idx - ); - int check_table( - SPIDER_CONN *conn, - int link_idx, - HA_CHECK_OPT* check_opt - ); - int repair_table( - SPIDER_CONN *conn, - int link_idx, - HA_CHECK_OPT* check_opt - ); - int analyze_table( - SPIDER_CONN *conn, - int link_idx - ); - int optimize_table( - SPIDER_CONN *conn, - int link_idx - ); - int flush_tables( - SPIDER_CONN *conn, - int link_idx, - bool lock - ); - int flush_logs( - SPIDER_CONN *conn, - int link_idx - ); - int insert_opened_handler( - SPIDER_CONN *conn, - int link_idx - ); - int delete_opened_handler( - SPIDER_CONN *conn, - int link_idx - ); - int sync_from_clone_source( - spider_db_handler *dbton_hdl - ); - bool support_use_handler( - int use_handler - ); - void minimum_select_bitmap_create(); - bool minimum_select_bit_is_set( - uint field_index - ); - void copy_minimum_select_bitmap( - uchar *bitmap - ); - int init_union_table_name_pos(); - int set_union_table_name_pos(); - int reset_union_table_name( - spider_string *str, - int link_idx, - ulong sql_type - ); - int append_from_and_tables_part( - spider_fields *fields, - ulong sql_type - ); - int reappend_tables_part( - spider_fields *fields, - ulong sql_type - ); - int append_where_part( - ulong sql_type - ); - int append_having_part( - ulong sql_type - ); - int append_item_type_part( - Item *item, - const char *alias, - uint alias_length, - bool use_fields, - spider_fields *fields, - ulong sql_type - ); - int append_list_item_select_part( - List *select, - const char *alias, - uint alias_length, - bool use_fields, - spider_fields *fields, - ulong sql_type - ); - int append_list_item_select( - List *select, - spider_string *str, - const char *alias, - uint alias_length, - bool use_fields, - spider_fields *fields - ); - int append_group_by_part( - ORDER *order, - const char *alias, - uint alias_length, - bool use_fields, - spider_fields *fields, - ulong sql_type - ); - int append_group_by( - ORDER *order, - spider_string *str, - const char *alias, - uint alias_length, - bool use_fields, - spider_fields *fields - ); - int append_order_by_part( - ORDER *order, - const char *alias, - uint alias_length, - bool use_fields, - spider_fields *fields, - ulong sql_type - ); - int append_order_by( - ORDER *order, - spider_string *str, - const char *alias, - uint alias_length, - bool use_fields, - spider_fields *fields - ); -}; - -class spider_oracle_copy_table: public spider_db_copy_table -{ -public: - spider_oracle_share *oracle_share; - spider_string sql; - spider_string sql_part; - uint pos; - uint table_name_pos; - uint pos_diff; - int table_lock_mode; - int store_link_idx; - bool select_rownum_appended; - spider_string *first_str; - spider_string *current_str; - spider_oracle_copy_table( - spider_oracle_share *db_share - ); - ~spider_oracle_copy_table(); - int init(); - void set_sql_charset( - CHARSET_INFO *cs - ); - int append_select_str(); - int append_insert_str( - int insert_flg - ); - int append_table_columns( - TABLE_SHARE *table_share - ); - int append_from_str(); - int append_table_name( - int link_idx - ); - void set_sql_pos(); - void set_sql_to_pos(); - int append_copy_where( - spider_db_copy_table *source_ct, - KEY *key_info, - ulong *last_row_pos, - ulong *last_lengths - ); - int append_key_order_str( - KEY *key_info, - int start_pos, - bool desc_flg - ); - int append_limit( - longlong offset, - longlong limit - ); - int append_into_str(); - int append_open_paren_str(); - int append_values_str(); - int append_select_lock_str( - int lock_mode - ); - int exec_query( - SPIDER_CONN *conn, - int quick_mode, - int *need_mon - ); - int copy_key_row( - spider_db_copy_table *source_ct, - Field *field, - ulong *row_pos, - ulong *length, - const char *joint_str, - const int joint_length - ); - int copy_row( - Field *field, - SPIDER_DB_ROW *row - ); - int copy_rows( - TABLE *table, - SPIDER_DB_ROW *row, - ulong **last_row_pos, - ulong **last_lengths - ); - int copy_rows( - TABLE *table, - SPIDER_DB_ROW *row - ); - int append_insert_terminator(); - int copy_insert_values( - spider_db_copy_table *source_ct - ); -}; diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 5711de586d8..d1c08bfba85 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -128,9 +128,6 @@ handlerton *spider_hton_ptr; SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE]; extern SPIDER_DBTON spider_dbton_mysql; extern SPIDER_DBTON spider_dbton_mariadb; -#ifdef HAVE_ORACLE_OCI -extern SPIDER_DBTON spider_dbton_oracle; -#endif #ifndef WITHOUT_SPIDER_BG_SEARCH SPIDER_THREAD *spider_table_sts_threads; SPIDER_THREAD *spider_table_crd_threads; @@ -6499,12 +6496,6 @@ int spider_db_init( spider_dbton_mariadb.db_util->dbton_id = dbton_id; spider_dbton[dbton_id] = spider_dbton_mariadb; ++dbton_id; -#ifdef HAVE_ORACLE_OCI - spider_dbton_oracle.dbton_id = dbton_id; - spider_dbton_oracle.db_util->dbton_id = dbton_id; - spider_dbton[dbton_id] = spider_dbton_oracle; - ++dbton_id; -#endif for (roop_count = 0; roop_count < SPIDER_DBTON_SIZE; roop_count++) { if (spider_dbton[roop_count].init) From e6daff40e470de33b994440c8d954ee23d7277f9 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 10 Oct 2024 16:03:14 +1100 Subject: [PATCH 12/13] MDEV-32524 [fixup] Fixup of spider mem alloc enums missed in a previous merge The merge was 10.4.34->10.5.25 --- storage/spider/ha_spider.cc | 4 ++-- storage/spider/spd_conn.cc | 8 ++++---- storage/spider/spd_db_conn.cc | 8 ++++---- storage/spider/spd_include.h | 12 ++++++++++-- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 2acf9a9d3af..25967862c4e 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -286,7 +286,7 @@ int ha_spider::open( uchar *rnd_write_bitmap; if (!(wide_handler = (SPIDER_WIDE_HANDLER *) #ifdef WITH_PARTITION_STORAGE_ENGINE - spider_bulk_malloc(spider_current_trx, 16, MYF(MY_WME | MY_ZEROFILL), + spider_bulk_malloc(spider_current_trx, SPD_MID_HA_SPIDER_OPEN_1, MYF(MY_WME | MY_ZEROFILL), &wide_handler, sizeof(SPIDER_WIDE_HANDLER), &searched_bitmap, (uint) sizeof(uchar) * no_bytes_in_map(table->read_set), @@ -306,7 +306,7 @@ int ha_spider::open( (uint) sizeof(SPIDER_PARTITION_HANDLER), NullS) #else - spider_bulk_malloc(spider_current_trx, 16, MYF(MY_WME | MY_ZEROFILL), + spider_bulk_malloc(spider_current_trx, SPD_MID_HA_SPIDER_OPEN_2, MYF(MY_WME | MY_ZEROFILL), &wide_handler, sizeof(SPIDER_WIDE_HANDLER), &searched_bitmap, (uint) sizeof(uchar) * no_bytes_in_map(table->read_set), diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc index 8b7193ed94a..356d324cd1f 100644 --- a/storage/spider/spd_conn.cc +++ b/storage/spider/spd_conn.cc @@ -165,7 +165,7 @@ int spider_conn_init( ) { goto error_loop_checked_hash_init; } - spider_alloc_calc_mem_init(conn->loop_checked, 268); + spider_alloc_calc_mem_init(conn->loop_checked, SPD_MID_CONN_INIT_1); spider_alloc_calc_mem(spider_current_trx, conn->loop_checked, conn->loop_checked.array.max_element * @@ -176,7 +176,7 @@ int spider_conn_init( ) { goto error_loop_check_queue_hash_init; } - spider_alloc_calc_mem_init(conn->loop_check_queue, 269); + spider_alloc_calc_mem_init(conn->loop_check_queue, SPD_MID_CONN_INIT_2); spider_alloc_calc_mem(spider_current_trx, conn->loop_check_queue, conn->loop_check_queue.array.max_element * @@ -1108,7 +1108,7 @@ int spider_conn_queue_and_merge_loop_check( } else { /* Merge lcptr and lcqptr into a newly created lcrptr. */ DBUG_PRINT("info", ("spider append merged_value and replace")); - if (unlikely(!spider_bulk_malloc(spider_current_trx, 271, MYF(MY_WME), + if (unlikely(!spider_bulk_malloc(spider_current_trx, SPD_MID_CONN_QUEUE_AND_MERGE_LOOP_CHECK_1, MYF(MY_WME), &lcrptr, (uint) (sizeof(SPIDER_CONN_LOOP_CHECK)), &cur_name, (uint) (lcqptr->cur_name.length + 1), &to_name, (uint) (lcqptr->to_name.length + 1), @@ -1363,7 +1363,7 @@ int spider_conn_queue_loop_check( spider_free(spider_current_trx, lcptr, MYF(0)); } DBUG_PRINT("info", ("spider alloc_lcptr")); - if (unlikely(!spider_bulk_malloc(spider_current_trx, 272, MYF(MY_WME), + if (unlikely(!spider_bulk_malloc(spider_current_trx, SPD_MID_CONN_QUEUE_LOOP_CHECK_1, MYF(MY_WME), &lcptr, (uint) (sizeof(SPIDER_CONN_LOOP_CHECK)), &cur_name, (uint) (top_share->path.length + 1), &to_name, (uint) (to_str.length + 1), diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc index c4259968b68..0d0f1bb2e08 100644 --- a/storage/spider/spd_db_conn.cc +++ b/storage/spider/spd_db_conn.cc @@ -4029,7 +4029,7 @@ int spider_db_store_result_for_reuse_cursor( if (!result_list->first) { if (!(result_list->first = (SPIDER_RESULT *) - spider_malloc(spider_current_trx, 4, sizeof(*result_list->first), + spider_malloc(spider_current_trx, SPD_MID_DB_STORE_RESULT_FOR_REUSE_CURSOR_1, sizeof(*result_list->first), MYF(MY_WME | MY_ZEROFILL))) ) { DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -4055,7 +4055,7 @@ int spider_db_store_result_for_reuse_cursor( if (result_list->bgs_current == result_list->last) { if (!(result_list->last = (SPIDER_RESULT *) - spider_malloc(spider_current_trx, 5, sizeof(*result_list->last), + spider_malloc(spider_current_trx, SPD_MID_DB_STORE_RESULT_FOR_REUSE_CURSOR_2, sizeof(*result_list->last), MYF(MY_WME | MY_ZEROFILL))) ) { DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -4084,7 +4084,7 @@ int spider_db_store_result_for_reuse_cursor( if (result_list->current == result_list->last) { if (!(result_list->last = (SPIDER_RESULT *) - spider_malloc(spider_current_trx, 6, sizeof(*result_list->last), + spider_malloc(spider_current_trx, SPD_MID_DB_STORE_RESULT_FOR_REUSE_CURSOR_3, sizeof(*result_list->last), MYF(MY_WME | MY_ZEROFILL))) ) { DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -4213,7 +4213,7 @@ int spider_db_store_result_for_reuse_cursor( } current->field_count = field_count; if (!(position = (SPIDER_POSITION *) - spider_bulk_malloc(spider_current_trx, 7, MYF(MY_WME | MY_ZEROFILL), + spider_bulk_malloc(spider_current_trx, SPD_MID_DB_STORE_RESULT_FOR_REUSE_CURSOR_4, MYF(MY_WME | MY_ZEROFILL), &position, (uint) (sizeof(SPIDER_POSITION) * page_size), &tmp_row, (uint) (sizeof(SPIDER_DB_ROW) * field_count), NullS)) diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h index 1643d1b350e..bb3dc92ed3a 100644 --- a/storage/spider/spd_include.h +++ b/storage/spider/spd_include.h @@ -166,7 +166,7 @@ typedef start_new_trans *SPIDER_Open_tables_backup; #define SPIDER_TMP_SHARE_LONG_COUNT 20 #define SPIDER_TMP_SHARE_LONGLONG_COUNT 3 -#define SPIDER_MEM_CALC_LIST_NUM 314 +#define SPIDER_MEM_CALC_LIST_NUM SPD_MID_LAST #define SPIDER_CONN_META_BUF_LEN 64 /* @@ -181,6 +181,10 @@ typedef start_new_trans *SPIDER_Open_tables_backup; */ enum spider_malloc_id { SPD_MID_CHECK_HS_PK_UPDATE_1, + SPD_MID_CONN_INIT_1, + SPD_MID_CONN_INIT_2, + SPD_MID_CONN_QUEUE_AND_MERGE_LOOP_CHECK_1, + SPD_MID_CONN_QUEUE_LOOP_CHECK_1, SPD_MID_COPY_TABLES_BODY_1, SPD_MID_COPY_TABLES_BODY_2, SPD_MID_COPY_TABLES_BODY_3, @@ -287,6 +291,9 @@ enum spider_malloc_id { SPD_MID_DB_STORE_RESULT_4, SPD_MID_DB_STORE_RESULT_5, SPD_MID_DB_STORE_RESULT_FOR_REUSE_CURSOR_1, + SPD_MID_DB_STORE_RESULT_FOR_REUSE_CURSOR_2, + SPD_MID_DB_STORE_RESULT_FOR_REUSE_CURSOR_3, + SPD_MID_DB_STORE_RESULT_FOR_REUSE_CURSOR_4, SPD_MID_DB_UDF_COPY_TABLES_1, SPD_MID_DB_UDF_PING_TABLE_1, SPD_MID_DB_UDF_PING_TABLE_2, @@ -438,7 +445,8 @@ enum spider_malloc_id { SPD_MID_UDF_DIRECT_SQL_CREATE_CONN_KEY_1, SPD_MID_UDF_DIRECT_SQL_CREATE_TABLE_LIST_1, SPD_MID_UDF_DIRECT_SQL_CREATE_TABLE_LIST_2, - SPD_MID_UDF_GET_COPY_TGT_TABLES_1 + SPD_MID_UDF_GET_COPY_TGT_TABLES_1, + SPD_MID_LAST }; #define SPIDER_BACKUP_DASTATUS \ From 77ed235d50bd9b1480f26d18ea0b70ca7480af23 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Tue, 15 Oct 2024 15:36:12 +1100 Subject: [PATCH 13/13] MDEV-26345 Spider GBH should execute original queries on the data node Stop skipping const items when selecting but skip them when storing their results to spider row to avoid storing in mismatching temporary table fields. Skip auxiliary fields in SELECTing, and do not store the (non-existing) results to the corresponding temporary table accordingly. When there are BOTH auxiliary fields AND const items in the auxiliary field items, do not use the spider GBH. This is a rare occasion if it happens at all and not worth the added complexity to cover it. Use the original item (item_ptr) in constructing GROUP BY and ORDER BY, which also means using item->name instead of field->field_name as aliases in constructing SELECT items. This fixes spurious regressions caused by the above changes in some tests using ORDER BY, such as mdev_24517.test. As a by-product, this also fixes MDEV-29546. Therefore we update mdev_29008.test to include the MDEV-29546 case. --- sql/group_by_handler.h | 7 +- sql/sql_select.cc | 4 +- sql/sql_select.h | 2 +- storage/spider/ha_spider.cc | 78 ++++--------------- storage/spider/ha_spider.h | 2 + .../spider/bugfix/r/mdev_20502.result | 8 +- .../spider/bugfix/r/mdev_26345.result | 48 ++++++++++++ .../spider/bugfix/r/mdev_29008.result | 15 ++++ .../bugfix/r/select_with_backquote.result | 2 +- .../spider/bugfix/t/mdev_26345.test | 63 +++++++++++++++ .../spider/bugfix/t/mdev_29008.test | 13 ++++ .../mysql-test/spider/r/direct_join.result | 2 +- .../spider/r/direct_join_using.result | 2 +- .../spider/r/direct_left_join.result | 2 +- .../spider/r/direct_right_join.result | 2 +- .../mysql-test/spider/r/timestamp.result | 2 +- storage/spider/spd_db_conn.cc | 10 ++- storage/spider/spd_db_include.h | 13 +++- storage/spider/spd_db_mysql.cc | 55 ++++++++----- storage/spider/spd_db_mysql.h | 8 +- storage/spider/spd_group_by_handler.cc | 47 +++++++++-- storage/spider/spd_group_by_handler.h | 10 ++- 22 files changed, 286 insertions(+), 109 deletions(-) create mode 100644 storage/spider/mysql-test/spider/bugfix/r/mdev_26345.result create mode 100644 storage/spider/mysql-test/spider/bugfix/t/mdev_26345.test diff --git a/sql/group_by_handler.h b/sql/group_by_handler.h index 5457cb778f5..2a51956f3c1 100644 --- a/sql/group_by_handler.h +++ b/sql/group_by_handler.h @@ -53,6 +53,8 @@ class Select_limit_counters; struct Query { List *select; + /* Number of auxiliary fields. */ + int n_aux; bool distinct; TABLE_LIST *from; Item *where; @@ -71,7 +73,10 @@ public: /* Temporary table where all results should be stored in record[0] - The table has a field for every item from the Query::select list. + The table has a field for every item from the Query::select list, + except for const items and some other exceptions, see + Create_tmp_table::add_fields() for which items are included and + which are skipped. */ TABLE *table; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index fcc1e4dbfea..37ec152141c 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3400,7 +3400,9 @@ bool JOIN::make_aggr_tables_info() original DISTINCT. Thus, we set select_distinct || group_optimized_away to Query::distinct. */ - Query query= {&all_fields, select_distinct || group_optimized_away, + Query query= {&all_fields, + (int) all_fields.elements - (int) fields_list.elements, + select_distinct || group_optimized_away, tables_list, conds, group_list, order ? order : group_list, having, &select_lex->master_unit()->lim}; diff --git a/sql/sql_select.h b/sql/sql_select.h index 49632077ed8..86947fc0bc6 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -1473,7 +1473,7 @@ public: Then, ORDER/GROUP BY and Window Function code add columns that need to be saved to be available in the post-group-by context. These extra columns - are added to the front, because this->all_fields points to the suffix of + are added to the front, because this->fields_list points to the suffix of this list. */ List all_fields; diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 25967862c4e..8aff2858c3a 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -52,13 +52,9 @@ extern pthread_mutex_t spider_lgtm_tblhnd_share_mutex; /* UTC time zone for timestamp columns */ extern Time_zone *UTC; -ha_spider::ha_spider( -) : handler(spider_hton_ptr, NULL) +void ha_spider::init_fields() { - DBUG_ENTER("ha_spider::ha_spider"); - DBUG_PRINT("info",("spider this=%p", this)); - spider_alloc_calc_mem_init(mem_calc, SPD_MID_HA_SPIDER_HA_SPIDER_1); - spider_alloc_calc_mem(spider_current_trx, mem_calc, sizeof(*this)); + DBUG_ENTER("ha_spider::init_fields"); share = NULL; conns = NULL; need_mons = NULL; @@ -113,6 +109,20 @@ ha_spider::ha_spider( result_list.casual_read = NULL; result_list.use_both_key = FALSE; result_list.in_cmp_ref = FALSE; + result_list.skips= NULL; + result_list.n_aux= 0; + ref_length = sizeof(SPIDER_POSITION); + DBUG_VOID_RETURN; +} + +ha_spider::ha_spider( +) : handler(spider_hton_ptr, NULL) +{ + DBUG_ENTER("ha_spider::ha_spider"); + DBUG_PRINT("info",("spider this=%p", this)); + spider_alloc_calc_mem_init(mem_calc, SPD_MID_HA_SPIDER_HA_SPIDER_1); + spider_alloc_calc_mem(spider_current_trx, mem_calc, sizeof(*this)); + init_fields(); DBUG_VOID_RETURN; } @@ -125,61 +135,7 @@ ha_spider::ha_spider( DBUG_PRINT("info",("spider this=%p", this)); spider_alloc_calc_mem_init(mem_calc, SPD_MID_HA_SPIDER_HA_SPIDER_2); spider_alloc_calc_mem(spider_current_trx, mem_calc, sizeof(*this)); - share = NULL; - conns = NULL; - need_mons = NULL; - blob_buff = NULL; - conn_keys = NULL; - spider_thread_id = 0; - trx_conn_adjustment = 0; - search_link_query_id = 0; -#ifdef WITH_PARTITION_STORAGE_ENGINE - partition_handler = NULL; -#endif -#ifdef HA_MRR_USE_DEFAULT_IMPL - multi_range_keys = NULL; - mrr_key_buff = NULL; -#endif - append_tblnm_alias = NULL; - use_index_merge = FALSE; - is_clone = FALSE; - pt_clone_source_handler = NULL; - pt_clone_last_searcher = NULL; - ft_handler = NULL; - ft_first = NULL; - ft_current = NULL; - ft_count = 0; - ft_init_without_index_init = FALSE; - sql_kinds = 0; - error_mode = 0; - use_spatial_index = FALSE; - use_fields = FALSE; - dml_inited = FALSE; - use_pre_call = FALSE; - use_pre_action = FALSE; - do_direct_update = FALSE; - prev_index_rnd_init = SPD_NONE; - direct_aggregate_item_first = NULL; - result_link_idx = 0; - result_list.have_sql_kind_backup = FALSE; - result_list.sqls = NULL; - result_list.insert_sqls = NULL; - result_list.update_sqls = NULL; - result_list.tmp_sqls = NULL; - result_list.tmp_tables_created = FALSE; - result_list.bgs_working = FALSE; - result_list.direct_order_limit = FALSE; - result_list.direct_limit_offset = FALSE; - result_list.set_split_read = FALSE; - result_list.insert_dup_update_pushdown = FALSE; - result_list.tmp_pos_row_first = NULL; - result_list.direct_aggregate = FALSE; - result_list.snap_direct_aggregate = FALSE; - result_list.direct_distinct = FALSE; - result_list.casual_read = NULL; - result_list.use_both_key = FALSE; - result_list.in_cmp_ref = FALSE; - ref_length = sizeof(SPIDER_POSITION); + init_fields(); DBUG_VOID_RETURN; } diff --git a/storage/spider/ha_spider.h b/storage/spider/ha_spider.h index 6d2e0e40c57..34fad7eee96 100644 --- a/storage/spider/ha_spider.h +++ b/storage/spider/ha_spider.h @@ -910,6 +910,8 @@ public: int append_lock_tables_list(); int lock_tables(); int dml_init(); +private: + void init_fields(); }; diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_20502.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_20502.result index e5f16b81329..beea6837bd9 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_20502.result +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_20502.result @@ -54,13 +54,13 @@ m const val sq connection child2_1; SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; argument -select t0.`id` `id`,t0.`val` `val` from `auto_test_remote`.`tbl_a` t0 -select t0.`id` `id`,t0.`val` `val`,(t0.`val` + 10) `val+10` from `auto_test_remote`.`tbl_a` t0 +select t0.`id` `id`,0 `const`,t0.`val` `val` from `auto_test_remote`.`tbl_a` t0 +select `id`,`val` from `auto_test_remote`.`tbl_a` select (t0.`val` + 1) `tbl_a.val+1` from `auto_test_remote`.`tbl_a` t0 select `id`,`val` from `auto_test_remote`.`tbl_a` order by `id` desc limit 1 for update -select (t0.`val` + 10) `val+10`,t0.`val` `val` from `auto_test_remote`.`tbl_a` t0 group by t0.`val` order by t0.`val` +select `val` from `auto_test_remote`.`tbl_a` group by `val` select (t0.`val` + 1) `tbl_a.val+1` from `auto_test_remote`.`tbl_a` t0 limit 1 -select max(t0.`id`) `m`,t0.`val` `val` from `auto_test_remote`.`tbl_a` t0 group by t0.`val` order by t0.`val` +select max(`id`),min(`id`),`val` from `auto_test_remote`.`tbl_a` group by `val` select (t0.`val` + 1) `tbl_a.val+1` from `auto_test_remote`.`tbl_a` t0 limit 1 SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' SELECT id, val FROM tbl_a ORDER BY id; diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_26345.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_26345.result new file mode 100644 index 00000000000..f7d78521472 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_26345.result @@ -0,0 +1,48 @@ +for master_1 +for child2 +for child3 + +MDEV-26345 SELECT MIN on Spider table returns more rows than expected + +set spider_same_server_link= 1; +CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); +create table t2 (a int, b int, PRIMARY KEY (a, b)); +create table t1 (a int, b int, PRIMARY KEY (a, b)) ENGINE=Spider +COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; +insert into t1 VALUES (1,4), (1,2), (2,11); +SELECT MIN(b), a FROM t1 WHERE a=1; +MIN(b) a +2 1 +SELECT MAX(b), a FROM t1 WHERE a<3; +MAX(b) a +11 1 +drop table t1, t2; +create table t2 (a int, b int, c int, PRIMARY KEY (a, b)); +create table t1 (a int, b int, c int, PRIMARY KEY (a, b)) ENGINE=Spider +COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; +insert into t2 VALUES (1,4,1), (1,2,2), (2,11,3); +SELECT MIN(b), a, c FROM t1 WHERE a=1; +MIN(b) a c +2 1 2 +drop table t1, t2; +create table t2 (a int, b int); +create table t1 ENGINE=Spider +COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; +insert into t1 VALUES (1,1), (1,1), (2,2), (2,2); +select distinct count(a) from t1 group by b; +count(a) +2 +drop table t1, t2; +create table t2 (c int); +create table t1 (c int) ENGINE=Spider +COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; +insert into t1 values (1),(3),(5),(7),(9),(11),(13),(15); +select count(c) as d from t1 having d > 5; +d +8 +drop table t1, t2; +drop server srv; +for master_1 +for child2 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_29008.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_29008.result index 66e33f42a7e..10bf1cc1d9c 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_29008.result +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_29008.result @@ -15,6 +15,10 @@ a INT, b INT ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO tbl_a VALUES (1,2),(3,4); +set @old_general_log=@@global.general_log; +set global general_log=1; +set @old_log_output=@@global.log_output; +set global log_output="TABLE"; connection master_1; CREATE DATABASE auto_test_local; USE auto_test_local; @@ -26,9 +30,20 @@ SELECT MIN(t2.a) AS f1, t1.b AS f2 FROM tbl_a AS t1 JOIN tbl_a AS t2 GROUP BY f2 f1 f2 1 2 1 4 +SELECT MIN(t2.a) AS f1, t1.b AS f2 FROM tbl_a AS t1 JOIN tbl_a AS t2 GROUP BY f2 ORDER BY MIN(t2.a), MAX(t2.a), f2; +f1 f2 +1 2 +1 4 connection master_1; DROP DATABASE IF EXISTS auto_test_local; connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE 'select %'; +argument +select min(t1.`a`) `f1`,t0.`b` `f2` from `auto_test_remote`.`tbl_a` t0 join `auto_test_remote`.`tbl_a` t1 group by `f2` order by `f1`,`f2` +select min(t1.`a`) `f1`,t0.`b` `f2` from `auto_test_remote`.`tbl_a` t0 join `auto_test_remote`.`tbl_a` t1 group by `f2` order by min(t1.`a`),max(t1.`a`),`f2` +SELECT argument FROM mysql.general_log WHERE argument LIKE 'select %' +set global log_output=@old_log_output; +set global general_log=@old_general_log; DROP DATABASE IF EXISTS auto_test_remote; for master_1 for child2 diff --git a/storage/spider/mysql-test/spider/bugfix/r/select_with_backquote.result b/storage/spider/mysql-test/spider/bugfix/r/select_with_backquote.result index 52f8c98bf98..732446f9fb1 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/select_with_backquote.result +++ b/storage/spider/mysql-test/spider/bugfix/r/select_with_backquote.result @@ -44,7 +44,7 @@ connection child2_1; SET NAMES utf8; SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; argument -select t0.`pkey` `pkey`,(left(t0.`txt_utf8` , 4)) `LEFT(``txt_utf8``, 4)` from `auto_test_remote`.`tbl_a` t0 order by `LEFT(``txt_utf8``, 4)` limit 3 +select t0.`pkey` `pkey`,(left(t0.`txt_utf8` , 4)) `LEFT(``txt_utf8``, 4)` from `auto_test_remote`.`tbl_a` t0 order by (left(`txt_utf8` , 4)) limit 3 SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' SELECT pkey, txt_utf8 FROM tbl_a ORDER BY pkey; pkey txt_utf8 diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_26345.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_26345.test new file mode 100644 index 00000000000..72069253e84 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_26345.test @@ -0,0 +1,63 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log +--enable_warnings + +--echo +--echo MDEV-26345 SELECT MIN on Spider table returns more rows than expected +--echo + +set spider_same_server_link= 1; +evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); + +# Case 1: implicit grouping: the const item is SELECTed, but its +# results discarded when storing to the temp table +create table t2 (a int, b int, PRIMARY KEY (a, b)); +create table t1 (a int, b int, PRIMARY KEY (a, b)) ENGINE=Spider +COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; +insert into t1 VALUES (1,4), (1,2), (2,11); +SELECT MIN(b), a FROM t1 WHERE a=1; +SELECT MAX(b), a FROM t1 WHERE a<3; +drop table t1, t2; + +# Case 2: implicit grouping: the const item is SELECTed, but its +# results discarded when storing to the temp table +create table t2 (a int, b int, c int, PRIMARY KEY (a, b)); +create table t1 (a int, b int, c int, PRIMARY KEY (a, b)) ENGINE=Spider +COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; +insert into t2 VALUES (1,4,1), (1,2,2), (2,11,3); +SELECT MIN(b), a, c FROM t1 WHERE a=1; +drop table t1, t2; + +# Case 3: auxiliary fields should not be SELECTed +create table t2 (a int, b int); +create table t1 ENGINE=Spider +COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; +insert into t1 VALUES (1,1), (1,1), (2,2), (2,2); +# b is an auxiliary field item. If it was SELECTed, two rows would +# return instead of one. +select distinct count(a) from t1 group by b; +drop table t1, t2; + +# Case 4: having should still work, despite referring to auxiliary +# field items which are not SELECTed +create table t2 (c int); +create table t1 (c int) ENGINE=Spider +COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; +insert into t1 values (1),(3),(5),(7),(9),(11),(13),(15); +select count(c) as d from t1 having d > 5; +drop table t1, t2; + +drop server srv; + +--disable_warnings +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29008.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_29008.test index 28d9a9244e3..f36855d8e71 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_29008.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29008.test @@ -17,6 +17,11 @@ eval CREATE TABLE tbl_a ( ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; INSERT INTO tbl_a VALUES (1,2),(3,4); +set @old_general_log=@@global.general_log; +set global general_log=1; +set @old_log_output=@@global.log_output; +set global log_output="TABLE"; + --connection master_1 CREATE DATABASE auto_test_local; USE auto_test_local; @@ -25,11 +30,19 @@ eval CREATE TABLE tbl_a ( b INT ) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a", srv "s_2_1"'; +--disable_ps2_protocol SELECT MIN(t2.a) AS f1, t1.b AS f2 FROM tbl_a AS t1 JOIN tbl_a AS t2 GROUP BY f2 ORDER BY f1, f2; +SELECT MIN(t2.a) AS f1, t1.b AS f2 FROM tbl_a AS t1 JOIN tbl_a AS t2 GROUP BY f2 ORDER BY MIN(t2.a), MAX(t2.a), f2; +--enable_ps2_protocol --connection master_1 DROP DATABASE IF EXISTS auto_test_local; --connection child2_1 +--disable_ps2_protocol +SELECT argument FROM mysql.general_log WHERE argument LIKE 'select %'; +--enable_ps2_protocol +set global log_output=@old_log_output; +set global general_log=@old_general_log; DROP DATABASE IF EXISTS auto_test_remote; --disable_query_log diff --git a/storage/spider/mysql-test/spider/r/direct_join.result b/storage/spider/mysql-test/spider/r/direct_join.result index 5c0f4c808a0..b5511cb8c9c 100644 --- a/storage/spider/mysql-test/spider/r/direct_join.result +++ b/storage/spider/mysql-test/spider/r/direct_join.result @@ -76,7 +76,7 @@ a b c connection child2_1; SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; argument -select t0.`b` `b`,t0.`a` `a`,t2.`b` `b`,t2.`c` `c` from `auto_test_remote`.`ta_r` t0 join `auto_test_remote`.`ta_r_3` t1 join `auto_test_remote`.`ta_r_int` t2 where ((t0.`a` = t1.`a`) and (t2.`a` = t1.`a`)) order by t0.`b` desc limit 1,2 +select t0.`a` `a`,t2.`b` `b`,t2.`c` `c` from `auto_test_remote`.`ta_r` t0 join `auto_test_remote`.`ta_r_3` t1 join `auto_test_remote`.`ta_r_int` t2 where ((t0.`a` = t1.`a`) and (t2.`a` = t1.`a`)) order by t0.`b` desc limit 1,2 SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') diff --git a/storage/spider/mysql-test/spider/r/direct_join_using.result b/storage/spider/mysql-test/spider/r/direct_join_using.result index 93df7b8cd3f..1a4708a739b 100644 --- a/storage/spider/mysql-test/spider/r/direct_join_using.result +++ b/storage/spider/mysql-test/spider/r/direct_join_using.result @@ -79,7 +79,7 @@ a b c connection child2_1; SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; argument -select t0.`b` `b`,t0.`a` `a`,t2.`b` `b`,t2.`c` `c` from `auto_test_remote`.`ta_r` t0 join `auto_test_remote`.`ta_r_3` t1 join `auto_test_remote`.`ta_r_int` t2 where ((t0.`a` = t1.`a`) and (t2.`a` = t1.`a`)) order by t0.`b` desc +select t0.`a` `a`,t2.`b` `b`,t2.`c` `c` from `auto_test_remote`.`ta_r` t0 join `auto_test_remote`.`ta_r_3` t1 join `auto_test_remote`.`ta_r_int` t2 where ((t0.`a` = t1.`a`) and (t2.`a` = t1.`a`)) order by t0.`b` desc SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') diff --git a/storage/spider/mysql-test/spider/r/direct_left_join.result b/storage/spider/mysql-test/spider/r/direct_left_join.result index b63f0661b2e..b2149436e03 100644 --- a/storage/spider/mysql-test/spider/r/direct_left_join.result +++ b/storage/spider/mysql-test/spider/r/direct_left_join.result @@ -79,7 +79,7 @@ a b c connection child2_1; SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; argument -select t0.`b` `b`,t0.`a` `a`,t2.`b` `b`,t2.`c` `c` from `auto_test_remote`.`ta_r` t0 left join `auto_test_remote`.`ta_r_3` t1 on (t1.`a` = t0.`a`) left join `auto_test_remote`.`ta_r_int` t2 on (t2.`a` = t0.`a`) where 1 order by t0.`b` desc +select t0.`a` `a`,t2.`b` `b`,t2.`c` `c` from `auto_test_remote`.`ta_r` t0 left join `auto_test_remote`.`ta_r_3` t1 on (t1.`a` = t0.`a`) left join `auto_test_remote`.`ta_r_int` t2 on (t2.`a` = t0.`a`) where 1 order by t0.`b` desc SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') diff --git a/storage/spider/mysql-test/spider/r/direct_right_join.result b/storage/spider/mysql-test/spider/r/direct_right_join.result index b42e40031e3..5504c4b557a 100644 --- a/storage/spider/mysql-test/spider/r/direct_right_join.result +++ b/storage/spider/mysql-test/spider/r/direct_right_join.result @@ -79,7 +79,7 @@ a b c connection child2_1; SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; argument -select t0.`b` `b`,t0.`a` `a`,t2.`b` `b`,t2.`c` `c` from `auto_test_remote`.`ta_r_int` t2 left join (`auto_test_remote`.`ta_r_3` t1 join `auto_test_remote`.`ta_r` t0) on ((t0.`a` = t2.`a`) and (t1.`a` = t2.`a`)) where 1 order by t0.`b` desc +select t0.`a` `a`,t2.`b` `b`,t2.`c` `c` from `auto_test_remote`.`ta_r_int` t2 left join (`auto_test_remote`.`ta_r_3` t1 join `auto_test_remote`.`ta_r` t0) on ((t0.`a` = t2.`a`) and (t1.`a` = t2.`a`)) where 1 order by t0.`b` desc SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; a b date_format(c, '%Y-%m-%d %H:%i:%s') diff --git a/storage/spider/mysql-test/spider/r/timestamp.result b/storage/spider/mysql-test/spider/r/timestamp.result index 20e99dc02f8..c7a2a3ebe86 100644 --- a/storage/spider/mysql-test/spider/r/timestamp.result +++ b/storage/spider/mysql-test/spider/r/timestamp.result @@ -396,7 +396,7 @@ select t0.`col_d` `col_d`,t0.`col_t` `col_t` from `ts_test_remote`.`tbl_f` t0 select (timestamp(t0.`col_d` , t0.`col_t`)) `TIMESTAMP(col_d, col_t)` from `ts_test_remote`.`tbl_f` t0 select (timestamp('2018-06-25' , t0.`col_t`)) `TIMESTAMP('2018-06-25', col_t)` from `ts_test_remote`.`tbl_f` t0 select (timestamp(t0.`col_d` , '10:43:21')) `TIMESTAMP(col_d, '10:43:21')` from `ts_test_remote`.`tbl_f` t0 -select 1 from `ts_test_remote`.`tbl_f` t0 +select (timestamp('2018-06-25' , '10:43:21')) `TIMESTAMP('2018-06-25', '10:43:21')` from `ts_test_remote`.`tbl_f` t0 SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' SELECT col_d, col_t FROM tbl_f; col_d col_t diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc index 0d0f1bb2e08..72489a1777e 100644 --- a/storage/spider/spd_db_conn.cc +++ b/storage/spider/spd_db_conn.cc @@ -2827,6 +2827,7 @@ int spider_db_get_row_from_tmp_tbl_pos( DBUG_RETURN(0); } +/* Store one field result from a given row to a given table field. */ int spider_db_fetch_row( SPIDER_SHARE *share, Field *field, @@ -2851,6 +2852,10 @@ int spider_db_fetch_row( DBUG_RETURN(error_num); } +/* + Retrieve a result row and store the results from the row into the + given table +*/ int spider_db_fetch_table( ha_spider *spider, uchar *buf, @@ -2863,6 +2868,7 @@ int spider_db_fetch_table( SPIDER_RESULT *current = (SPIDER_RESULT*) result_list->current; SPIDER_DB_ROW *row; Field **field; + int n_aux= result_list->n_aux; DBUG_ENTER("spider_db_fetch_table"); if (result_list->quick_mode == 0) { @@ -2940,6 +2946,8 @@ int spider_db_fetch_table( *field; field++ ) { + if (n_aux-- > 0) + continue; if (( bitmap_is_set(table->read_set, (*field)->field_index) | bitmap_is_set(table->write_set, (*field)->field_index) @@ -3788,7 +3796,7 @@ int spider_db_store_result( } current->dbton_id = current->result->dbton_id; SPIDER_DB_ROW *row; - if (!(row = current->result->fetch_row())) + if (!(row = current->result->fetch_row(result_list->skips))) { error_num = current->result->get_errno(); DBUG_PRINT("info",("spider set finish_flg point 3")); diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h index eb7875ac056..430cd8479be 100644 --- a/storage/spider/spd_db_include.h +++ b/storage/spider/spd_db_include.h @@ -801,6 +801,7 @@ public: SPIDER_DB_ROW *next_pos; spider_db_row(uint in_dbton_id) : dbton_id(in_dbton_id), next_pos(NULL) {} virtual ~spider_db_row() = default; + /* Store the current field result to a given field */ virtual int store_to_field( Field *field, CHARSET_INFO *access_charset @@ -813,6 +814,7 @@ public: uint dbton_id ) = 0; virtual void first() = 0; + /* Move to the next field result. */ virtual void next() = 0; virtual bool is_null() = 0; virtual int val_int() = 0; @@ -851,7 +853,7 @@ public: virtual bool has_result() = 0; virtual void free_result() = 0; virtual SPIDER_DB_ROW *current_row() = 0; - virtual SPIDER_DB_ROW *fetch_row() = 0; + virtual SPIDER_DB_ROW *fetch_row(MY_BITMAP *skips = NULL) = 0; virtual SPIDER_DB_ROW *fetch_row_from_result_buffer( spider_db_result_buffer *spider_res_buf ) = 0; @@ -1549,7 +1551,8 @@ public: uint alias_length, bool use_fields, spider_fields *fields, - ulong sql_type + ulong sql_type, + int n_aux=0 ) = 0; virtual int append_group_by_part( ORDER *order, @@ -1838,4 +1841,10 @@ typedef struct st_spider_result_list #endif SPIDER_RESULT *bgs_current; SPIDER_DB_ROW *tmp_pos_row_first; + /* + A bitmap marking fields to skip when storing results fetched from + the data node to a SPIDER_DB_ROW + */ + MY_BITMAP *skips; + int n_aux; } SPIDER_RESULT_LIST; diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index 7e10b796f25..92885783daf 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -716,7 +716,13 @@ SPIDER_DB_ROW *spider_db_mbase_result::current_row() DBUG_RETURN((SPIDER_DB_ROW *) row.clone()); } -SPIDER_DB_ROW *spider_db_mbase_result::fetch_row() +/* + Fetch results from the data node and store them in a + SPIDER_DB_ROW + + @param skips A bitmap specifying which fields to skip storing +*/ +SPIDER_DB_ROW *spider_db_mbase_result::fetch_row(MY_BITMAP *skips) { DBUG_ENTER("spider_db_mbase_result::fetch_row"); DBUG_PRINT("info",("spider this=%p", this)); @@ -732,7 +738,22 @@ SPIDER_DB_ROW *spider_db_mbase_result::fetch_row() DBUG_RETURN(NULL); } row.lengths = mysql_fetch_lengths(db_result); - row.field_count = mysql_num_fields(db_result); + if (skips != NULL) + { + uint i= 0; + for (uint j= 0; j < mysql_num_fields(db_result); j++) + { + if (!bitmap_is_set(skips, j)) + { + row.row[i]= row.row[j]; + row.lengths[i]= row.lengths[j]; + i++; + } + } + row.field_count= i; + } + else + row.field_count = mysql_num_fields(db_result); row.row[row.field_count] = NULL; row.row_first = row.row; row.lengths_first = row.lengths; @@ -13944,7 +13965,8 @@ int spider_mbase_handler::append_list_item_select_part( uint alias_length, bool use_fields, spider_fields *fields, - ulong sql_type + ulong sql_type, + int n_aux ) { int error_num; spider_string *str; @@ -13959,7 +13981,7 @@ int spider_mbase_handler::append_list_item_select_part( DBUG_RETURN(0); } error_num = append_list_item_select(select, str, alias, alias_length, - use_fields, fields); + use_fields, fields, n_aux); DBUG_RETURN(error_num); } @@ -13969,38 +13991,29 @@ int spider_mbase_handler::append_list_item_select( const char *alias, uint alias_length, bool use_fields, - spider_fields *fields + spider_fields *fields, + int n_aux ) { int error_num; uint32 length, begin; List_iterator_fast it(*select); Item *item; - Field *field; const char *item_name; DBUG_ENTER("spider_mbase_handler::append_list_item_select"); DBUG_PRINT("info",("spider this=%p", this)); begin = str->length(); while ((item = it++)) { - if (item->const_item()) - { - DBUG_PRINT("info",("spider const item")); + fields->get_next_field_ptr(); + if (n_aux-- > 0) continue; - } if ((error_num = spider_db_print_item_type(item, NULL, spider, str, alias, alias_length, dbton_id, use_fields, fields))) { DBUG_RETURN(error_num); } - field = *(fields->get_next_field_ptr()); - if (field) - { - item_name = SPIDER_field_name_str(field); - length = SPIDER_field_name_length(field); - } else { - item_name = SPIDER_item_name_str(item); - length = SPIDER_item_name_length(item); - } + item_name = SPIDER_item_name_str(item); + length = SPIDER_item_name_length(item); if (str->reserve( SPIDER_SQL_COMMA_LEN + /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_SPACE_LEN + length @@ -14071,7 +14084,7 @@ int spider_mbase_handler::append_group_by( str->q_append(SPIDER_SQL_GROUP_STR, SPIDER_SQL_GROUP_LEN); for (; order; order = order->next) { - if ((error_num = spider_db_print_item_type((*order->item), NULL, spider, + if ((error_num = spider_db_print_item_type(order->item_ptr, NULL, spider, str, alias, alias_length, dbton_id, use_fields, fields))) { DBUG_RETURN(error_num); @@ -14128,7 +14141,7 @@ int spider_mbase_handler::append_order_by( str->q_append(SPIDER_SQL_ORDER_STR, SPIDER_SQL_ORDER_LEN); for (; order; order = order->next) { - if ((error_num = spider_db_print_item_type((*order->item), NULL, spider, + if ((error_num = spider_db_print_item_type(order->item_ptr, NULL, spider, str, alias, alias_length, dbton_id, use_fields, fields))) { DBUG_RETURN(error_num); diff --git a/storage/spider/spd_db_mysql.h b/storage/spider/spd_db_mysql.h index 028a69e843b..ac00217ff4c 100644 --- a/storage/spider/spd_db_mysql.h +++ b/storage/spider/spd_db_mysql.h @@ -294,7 +294,7 @@ public: bool has_result() override; void free_result() override; SPIDER_DB_ROW *current_row() override; - SPIDER_DB_ROW *fetch_row() override; + SPIDER_DB_ROW *fetch_row(MY_BITMAP *) override; SPIDER_DB_ROW *fetch_row_from_result_buffer( spider_db_result_buffer *spider_res_buf ) override; @@ -1493,7 +1493,8 @@ public: uint alias_length, bool use_fields, spider_fields *fields, - ulong sql_type + ulong sql_type, + int n_aux=0 ) override; int append_list_item_select( List *select, @@ -1501,7 +1502,8 @@ public: const char *alias, uint alias_length, bool use_fields, - spider_fields *fields + spider_fields *fields, + int n_aux ); int append_group_by_part( ORDER *order, diff --git a/storage/spider/spd_group_by_handler.cc b/storage/spider/spd_group_by_handler.cc index 2e4eb003371..f5889edc59e 100644 --- a/storage/spider/spd_group_by_handler.cc +++ b/storage/spider/spd_group_by_handler.cc @@ -978,13 +978,16 @@ int spider_fields::ping_table_mon_from_table( spider_group_by_handler::spider_group_by_handler( THD *thd_arg, Query *query_arg, - spider_fields *fields_arg + spider_fields *fields_arg, + const MY_BITMAP &skips1 ) : group_by_handler(thd_arg, spider_hton_ptr), query(*query_arg), fields(fields_arg) { DBUG_ENTER("spider_group_by_handler::spider_group_by_handler"); spider = fields->get_first_table_holder()->spider; trx = spider->wide_handler->trx; + my_bitmap_init(&skips, NULL, skips1.n_bits, TRUE); + bitmap_copy(&skips, &skips1); DBUG_VOID_RETURN; } @@ -993,11 +996,18 @@ spider_group_by_handler::~spider_group_by_handler() DBUG_ENTER("spider_group_by_handler::~spider_group_by_handler"); spider_free(spider_current_trx, fields->get_first_table_holder(), MYF(0)); delete fields; + my_bitmap_free(&skips); + /* + The `skips' bitmap may have been copied to the result_list field + of the same name + */ + spider->result_list.skips= NULL; + spider->result_list.n_aux= 0; DBUG_VOID_RETURN; } static int spider_prepare_init_scan( - const Query& query, spider_fields *fields, ha_spider *spider, + const Query& query, MY_BITMAP *skips, spider_fields *fields, ha_spider *spider, SPIDER_TRX *trx, longlong& offset_limit, THD *thd) { int error_num, link_idx; @@ -1072,6 +1082,8 @@ static int spider_prepare_init_scan( result_list->limit_num = result_list->internal_limit >= result_list->split_read ? result_list->split_read : result_list->internal_limit; + result_list->skips= skips; + result_list->n_aux= query.n_aux; if (select_lex->explicit_limit) { @@ -1101,7 +1113,8 @@ static int spider_make_query(const Query& query, spider_fields* fields, ha_spide DBUG_RETURN(error_num); fields->set_field_ptr(table->field); if ((error_num = dbton_hdl->append_list_item_select_part( - query.select, NULL, 0, TRUE, fields, SPIDER_SQL_TYPE_SELECT_SQL))) + query.select, NULL, 0, TRUE, fields, SPIDER_SQL_TYPE_SELECT_SQL, + query.n_aux))) DBUG_RETURN(error_num); if ((error_num = dbton_hdl->append_from_and_tables_part( fields, SPIDER_SQL_TYPE_SELECT_SQL))) @@ -1276,7 +1289,7 @@ int spider_group_by_handler::init_scan() } if ((error_num = spider_prepare_init_scan( - query, fields, spider, trx, offset_limit, thd))) + query, &skips, fields, spider, trx, offset_limit, thd))) DBUG_RETURN(error_num); if ((error_num = spider_make_query(query, fields, spider, table))) @@ -1397,6 +1410,7 @@ group_by_handler *spider_create_group_by_handler( SPIDER_TABLE_HOLDER *table_holder; uint table_idx, dbton_id, table_count= 0; long tgt_link_status; + MY_BITMAP skips; DBUG_ENTER("spider_create_group_by_handler"); switch (thd_sql_command(thd)) @@ -1543,13 +1557,30 @@ group_by_handler *spider_create_group_by_handler( fields_arg->set_table_holder(table_holder, table_count); keep_going = TRUE; it.init(*query->select); + my_bitmap_init(&skips, NULL, query->select->elements, TRUE); + int i= -1, n_aux= query->n_aux; while ((item = it++)) { + i++; + n_aux--; DBUG_PRINT("info",("spider select item=%p", item)); if (item->const_item()) { - DBUG_PRINT("info",("spider const item")); - continue; + /* + Do not handle the complex case where there's a const item + in the auxiliary fields. It is too unlikely (if at all) to + happen to be covered by the GBH. + + TODO: find an example covering this case or determine it + never happens and remove this consideration. + */ + if (n_aux >= 0) + { + spider_clear_bit(dbton_bitmap, roop_count); + keep_going= FALSE; + break; + } + bitmap_set_bit(&skips, i); } if (spider_db_print_item_type(item, NULL, spider, NULL, NULL, 0, roop_count, TRUE, fields_arg)) @@ -1823,11 +1854,12 @@ group_by_handler *spider_create_group_by_handler( fields->set_first_link_idx(); - if (!(group_by_handler = new spider_group_by_handler(thd, query, fields))) + if (!(group_by_handler = new spider_group_by_handler(thd, query, fields, skips))) { DBUG_PRINT("info",("spider can't create group_by_handler")); goto skip_free_fields; } + my_bitmap_free(&skips); query->distinct = FALSE; query->where = NULL; query->group_by = NULL; @@ -1839,5 +1871,6 @@ skip_free_fields: delete fields; skip_free_table_holder: spider_free(spider_current_trx, table_holder, MYF(0)); + my_bitmap_free(&skips); DBUG_RETURN(NULL); } diff --git a/storage/spider/spd_group_by_handler.h b/storage/spider/spd_group_by_handler.h index db100de92f2..0583229d4d7 100644 --- a/storage/spider/spd_group_by_handler.h +++ b/storage/spider/spd_group_by_handler.h @@ -23,12 +23,20 @@ class spider_group_by_handler: public group_by_handler bool first; longlong offset_limit; int store_error; + /* + Bitmap marking constant items among the select items. They are + SELECTed in the query executed at the data node, but not stored in + SPIDER_DB_ROW, because the temp table do not contain the + corresponding fields. + */ + MY_BITMAP skips; public: spider_group_by_handler( THD *thd_arg, Query *query_arg, - spider_fields *fields_arg + spider_fields *fields_arg, + const MY_BITMAP &skips1 ); ~spider_group_by_handler(); int init_scan() override;