1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
|
--source inc.inc
show variables like 'test_sql_discovery%';
set sql_quote_show_create=0;
let $mysqld_datadir= `select @@datadir`;
--error ER_CANT_CREATE_TABLE
create table t1 (a int) engine=test_sql_discovery;
--error ER_NO_SUCH_TABLE
select * from t1;
set @@test_sql_discovery_statement='t1:foobar bwa-ha-ha';
--error ER_NO_SUCH_TABLE
select * from t0;
--error ER_SQL_DISCOVER_ERROR
select * from t1;
show warnings;
#
# test different invalid discovering statements
#
set @@test_sql_discovery_statement='t1:select 1';
--error ER_SQL_DISCOVER_ERROR
select * from t1;
show warnings;
set @@test_sql_discovery_statement='t1:create table t1 (a int primary key) partition by hash(id) partitions 2';
--error ER_SQL_DISCOVER_ERROR
select * from t1;
show warnings;
set @@test_sql_discovery_statement='t1:create table t1 (a int) union=(t3,t4)';
--error ER_SQL_DISCOVER_ERROR
select * from t1;
show warnings;
set @@test_sql_discovery_statement='t1:create table t1 like t2';
--error ER_SQL_DISCOVER_ERROR
select * from t1;
show warnings;
set @@test_sql_discovery_statement='t1:create table t1 select * from t2';
--error ER_SQL_DISCOVER_ERROR
select * from t1;
show warnings;
set @@test_sql_discovery_statement='t1:create table t1 (a int) index directory="/tmp"';
--error ER_SQL_DISCOVER_ERROR
select * from t1;
show warnings;
set @@test_sql_discovery_statement='t1:create table t1 (a int) data directory="/tmp"';
--error ER_SQL_DISCOVER_ERROR
select * from t1;
show warnings;
set @@test_sql_discovery_statement='t1:create table t1 (a int) engine=myisam';
--error ER_SQL_DISCOVER_ERROR
select * from t1;
show warnings;
set @@test_sql_discovery_statement='t1:create temporary table t1 (a int)';
--error ER_SQL_DISCOVER_ERROR
select * from t1;
show warnings;
set @@test_sql_discovery_statement='t1:create table if not exists t1 (a int)';
--error ER_SQL_DISCOVER_ERROR
select * from t1;
show warnings;
set @@test_sql_discovery_statement='t1:create table t1 (a uint)';
--error ER_SQL_DISCOVER_ERROR
select * from t1;
show warnings;
#
# this should work:
#
set @@test_sql_discovery_statement='t1:create table t1 (a int)';
select * from t1;
show create table t1;
drop table t1;
# table name in the create table statement is ignored
set @@test_sql_discovery_statement='t1:create table t2 (a int)';
select * from t1;
--error ER_NO_SUCH_TABLE
select * from t2;
drop table t1;
set @@test_sql_discovery_statement='t1:create table t1 (a int) engine=test_sql_discovery';
select * from t1;
drop table t1;
# and something more complex
set @@test_sql_discovery_statement='t1:
create table t1 (
a int not null default 5 primary key,
b timestamp,
c tinyblob,
d decimal(5,2),
e varchar(30) character set ascii,
f geometry not null,
index (d,b),
unique index (c(10)),
fulltext (e),
spatial (f)
) comment="abc" default character set utf8 max_rows=100 min_rows=10 checksum=1';
show status like 'handler_discover';
show create table t1;
show status like 'handler_discover';
--echo ----
--list_files $mysqld_datadir/test t*
--echo ----
show open tables from test;
select * from t1;
show status like 'handler_discover';
flush tables;
select * from t1;
show status like 'handler_discover';
drop table t1;
set @@test_sql_discovery_write_frm=0;
set @@test_sql_discovery_statement='t1:create table t1 (a int)';
show status like 'handler_discover';
show create table t1;
show status like 'handler_discover';
--echo ----
--list_files $mysqld_datadir/test t*
--echo ----
show open tables from test;
select * from t1;
show status like 'handler_discover';
flush tables;
select * from t1;
show status like 'handler_discover';
drop table t1;
show status like 'handler_discover';
|