diff options
author | unknown <baker/brian@zim.(none)> | 2006-08-10 18:29:25 -0700 |
---|---|---|
committer | unknown <baker/brian@zim.(none)> | 2006-08-10 18:29:25 -0700 |
commit | bcc3b17ff5fd8835176b05123f0cfa8aba5ab6e0 (patch) | |
tree | 9590d41035168e2c4500f9699c3ab097b92acccc | |
parent | 189b8bc5313dc7cddcc225a40c1b2aacd0c2b61e (diff) | |
download | mariadb-git-bcc3b17ff5fd8835176b05123f0cfa8aba5ab6e0.tar.gz |
Removed bdb test cases.
BitKeeper/deleted/.del-bdb-alter-table-1.result:
Rename: mysql-test/r/bdb-alter-table-1.result -> BitKeeper/deleted/.del-bdb-alter-table-1.result
BitKeeper/deleted/.del-bdb-alter-table-1.test:
Rename: mysql-test/t/bdb-alter-table-1.test -> BitKeeper/deleted/.del-bdb-alter-table-1.test
BitKeeper/deleted/.del-bdb-alter-table-2-master.opt:
Rename: mysql-test/t/bdb-alter-table-2-master.opt -> BitKeeper/deleted/.del-bdb-alter-table-2-master.opt
BitKeeper/deleted/.del-bdb-alter-table-2.result:
Rename: mysql-test/r/bdb-alter-table-2.result -> BitKeeper/deleted/.del-bdb-alter-table-2.result
BitKeeper/deleted/.del-bdb-alter-table-2.test:
Rename: mysql-test/t/bdb-alter-table-2.test -> BitKeeper/deleted/.del-bdb-alter-table-2.test
BitKeeper/deleted/.del-bdb-crash.result:
Rename: mysql-test/r/bdb-crash.result -> BitKeeper/deleted/.del-bdb-crash.result
BitKeeper/deleted/.del-bdb-crash.test:
Rename: mysql-test/t/bdb-crash.test -> BitKeeper/deleted/.del-bdb-crash.test
BitKeeper/deleted/.del-bdb-deadlock.result:
Rename: mysql-test/r/bdb-deadlock.result -> BitKeeper/deleted/.del-bdb-deadlock.result
BitKeeper/deleted/.del-bdb-deadlock.test:
Rename: mysql-test/t/bdb-deadlock.test -> BitKeeper/deleted/.del-bdb-deadlock.test
BitKeeper/deleted/.del-bdb-deadlock.tminus:
Rename: mysql-test/t/bdb-deadlock.tminus -> BitKeeper/deleted/.del-bdb-deadlock.tminus
BitKeeper/deleted/.del-bdb.result:
Rename: mysql-test/r/bdb.result -> BitKeeper/deleted/.del-bdb.result
BitKeeper/deleted/.del-bdb.test:
Rename: mysql-test/t/bdb.test -> BitKeeper/deleted/.del-bdb.test
BitKeeper/deleted/.del-bdb_cache-master.opt~e54093fff2e73631:
Rename: mysql-test/t/bdb_cache-master.opt -> BitKeeper/deleted/.del-bdb_cache-master.opt~e54093fff2e73631
BitKeeper/deleted/.del-bdb_cache.result~5767ff4f4b228a66:
Rename: mysql-test/r/bdb_cache.result -> BitKeeper/deleted/.del-bdb_cache.result~5767ff4f4b228a66
BitKeeper/deleted/.del-bdb_cache.test~818df448403a5598:
Rename: mysql-test/t/bdb_cache.test -> BitKeeper/deleted/.del-bdb_cache.test~818df448403a5598
BitKeeper/deleted/.del-bdb_gis.result:
Rename: mysql-test/r/bdb_gis.result -> BitKeeper/deleted/.del-bdb_gis.result
BitKeeper/deleted/.del-bdb_gis.test:
Rename: mysql-test/t/bdb_gis.test -> BitKeeper/deleted/.del-bdb_gis.test
BitKeeper/deleted/.del-have_bdb.inc:
Rename: mysql-test/include/have_bdb.inc -> BitKeeper/deleted/.del-have_bdb.inc
BitKeeper/deleted/.del-have_bdb.require:
Rename: mysql-test/r/have_bdb.require -> BitKeeper/deleted/.del-have_bdb.require
BitKeeper/deleted/.del-index_merge_bdb.result:
Rename: mysql-test/r/index_merge_bdb.result -> BitKeeper/deleted/.del-index_merge_bdb.result
BitKeeper/deleted/.del-index_merge_bdb.test:
Rename: mysql-test/t/index_merge_bdb.test -> BitKeeper/deleted/.del-index_merge_bdb.test
BitKeeper/deleted/.del-ps_6bdb.result:
Rename: mysql-test/r/ps_6bdb.result -> BitKeeper/deleted/.del-ps_6bdb.result
BitKeeper/deleted/.del-ps_6bdb.test:
Rename: mysql-test/t/ps_6bdb.test -> BitKeeper/deleted/.del-ps_6bdb.test
BitKeeper/deleted/.del-rowid_order_bdb.result:
Rename: mysql-test/r/rowid_order_bdb.result -> BitKeeper/deleted/.del-rowid_order_bdb.result
BitKeeper/deleted/.del-rowid_order_bdb.test:
Rename: mysql-test/t/rowid_order_bdb.test -> BitKeeper/deleted/.del-rowid_order_bdb.test
BitKeeper/deleted/.del-sql_manager.h:
Rename: sql/sql_manager.h -> BitKeeper/deleted/.del-sql_manager.h
libmysqld/Makefile.am:
Removed bdb from the engine
mysql-test/extra/binlog_tests/binlog.test:
Removed bdb support
mysql-test/r/binlog_stm_binlog.result:
Updated results
mysql-test/r/ctype_utf8.result:
Removed bdb support
mysql-test/t/ctype_utf8.test:
Removed bdb support
sql/CMakeLists.txt:
Removed file for Windows build
sql/Makefile.am:
Removed unneeded include file.
sql/sql_manager.cc:
Removed include file.
34 files changed, 15 insertions, 7631 deletions
diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am index 7fddfee51f0..9e85c46575d 100644 --- a/libmysqld/Makefile.am +++ b/libmysqld/Makefile.am @@ -45,7 +45,7 @@ noinst_HEADERS = embedded_priv.h emb_qcache.h sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \ ha_heap.cc ha_myisam.cc ha_myisammrg.cc \ - ha_innodb.cc ha_berkeley.cc ha_federated.cc ha_ndbcluster.cc \ + ha_innodb.cc ha_federated.cc ha_ndbcluster.cc \ ha_ndbcluster_binlog.cc ha_partition.cc \ handler.cc sql_handler.cc \ hostname.cc init.cc password.c \ @@ -96,10 +96,6 @@ yassl_inc_libs= $(top_srcdir)/extra/yassl/src/.libs/libyassl.a \ endif # Storage engine specific compilation options - -ha_berkeley.o: ha_berkeley.cc - $(CXXCOMPILE) $(LM_CFLAGS) -c $< - ha_ndbcluster.o:ha_ndbcluster.cc $(CXXCOMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $< diff --git a/mysql-test/extra/binlog_tests/binlog.test b/mysql-test/extra/binlog_tests/binlog.test index 993b3fbf634..fe66647ec68 100644 --- a/mysql-test/extra/binlog_tests/binlog.test +++ b/mysql-test/extra/binlog_tests/binlog.test @@ -3,7 +3,6 @@ # -- source include/not_embedded.inc --- source include/have_bdb.inc -- source include/have_innodb.inc -- source include/have_debug.inc @@ -12,7 +11,7 @@ drop table if exists t1, t2; --enable_warnings reset master; -create table t1 (a int) engine=bdb; +create table t1 (a int) engine=innodb; create table t2 (a int) engine=innodb; begin; insert t1 values (5); diff --git a/mysql-test/include/have_bdb.inc b/mysql-test/include/have_bdb.inc deleted file mode 100644 index 3f7377e7515..00000000000 --- a/mysql-test/include/have_bdb.inc +++ /dev/null @@ -1,4 +0,0 @@ --- require r/have_bdb.require -disable_query_log; -show variables like "have_bdb"; -enable_query_log; diff --git a/mysql-test/r/bdb-alter-table-1.result b/mysql-test/r/bdb-alter-table-1.result deleted file mode 100644 index 0401002f1f3..00000000000 --- a/mysql-test/r/bdb-alter-table-1.result +++ /dev/null @@ -1,11 +0,0 @@ -drop table if exists t1; -create table t1(objid BIGINT not null, tablename varchar(64), oid BIGINT not null, test BIGINT, PRIMARY KEY (objid), UNIQUE(tablename)) engine=BDB; -insert into t1 values(1, 't1',4,9); -insert into t1 values(2, 'metatable',1,9); -insert into t1 values(3, 'metaindex',1,9 ); -select * from t1; -objid tablename oid test -1 t1 4 9 -2 metatable 1 9 -3 metaindex 1 9 -alter table t1 drop column test; diff --git a/mysql-test/r/bdb-alter-table-2.result b/mysql-test/r/bdb-alter-table-2.result deleted file mode 100644 index c23b5ba0031..00000000000 --- a/mysql-test/r/bdb-alter-table-2.result +++ /dev/null @@ -1,6 +0,0 @@ -select * from t1; -objid tablename oid -1 t1 4 -2 metatable 1 -3 metaindex 1 -drop table t1; diff --git a/mysql-test/r/bdb-crash.result b/mysql-test/r/bdb-crash.result deleted file mode 100644 index 51b15d08859..00000000000 --- a/mysql-test/r/bdb-crash.result +++ /dev/null @@ -1,39 +0,0 @@ -drop table if exists t1; -CREATE TABLE t1 ( -ChargeID int(10) unsigned NOT NULL auto_increment, -ServiceID int(10) unsigned DEFAULT '0' NOT NULL, -ChargeDate date DEFAULT '0000-00-00' NOT NULL, -ChargeAmount decimal(20,2) DEFAULT '0.00' NOT NULL, -FedTaxes decimal(20,2) DEFAULT '0.00' NOT NULL, -ProvTaxes decimal(20,2) DEFAULT '0.00' NOT NULL, -ChargeStatus enum('New','Auth','Unauth','Sale','Denied','Refund') -DEFAULT 'New' NOT NULL, -ChargeAuthorizationMessage text, -ChargeComment text, -ChargeTimeStamp varchar(20), -PRIMARY KEY (ChargeID), -KEY ServiceID (ServiceID), -KEY ChargeDate (ChargeDate) -) engine=BDB; -BEGIN; -INSERT INTO t1 -VALUES(NULL,1,'2001-03-01',1,1,1,'New',NULL,NULL,'now'); -COMMIT; -BEGIN; -UPDATE t1 SET ChargeAuthorizationMessage = 'blablabla' WHERE -ChargeID = 1; -COMMIT; -INSERT INTO t1 -VALUES(NULL,1,'2001-03-01',1,1,1,'New',NULL,NULL,'now'); -select * from t1; -ChargeID ServiceID ChargeDate ChargeAmount FedTaxes ProvTaxes ChargeStatus ChargeAuthorizationMessage ChargeComment ChargeTimeStamp -1 1 2001-03-01 1.00 1.00 1.00 New blablabla NULL now -2 1 2001-03-01 1.00 1.00 1.00 New NULL NULL now -drop table t1; -create table t1 (a int) engine=bdb; -set autocommit=0; -insert into t1 values(1); -analyze table t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -drop table t1; diff --git a/mysql-test/r/bdb-deadlock.result b/mysql-test/r/bdb-deadlock.result deleted file mode 100644 index 9394c90ff00..00000000000 --- a/mysql-test/r/bdb-deadlock.result +++ /dev/null @@ -1,31 +0,0 @@ -drop table if exists t1,t2; -create table t1 (id integer, x integer) engine=BDB; -create table t2 (id integer, x integer) engine=BDB; -insert into t1 values(0, 0); -insert into t2 values(0, 0); -set autocommit=0; -update t1 set x = 1 where id = 0; -set autocommit=0; -update t2 set x = 1 where id = 0; -select x from t1 where id = 0; -select x from t2 where id = 0; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -commit; -x -1 -commit; -select * from t1; -id x -0 1 -select * from t2; -id x -0 1 -commit; -select * from t1; -id x -0 1 -select * from t2; -id x -0 1 -commit; -drop table t1,t2; diff --git a/mysql-test/r/bdb.result b/mysql-test/r/bdb.result deleted file mode 100644 index f2d9c5704bb..00000000000 --- a/mysql-test/r/bdb.result +++ /dev/null @@ -1,1984 +0,0 @@ -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8; -create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=bdb; -insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt'); -select id, code, name from t1 order by id; -id code name -1 1 Tim -2 1 Monty -3 2 David -4 2 Erik -5 3 Sasha -6 3 Jeremy -7 4 Matt -update ignore t1 set id = 8, name = 'Sinisa' where id < 3; -select id, code, name from t1 order by id; -id code name -2 1 Monty -3 2 David -4 2 Erik -5 3 Sasha -6 3 Jeremy -7 4 Matt -8 1 Sinisa -update ignore t1 set id = id + 10, name = 'Ralph' where id < 4; -select id, code, name from t1 order by id; -id code name -3 2 David -4 2 Erik -5 3 Sasha -6 3 Jeremy -7 4 Matt -8 1 Sinisa -12 1 Ralph -drop table t1; -CREATE TABLE t1 ( -id int(11) NOT NULL auto_increment, -parent_id int(11) DEFAULT '0' NOT NULL, -level tinyint(4) DEFAULT '0' NOT NULL, -PRIMARY KEY (id), -KEY parent_id (parent_id), -KEY level (level) -) engine=bdb; -INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2); -update t1 set parent_id=parent_id+100; -select * from t1 where parent_id=102; -id parent_id level -8 102 2 -9 102 2 -15 102 2 -update t1 set id=id+1000; -update t1 set id=1024 where id=1009; -ERROR 23000: Duplicate entry '1024' for key 'PRIMARY' -select * from t1; -id parent_id level -1001 100 0 -1002 101 1 -1003 101 1 -1004 101 1 -1005 101 1 -1006 101 1 -1007 101 1 -1008 102 2 -1009 102 2 -1015 102 2 -1016 103 2 -1017 103 2 -1018 103 2 -1019 103 2 -1020 103 2 -1021 104 2 -1022 104 2 -1024 104 2 -1025 105 2 -1026 105 2 -1027 105 2 -1028 105 2 -1029 105 2 -1030 105 2 -1031 106 2 -1032 106 2 -1033 106 2 -1034 106 2 -1035 106 2 -1036 107 2 -1037 107 2 -1038 107 2 -1040 107 2 -1157 100 0 -1179 105 2 -1183 104 2 -1193 105 2 -1202 107 2 -1203 107 2 -update ignore t1 set id=id+1; -select * from t1; -id parent_id level -1001 100 0 -1002 101 1 -1003 101 1 -1004 101 1 -1005 101 1 -1006 101 1 -1007 101 1 -1008 102 2 -1010 102 2 -1015 102 2 -1016 103 2 -1017 103 2 -1018 103 2 -1019 103 2 -1020 103 2 -1021 104 2 -1023 104 2 -1024 104 2 -1025 105 2 -1026 105 2 -1027 105 2 -1028 105 2 -1029 105 2 -1030 105 2 -1031 106 2 -1032 106 2 -1033 106 2 -1034 106 2 -1035 106 2 -1036 107 2 -1037 107 2 -1039 107 2 -1041 107 2 -1158 100 0 -1180 105 2 -1184 104 2 -1194 105 2 -1202 107 2 -1204 107 2 -update ignore t1 set id=1023 where id=1010; -select * from t1 where parent_id=102 order by parent_id,id; -id parent_id level -1008 102 2 -1010 102 2 -1015 102 2 -explain select level from t1 where level=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref level level 1 const X Using index -explain select level,id from t1 where level=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref level level 1 const X Using index -explain select level,id,parent_id from t1 where level=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref level level 1 const X -select level,id from t1 where level=1; -level id -1 1002 -1 1003 -1 1004 -1 1005 -1 1006 -1 1007 -select level,id,parent_id from t1 where level=1; -level id parent_id -1 1002 101 -1 1003 101 -1 1004 101 -1 1005 101 -1 1006 101 -1 1007 101 -optimize table t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -show keys from t1; -Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment -t1 0 PRIMARY 1 id A 39 NULL NULL BTREE -t1 1 parent_id 1 parent_id A 9 NULL NULL BTREE -t1 1 level 1 level A 3 NULL NULL BTREE -drop table t1; -CREATE TABLE t1 ( -gesuchnr int(11) DEFAULT '0' NOT NULL, -benutzer_id int(11) DEFAULT '0' NOT NULL, -PRIMARY KEY (gesuchnr,benutzer_id) -) engine=BDB; -replace into t1 (gesuchnr,benutzer_id) values (2,1); -replace into t1 (gesuchnr,benutzer_id) values (1,1); -replace into t1 (gesuchnr,benutzer_id) values (1,1); -select * from t1; -gesuchnr benutzer_id -1 1 -2 1 -drop table t1; -create table t1 (id int not null primary key, x int not null, key (x)) engine=bdb; -insert into t1 (id, x) values (1, 1); -replace into t1 (id, x) values (1, 2); -select * from t1; -id x -1 2 -drop table t1; -create table t1 (a int) engine=bdb; -insert into t1 values (1), (2); -optimize table t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -delete from t1 where a = 1; -select * from t1; -a -2 -check table t1; -Table Op Msg_type Msg_text -test.t1 check note The storage engine for the table doesn't support check -drop table t1; -create table t1 (a int,b varchar(20)) engine=bdb; -insert into t1 values (1,""), (2,"testing"); -delete from t1 where a = 1; -select * from t1; -a b -2 testing -create index skr on t1 (a); -insert into t1 values (3,""), (4,"testing"); -analyze table t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -show keys from t1; -Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment -t1 1 skr 1 a A 3 NULL NULL YES BTREE -drop table t1; -create table t1 (a int,b varchar(20),key(a)) engine=bdb; -insert into t1 values (1,""), (2,"testing"); -select * from t1 where a = 1; -a b -1 -drop table t1; -create table t1 (a char(10) not null, b int not null auto_increment, primary key(a,b)) engine=BDB; -insert into t1 values ("a",1),("b",2),("a",2),("c",1); -insert into t1 values ("a",NULL),("b",NULL),("c",NULL),("e",NULL); -insert into t1 (a) values ("a"),("b"),("c"),("d"); -insert into t1 (a) values ('k'),('d'); -insert into t1 (a) values ("a"); -insert into t1 values ("d",last_insert_id()); -select * from t1; -a b -a 1 -a 2 -a 3 -a 4 -a 5 -b 2 -b 3 -b 4 -c 1 -c 2 -c 3 -d 1 -d 2 -d 5 -e 1 -k 1 -flush tables; -select count(*) from t1; -count(*) -16 -drop table t1; -create table t1 (n int not null primary key) engine=bdb; -set autocommit=0; -insert into t1 values (4); -rollback; -select n, "after rollback" from t1; -n after rollback -insert into t1 values (4); -commit; -select n, "after commit" from t1; -n after commit -4 after commit -commit; -insert into t1 values (5); -insert into t1 values (4); -ERROR 23000: Duplicate entry '4' for key 'PRIMARY' -commit; -select n, "after commit" from t1; -n after commit -4 after commit -5 after commit -set autocommit=1; -insert into t1 values (6); -insert into t1 values (4); -ERROR 23000: Duplicate entry '4' for key 'PRIMARY' -select n from t1; -n -4 -5 -6 -set autocommit=0; -begin; -savepoint `my_savepoint`; -insert into t1 values (7); -savepoint `savept2`; -insert into t1 values (3); -select n from t1; -n -3 -4 -5 -6 -7 -savepoint savept3; -rollback to savepoint savept2; -rollback to savepoint savept3; -ERROR 42000: SAVEPOINT savept3 does not exist -rollback to savepoint savept2; -release savepoint `my_savepoint`; -select n from t1; -n -4 -5 -6 -7 -rollback to savepoint `my_savepoint`; -ERROR 42000: SAVEPOINT my_savepoint does not exist -rollback to savepoint savept2; -ERROR 42000: SAVEPOINT savept2 does not exist -insert into t1 values (8); -savepoint sv; -commit; -savepoint sv; -set autocommit=1; -rollback; -drop table t1; -create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) engine=BDB; -begin; -insert into t1 values(1,'hamdouni'); -select id as afterbegin_id,nom as afterbegin_nom from t1; -afterbegin_id afterbegin_nom -1 hamdouni -rollback; -select id as afterrollback_id,nom as afterrollback_nom from t1; -afterrollback_id afterrollback_nom -set autocommit=0; -insert into t1 values(2,'mysql'); -select id as afterautocommit0_id,nom as afterautocommit0_nom from t1; -afterautocommit0_id afterautocommit0_nom -2 mysql -rollback; -select id as afterrollback_id,nom as afterrollback_nom from t1; -afterrollback_id afterrollback_nom -set autocommit=1; -drop table t1; -CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=bdb; -insert into t1 values ('pippo', 12); -insert into t1 values ('pippo', 12); -ERROR 23000: Duplicate entry 'pippo' for key 'PRIMARY' -delete from t1; -delete from t1 where id = 'pippo'; -select * from t1; -id val -insert into t1 values ('pippo', 12); -set autocommit=0; -delete from t1; -rollback; -select * from t1; -id val -pippo 12 -delete from t1; -commit; -select * from t1; -id val -drop table t1; -set autocommit=1; -CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) ENGINE=BDB; -INSERT INTO t1 VALUES (1, 'Jochen'); -select * from t1; -ID NAME -1 Jochen -drop table t1; -CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) ENGINE=BDB; -set autocommit=0; -INSERT INTO t1 SET _userid='marc@anyware.co.uk'; -COMMIT; -SELECT * FROM t1; -_userid -marc@anyware.co.uk -SELECT _userid FROM t1 WHERE _userid='marc@anyware.co.uk'; -_userid -marc@anyware.co.uk -drop table t1; -set autocommit=1; -CREATE TABLE t1 ( -user_id int(10) DEFAULT '0' NOT NULL, -name varchar(100), -phone varchar(100), -ref_email varchar(100) DEFAULT '' NOT NULL, -detail varchar(200), -PRIMARY KEY (user_id,ref_email) -)engine=bdb; -INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar'); -select * from t1 where user_id=10292; -user_id name phone ref_email detail -10292 sanjeev 29153373 sansh777@hotmail.com xxx -10292 shirish 2333604 shirish@yahoo.com ddsds -10292 sonali 323232 sonali@bolly.com filmstar -INSERT INTO t1 VALUES (10291,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10293,'shirish','2333604','shirish@yahoo.com','ddsds'); -select * from t1 where user_id=10292; -user_id name phone ref_email detail -10292 sanjeev 29153373 sansh777@hotmail.com xxx -10292 shirish 2333604 shirish@yahoo.com ddsds -10292 sonali 323232 sonali@bolly.com filmstar -select * from t1 where user_id>=10292; -user_id name phone ref_email detail -10292 sanjeev 29153373 sansh777@hotmail.com xxx -10292 shirish 2333604 shirish@yahoo.com ddsds -10292 sonali 323232 sonali@bolly.com filmstar -10293 shirish 2333604 shirish@yahoo.com ddsds -select * from t1 where user_id>10292; -user_id name phone ref_email detail -10293 shirish 2333604 shirish@yahoo.com ddsds -select * from t1 where user_id<10292; -user_id name phone ref_email detail -10291 sanjeev 29153373 sansh777@hotmail.com xxx -drop table t1; -CREATE TABLE t1 (a int not null, b int not null,c int not null, -key(a),primary key(a,b), unique(c),key(a),unique(b)); -show index from t1; -Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment -t1 0 PRIMARY 1 a A NULL NULL NULL BTREE -t1 0 PRIMARY 2 b A 0 NULL NULL BTREE -t1 0 c 1 c A 0 NULL NULL BTREE -t1 0 b 1 b A 0 NULL NULL BTREE -t1 1 a 1 a A NULL NULL NULL BTREE -t1 1 a_2 1 a A NULL NULL NULL BTREE -drop table t1; -create table t1 (col1 int not null, col2 char(4) not null, primary key(col1)); -alter table t1 engine=BDB; -insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4'); -select * from t1; -col1 col2 -1 1 -2 3 -3 4 -4 4 -5 2 -update t1 set col2='7' where col1='4'; -select * from t1; -col1 col2 -1 1 -2 3 -3 4 -4 7 -5 2 -alter table t1 add co3 int not null; -select * from t1; -col1 col2 co3 -1 1 0 -2 3 0 -3 4 0 -4 7 0 -5 2 0 -update t1 set col2='9' where col1='2'; -select * from t1; -col1 col2 co3 -1 1 0 -2 9 0 -3 4 0 -4 7 0 -5 2 0 -drop table t1; -create table t1 (a int not null , b int, primary key (a)) engine = BDB; -create table t2 (a int not null , b int, primary key (a)) engine = myisam; -insert into t1 VALUES (1,3) , (2,3), (3,3); -select * from t1; -a b -1 3 -2 3 -3 3 -insert into t2 select * from t1; -select * from t2; -a b -1 3 -2 3 -3 3 -delete from t1 where b = 3; -select * from t1; -a b -insert into t1 select * from t2; -select * from t1; -a b -1 3 -2 3 -3 3 -select * from t2; -a b -1 3 -2 3 -3 3 -drop table t1,t2; -CREATE TABLE t1 ( -id int(11) NOT NULL auto_increment, -ggid varchar(32) binary DEFAULT '' NOT NULL, -email varchar(64) DEFAULT '' NOT NULL, -passwd varchar(32) binary DEFAULT '' NOT NULL, -PRIMARY KEY (id), -UNIQUE ggid (ggid) -) ENGINE=BDB; -insert into t1 (ggid,passwd) values ('test1','xxx'); -insert into t1 (ggid,passwd) values ('test2','yyy'); -insert into t1 (ggid,passwd) values ('test2','this will fail'); -ERROR 23000: Duplicate entry 'test2' for key 'ggid' -insert into t1 (ggid,id) values ('this will fail',1); -ERROR 23000: Duplicate entry '1' for key 'PRIMARY' -select * from t1 where ggid='test1'; -id ggid email passwd -1 test1 xxx -select * from t1 where passwd='xxx'; -id ggid email passwd -1 test1 xxx -select * from t1 where id=2; -id ggid email passwd -2 test2 yyy -replace into t1 (ggid,id) values ('this will work',1); -replace into t1 (ggid,passwd) values ('test2','this will work'); -update t1 set id=100,ggid='test2' where id=1; -ERROR 23000: Duplicate entry 'test2' for key 'ggid' -select * from t1; -id ggid email passwd -1 this will work -3 test2 this will work -select * from t1 where id=1; -id ggid email passwd -1 this will work -select * from t1 where id=999; -id ggid email passwd -drop table t1; -CREATE TABLE t1 ( -user_name varchar(12), -password text, -subscribed char(1), -user_id int(11) DEFAULT '0' NOT NULL, -quota bigint(20), -weight double, -access_date date, -access_time time, -approved datetime, -dummy_primary_key int(11) NOT NULL auto_increment, -PRIMARY KEY (dummy_primary_key) -) ENGINE=BDB; -INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','23:06:59','2000-09-07 23:06:59',1); -INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','23:06:59','2000-09-07 23:06:59',2); -INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','23:06:59','2000-09-07 23:06:59',3); -INSERT INTO t1 VALUES ('user_3','somepassword','Y',3,3,1.7320508075689,'2000-09-07','23:06:59','2000-09-07 23:06:59',4); -INSERT INTO t1 VALUES ('user_4','somepassword','N',4,4,2,'2000-09-07','23:06:59','2000-09-07 23:06:59',5); -select user_name, password , subscribed, user_id, quota, weight, access_date, access_time, approved, dummy_primary_key from t1 order by user_name; -user_name password subscribed user_id quota weight access_date access_time approved dummy_primary_key -user_0 somepassword N 0 0 0 2000-09-07 23:06:59 2000-09-07 23:06:59 1 -user_1 somepassword Y 1 1 1 2000-09-07 23:06:59 2000-09-07 23:06:59 2 -user_2 somepassword N 2 2 1.4142135623731 2000-09-07 23:06:59 2000-09-07 23:06:59 3 -user_3 somepassword Y 3 3 1.7320508075689 2000-09-07 23:06:59 2000-09-07 23:06:59 4 -user_4 somepassword N 4 4 2 2000-09-07 23:06:59 2000-09-07 23:06:59 5 -drop table t1; -CREATE TABLE t1 ( -id int(11) NOT NULL auto_increment, -parent_id int(11) DEFAULT '0' NOT NULL, -level tinyint(4) DEFAULT '0' NOT NULL, -KEY (id), -KEY parent_id (parent_id), -KEY level (level) -) engine=bdb; -INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1); -INSERT INTO t1 values (179,5,2); -update t1 set parent_id=parent_id+100; -select * from t1 where parent_id=102; -id parent_id level -8 102 2 -9 102 2 -15 102 2 -update t1 set id=id+1000; -update t1 set id=1024 where id=1009; -select * from t1; -id parent_id level -1001 100 0 -1003 101 1 -1004 101 1 -1008 102 2 -1024 102 2 -1017 103 2 -1022 104 2 -1024 104 2 -1028 105 2 -1029 105 2 -1030 105 2 -1031 106 2 -1032 106 2 -1033 106 2 -1203 107 2 -1202 107 2 -1020 103 2 -1157 100 0 -1193 105 2 -1040 107 2 -1002 101 1 -1015 102 2 -1006 101 1 -1034 106 2 -1035 106 2 -1016 103 2 -1007 101 1 -1036 107 2 -1018 103 2 -1026 105 2 -1027 105 2 -1183 104 2 -1038 107 2 -1025 105 2 -1037 107 2 -1021 104 2 -1019 103 2 -1005 101 1 -1179 105 2 -update ignore t1 set id=id+1; -select * from t1; -id parent_id level -1002 100 0 -1004 101 1 -1005 101 1 -1009 102 2 -1025 102 2 -1018 103 2 -1023 104 2 -1025 104 2 -1029 105 2 -1030 105 2 -1031 105 2 -1032 106 2 -1033 106 2 -1034 106 2 -1204 107 2 -1203 107 2 -1021 103 2 -1158 100 0 -1194 105 2 -1041 107 2 -1003 101 1 -1016 102 2 -1007 101 1 -1035 106 2 -1036 106 2 -1017 103 2 -1008 101 1 -1037 107 2 -1019 103 2 -1027 105 2 -1028 105 2 -1184 104 2 -1039 107 2 -1026 105 2 -1038 107 2 -1022 104 2 -1020 103 2 -1006 101 1 -1180 105 2 -update ignore t1 set id=1023 where id=1010; -select * from t1 where parent_id=102; -id parent_id level -1009 102 2 -1025 102 2 -1016 102 2 -explain select level from t1 where level=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref level level 1 const X Using index -select level,id from t1 where level=1; -level id -1 1004 -1 1005 -1 1003 -1 1007 -1 1008 -1 1006 -select level,id,parent_id from t1 where level=1; -level id parent_id -1 1004 101 -1 1005 101 -1 1003 101 -1 1007 101 -1 1008 101 -1 1006 101 -select level,id from t1 where level=1 order by id; -level id -1 1003 -1 1004 -1 1005 -1 1006 -1 1007 -1 1008 -delete from t1 where level=1; -select * from t1; -id parent_id level -1002 100 0 -1009 102 2 -1025 102 2 -1018 103 2 -1023 104 2 -1025 104 2 -1029 105 2 -1030 105 2 -1031 105 2 -1032 106 2 -1033 106 2 -1034 106 2 -1204 107 2 -1203 107 2 -1021 103 2 -1158 100 0 -1194 105 2 -1041 107 2 -1016 102 2 -1035 106 2 -1036 106 2 -1017 103 2 -1037 107 2 -1019 103 2 -1027 105 2 -1028 105 2 -1184 104 2 -1039 107 2 -1026 105 2 -1038 107 2 -1022 104 2 -1020 103 2 -1180 105 2 -drop table t1; -CREATE TABLE t1 ( -sca_code char(6) NOT NULL, -cat_code char(6) NOT NULL, -sca_desc varchar(50), -lan_code char(2) NOT NULL, -sca_pic varchar(100), -sca_sdesc varchar(50), -sca_sch_desc varchar(16), -PRIMARY KEY (sca_code, cat_code, lan_code), -INDEX sca_pic (sca_pic) -) engine = bdb ; -INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING'); -select count(*) from t1 where sca_code = 'PD'; -count(*) -1 -select count(*) from t1 where sca_code <= 'PD'; -count(*) -1 -select count(*) from t1 where sca_pic is null; -count(*) -2 -alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic); -select count(*) from t1 where sca_code='PD' and sca_pic is null; -count(*) -1 -select count(*) from t1 where cat_code='E'; -count(*) -0 -alter table t1 drop index sca_pic, add index (sca_pic, cat_code); -select count(*) from t1 where sca_code='PD' and sca_pic is null; -count(*) -1 -select count(*) from t1 where sca_pic >= 'n'; -count(*) -1 -select sca_pic from t1 where sca_pic is null; -sca_pic -NULL -NULL -update t1 set sca_pic="test" where sca_pic is null; -delete from t1 where sca_code='pd'; -drop table t1; -set @a:=now(); -CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=bdb; -insert into t1 (a) values(1),(2),(3); -select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a; -a -1 -2 -3 -select a from t1 natural join t1 as t2 where b >= @a order by a; -a -1 -2 -3 -update t1 set a=5 where a=1; -select a from t1; -a -2 -3 -5 -drop table t1; -flush logs; -create table t1 (b blob, i int, key (b(100)), key (i), key (i, b(20))) engine=bdb; -insert into t1 values ('this is a blob', 1), (null, -1), (null, null),("",1),("",2),("",3); -select b from t1 where b = 'this is a blob'; -b -this is a blob -select * from t1 where b like 't%'; -b i -this is a blob 1 -select b, i from t1 where b is not null; -b i -this is a blob 1 - 1 - 2 - 3 -select * from t1 where b is null and i > 0; -b i -select * from t1 where i is NULL; -b i -NULL NULL -update t1 set b='updated' where i=1; -select * from t1; -b i -updated 1 -NULL -1 -NULL NULL -updated 1 - 2 - 3 -drop table t1; -create table t1 (a varchar(100) not null, primary key(a), b int not null) engine=bdb; -insert into t1 values("hello",1),("world",2); -select * from t1 order by b desc; -a b -world 2 -hello 1 -optimize table t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -show keys from t1; -Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment -t1 0 PRIMARY 1 a A 2 NULL NULL BTREE -drop table t1; -create table t1 (i int, j int )ENGINE=BDB; -insert into t1 values (1,2); -select * from t1 where i=1 and j=2; -i j -1 2 -create index ax1 on t1 (i,j); -select * from t1 where i=1 and j=2; -i j -1 2 -drop table t1; -create table t1 -( -branch_id int auto_increment primary key, -branch_name varchar(255) not null, -branch_active int not null default 1, -unique branch_name(branch_name), -index branch_active(branch_active) -) engine=bdb; -create table t2 -( -target_id int auto_increment primary key, -target_name varchar(255) not null, -target_active int not null default 1, -unique target_name(target_name), -index target_active(target_active) -) engine=bdb; -create table t3 -( -platform_id int auto_increment primary key, -platform_name varchar(255) not null, -platform_active int not null default 1, -unique platform_name(platform_name), -index platform_active(platform_active) -) engine=bdb; -create table t4 -( -product_id int auto_increment primary key, -product_name varchar(255) not null, -version_file varchar(255) not null, -product_active int not null default 1, -unique product_name(product_name), -index product_active(product_active) -) engine=bdb; -create table t5 -( -product_file_id int auto_increment primary key, -product_id int not null, -file_name varchar(255) not null, -/* cvs module used to find the file version */ -module_name varchar(255) not null, -/* flag whether the file is still included in the product */ -file_included int not null default 1, -unique product_file(product_id,file_name), -index file_included(file_included) -) engine=bdb; -create table t6 -( -file_platform_id int auto_increment primary key, -product_file_id int not null, -platform_id int not null, -branch_id int not null, -/* filename in the build system */ -build_filename varchar(255) not null, -/* default filename in the build archive */ -archive_filename varchar(255) not null, -unique file_platform(product_file_id,platform_id,branch_id) -) engine=bdb; -create table t8 -( -archive_id int auto_increment primary key, -branch_id int not null, -target_id int not null, -platform_id int not null, -product_id int not null, -status_id int not null default 1, -unique archive(branch_id,target_id,platform_id,product_id), -index status_id(status_id) -) engine=bdb; -create table t7 -( -build_id int auto_increment primary key, -branch_id int not null, -target_id int not null, -build_number int not null, -build_date date not null, -/* build system tag, e.g. 'rmanight-022301-1779' */ -build_tag varchar(255) not null, -/* path relative to the build archive root, e.g. 'current' */ -build_path text not null, -unique build(branch_id,target_id,build_number) -) engine=bdb; -insert into t1 (branch_name) -values ('RealMedia'); -insert into t1 (branch_name) -values ('RP8REV'); -insert into t1 (branch_name) -values ('SERVER_8_0_GOLD'); -insert into t2 (target_name) -values ('rmanight'); -insert into t2 (target_name) -values ('playerall'); -insert into t2 (target_name) -values ('servproxyall'); -insert into t3 (platform_name) -values ('linux-2.0-libc6-i386'); -insert into t3 (platform_name) -values ('win32-i386'); -insert into t4 (product_name, version_file) -values ('realserver', 'servinst'); -insert into t4 (product_name, version_file) -values ('realproxy', 'prxyinst'); -insert into t4 (product_name, version_file) -values ('realplayer', 'playinst'); -insert into t4 (product_name, version_file) -values ('plusplayer', 'plusinst'); -create temporary table tmp1 -select branch_id, target_id, platform_id, product_id -from t1, t2, t3, t4 ; -create temporary table tmp2 -select tmp1.branch_id, tmp1.target_id, tmp1.platform_id, tmp1.product_id -from tmp1 left join t8 -using (branch_id,target_id,platform_id,product_id) -where t8.archive_id is null ; -insert into t8 -(branch_id, target_id, platform_id, product_id, status_id) -select branch_id, target_id, platform_id, product_id, 1 -from tmp2 ; -drop table tmp1 ; -drop table tmp2 ; -insert into t5 (product_id, file_name, module_name) -values (1, 'servinst', 'server'); -insert into t5 (product_id, file_name, module_name) -values (2, 'prxyinst', 'server'); -insert into t5 (product_id, file_name, module_name) -values (3, 'playinst', 'rpapp'); -insert into t5 (product_id, file_name, module_name) -values (4, 'plusinst', 'rpapp'); -insert into t6 -(product_file_id,platform_id,branch_id,build_filename,archive_filename) -values (1, 2, 3, 'servinst.exe', 'win32-servinst.exe'); -insert into t6 -(product_file_id,platform_id,branch_id,build_filename,archive_filename) -values (1, 1, 3, 'v80_linux-2.0-libc6-i386_servinst.bin', 'linux2-servinst.exe'); -insert into t6 -(product_file_id,platform_id,branch_id,build_filename,archive_filename) -values (3, 2, 2, 'playinst.exe', 'win32-playinst.exe'); -insert into t6 -(product_file_id,platform_id,branch_id,build_filename,archive_filename) -values (4, 2, 2, 'playinst.exe', 'win32-playinst.exe'); -insert into t7 -(branch_id,target_id,build_number,build_tag,build_date,build_path) -values (2, 2, 1071, 'playerall-022101-1071', '2001-02-21', 'current'); -insert into t7 -(branch_id,target_id,build_number,build_tag,build_date,build_path) -values (2, 2, 1072, 'playerall-022201-1072', '2001-02-22', 'current'); -insert into t7 -(branch_id,target_id,build_number,build_tag,build_date,build_path) -values (3, 3, 388, 'servproxyall-022201-388', '2001-02-22', 'current'); -insert into t7 -(branch_id,target_id,build_number,build_tag,build_date,build_path) -values (3, 3, 389, 'servproxyall-022301-389', '2001-02-23', 'current'); -insert into t7 -(branch_id,target_id,build_number,build_tag,build_date,build_path) -values (4, 4, 100, 'foo target-010101-100', '2001-01-01', 'current'); -update t8 -set status_id=2 -where branch_id=2 and target_id=2 and platform_id=2 and product_id=1; -select t7.build_path -from -t1, -t7, -t2, -t3, -t4, -t5, -t6 -where -t7.branch_id = t1.branch_id and -t7.target_id = t2.target_id and -t5.product_id = t4.product_id and -t6.product_file_id = t5.product_file_id and -t6.platform_id = t3.platform_id and -t6.branch_id = t6.branch_id and -t7.build_id = 1 and -t4.product_id = 3 and -t5.file_name = 'playinst' and -t3.platform_id = 2; -build_path -current -drop table t1, t2, t3, t4, t5, t6, t7, t8; -CREATE TABLE t1 ( -a tinytext NOT NULL, -b tinyint(3) unsigned NOT NULL default '0', -PRIMARY KEY (a(32),b) -) ENGINE=BDB; -INSERT INTO t1 VALUES ('a',1),('a',2); -SELECT * FROM t1 WHERE a='a' AND b=2; -a b -a 2 -SELECT * FROM t1 WHERE a='a' AND b in (2); -a b -a 2 -SELECT * FROM t1 WHERE a='a' AND b in (1,2); -a b -a 1 -a 2 -drop table t1; -CREATE TABLE t1 ( -a int3 unsigned NOT NULL, -b int1 unsigned NOT NULL, -UNIQUE (a, b) -) ENGINE = BDB; -INSERT INTO t1 VALUES (1, 1); -SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1; -MIN(B) MAX(b) -1 1 -drop table t1; -create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=bdb; -insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); -LOCK TABLES t1 WRITE; -insert into t1 values (99,1,2,'D'),(1,1,2,'D'); -ERROR 23000: Duplicate entry '1-1' for key 'PRIMARY' -select id from t1; -id -0 -1 -2 -select id from t1; -id -0 -1 -2 -UNLOCK TABLES; -DROP TABLE t1; -create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=bdb; -insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); -LOCK TABLES t1 WRITE; -begin; -insert into t1 values (99,1,2,'D'),(1,1,2,'D'); -ERROR 23000: Duplicate entry '1-1' for key 'PRIMARY' -select id from t1; -id -0 -1 -2 -insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D'); -commit; -select id,id3 from t1; -id id3 -0 0 -1 1 -2 2 -100 2 -UNLOCK TABLES; -DROP TABLE t1; -CREATE TABLE t1 (SYAIN_NO char(5) NOT NULL default '', KINMU_DATE char(6) NOT NULL default '', PRIMARY KEY (SYAIN_NO,KINMU_DATE)) ENGINE=BerkeleyDB; -CREATE TABLE t2 ( SYAIN_NO char(5) NOT NULL default '',STR_DATE char(8) NOT NULL default '',PRIMARY KEY (SYAIN_NO,STR_DATE) ) ENGINE=BerkeleyDB; -select T1.KINMU_DATE from t1 T1 ,t2 T2 where T1.SYAIN_NO = '12345' and T1.KINMU_DATE = '200106' and T2.SYAIN_NO = T1.SYAIN_NO; -KINMU_DATE -select T1.KINMU_DATE from t1 T1 ,t2 T2 where T1.SYAIN_NO = '12345' and T1.KINMU_DATE = '200106' and T2.SYAIN_NO = T1.SYAIN_NO; -KINMU_DATE -DROP TABLE t1,t2; -create table t1 (a int(11) not null, b int(11) not null, unique (a,b)) engine=bdb; -insert into t1 values (1,1), (1,2); -select * from t1 where a = 1; -a b -1 1 -1 2 -select t1.*, t2.* from t1, t1 t2 where t1.a = t2.a and t2.a = 1; -a b a b -1 1 1 1 -1 1 1 2 -1 2 1 1 -1 2 1 2 -select * from t1 where a = 1; -a b -1 1 -1 2 -drop table t1; -create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=bdb; -insert into t1 values (0,0,0,'ABCDEFGHIJ'); -create table t2 (id int NOT NULL,primary key (id)) engine=bdb; -LOCK TABLES t1 WRITE, t2 WRITE; -insert into t2 values(1); -SELECT t1.* FROM t1 WHERE id IN (1); -id id2 id3 dummy1 -SELECT t1.* FROM t2 left outer join t1 on (t1.id=t2.id); -id id2 id3 dummy1 -NULL NULL NULL NULL -delete from t1 where id3 >= 0 and id3 <= 0; -drop table t1,t2; -CREATE TABLE t1 (i varchar(48) NOT NULL default '', p varchar(255) default NULL,s varchar(48) NOT NULL default '', PRIMARY KEY (i), UNIQUE(p,s)) ENGINE=BDB; -INSERT INTO t1 VALUES ('00000000-e6c4ddeaa6-003b8-83458387','programs/xxxxxxxx.wmv','00000000-e6c4ddeb32-003bc-83458387'); -SELECT * FROM t1 WHERE p='programs/xxxxxxxx.wmv'; -i p s -00000000-e6c4ddeaa6-003b8-83458387 programs/xxxxxxxx.wmv 00000000-e6c4ddeb32-003bc-83458387 -drop table t1; -CREATE TABLE t1 ( STR_DATE varchar(8) NOT NULL default '',INFO_NOTE varchar(200) default NULL,PRIMARY KEY (STR_DATE) ) ENGINE=BerkeleyDB; -select INFO_NOTE from t1 where STR_DATE = '20010610'; -INFO_NOTE -select INFO_NOTE from t1 where STR_DATE < '20010610'; -INFO_NOTE -select INFO_NOTE from t1 where STR_DATE > '20010610'; -INFO_NOTE -drop table t1; -create table t1 (a int not null, b int, primary key (a)) engine =bdb; -create table t2 (a int not null, b int, primary key (a)) engine =bdb; -insert into t1 values (2, 3),(1, 7),(10, 7); -insert into t2 values (2, 3),(1, 7),(10, 7); -select * from t1; -a b -1 7 -2 3 -10 7 -select * from t2; -a b -1 7 -2 3 -10 7 -delete t1, t2 from t1, t2 where t1.a = t2.a; -select * from t1; -a b -select * from t2; -a b -select * from t2; -a b -drop table t1,t2; -create table t1 (x int not null, index(x)) engine=bdb; -insert into t1 values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); -select * from t1 where x <= 10 and x >= 7; -x -7 -8 -9 -10 -select * from t1 where x <= 10 and x >= 7 order by x; -x -7 -8 -9 -10 -select * from t1 where x <= 10 and x >= 7 order by x desc; -x -10 -9 -8 -7 -select * from t1 where x <= 8 and x >= 5 order by x desc; -x -8 -7 -6 -5 -select * from t1 where x < 8 and x > 5 order by x desc; -x -7 -6 -drop table t1; -create table t1 ( c char(8) not null ) engine=bdb; -insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9'); -insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F'); -alter table t1 add b char(8) not null; -alter table t1 add a char(8) not null; -alter table t1 add primary key (a,b,c); -update t1 set a=c, b=c; -create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=bdb; -insert into t2 select * from t1; -delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b; -drop table t1,t2; -create table t1 (a char(10), key(a), b int not null, key(b)) engine=bdb; -insert into t1 values ('a',1),('A',2); -explain select a from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -select a from t1; -a -a -A -explain select b from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL b 4 NULL 2 Using index -select b from t1; -b -1 -2 -alter table t1 modify a char(10) binary; -explain select a from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 11 NULL 2 Using index -select a from t1; -a -A -a -drop table t1; -create table t1( -pk1 text not null, pk2 text not null, pk3 char(4), -key1 int, key2 int, -primary key(pk1(4), pk2(4), pk3), key(key1), key(key2) -) engine=bdb; -insert into t1 values (concat('aaa-', repeat('A', 4000)), -concat('eee-', repeat('e', 4000)), 'a++a', 1, 1); -insert into t1 values (concat('bbb-', repeat('B', 4000)), -concat('ggg-', repeat('G', 4000)), 'b++b', 1, 1); -select substring(pk1, 1, 4), substring(pk1, 4001), -substring(pk2, 1, 4), substring(pk2, 4001), pk3, key1, key2 -from t1 force index(key1, key2) where key1 < 3 or key2 < 3; -substring(pk1, 1, 4) substring(pk1, 4001) substring(pk2, 1, 4) substring(pk2, 4001) pk3 key1 key2 -aaa- AAAA eee- eeee a++a 1 1 -bbb- BBBB ggg- GGGG b++b 1 1 -drop table t1; -create table t1 ( -pk1 varchar(8) not null default '', -pk2 varchar(4) not null default '', -key1 int(11) default null, -key2 int(11) default null, -primary key (pk1,pk2), -key key1 (key1), -key key2 (key2)) engine=bdb; -insert into t1 values ('','empt',2,2), ('a','a--a',2,2), -('bb','b--b',2,2), ('ccc','c--c',2,2), ('dddd','d--d',2,2); -select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3; -pk1 pk2 key1 key2 - empt 2 2 -a a--a 2 2 -bb b--b 2 2 -ccc c--c 2 2 -dddd d--d 2 2 -drop table t1; -set autocommit=0; -create table t1(b varchar(30)) engine=bdb; -insert into t1 values ('one'); -commit; -select b FROM t1 outer_table where -exists (select 'two' from t1 where 'two' = outer_table.b); -b -drop table t1; -set autocommit=1; -create table t1(a int primary key, b varchar(30)) engine=bdb; -insert into t1 values (1,'one'), (2,'two'), (3,'three'), (4,'four'); -create table t2 like t1; -insert t2 select * from t1; -select a from t1 where a in (select a from t2); -a -1 -2 -3 -4 -delete from t2; -insert into t2 (a, b) -select a, b from t1 where (a, b) in (select a, b from t1); -select * from t2; -a b -1 one -2 two -3 three -4 four -drop table t1, t2; -create table t1 (a int, b varchar(30), primary key(a)) engine = bdb; -insert into t1 values (1,'one'); -commit; -truncate t1; -select * from t1; -a b -drop table t1; -SET NAMES utf8; -create table t1 (a varchar(255) character set utf8) engine=bdb; -set @a:= convert(repeat(_latin1 0xFF, 255) using utf8); -insert into t1 values (@a); -select a, length(a), char_length(a) from t1; -a length(a) char_length(a) -ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ 510 255 -drop table t1; -SET NAMES latin1; -CREATE TABLE t1 ( -id int unsigned NOT NULL auto_increment, -list_id smallint unsigned NOT NULL, -term TEXT NOT NULL, -PRIMARY KEY(id), -INDEX(list_id, term(4)) -) ENGINE=BDB CHARSET=utf8; -INSERT INTO t1 SET list_id = 1, term = "letterc"; -INSERT INTO t1 SET list_id = 1, term = "letterb"; -INSERT INTO t1 SET list_id = 1, term = "lettera"; -INSERT INTO t1 SET list_id = 1, term = "letterd"; -SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterc"); -id -1 -SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterb"); -id -2 -SELECT id FROM t1 WHERE (list_id = 1) AND (term = "lettera"); -id -3 -SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterd"); -id -4 -DROP TABLE t1; -create table t1 (a int, key(a)) engine=bdb; -create table t2 (b int, key(b)) engine=bdb; -insert into t1 values (1),(1),(2),(3),(4); -insert into t2 values (1),(5),(6),(7); -delete from t1 where (a in (select b from t2)); -select count(*) from t1; -count(*) -3 -insert into t1 set a=(select b from t2); -ERROR 21000: Subquery returns more than 1 row -select count(*) from t1; -count(*) -3 -update t1 set a = a + 1 where (a in (select b from t2)); -select count(*) from t1; -count(*) -3 -drop table t1, t2; -End of 4.1 tests -create temporary table t1 (a int, primary key(a)) engine=bdb; -select * from t1; -a -alter table t1 add b int; -select * from t1; -a b -drop table t1; -set storage_engine=bdb; -drop table if exists t1,t2,t3; ---- Testing varchar --- ---- Testing varchar --- -create table t1 (v varchar(10), c char(10), t text); -insert into t1 values('+ ', '+ ', '+ '); -set @a=repeat(' ',20); -insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a)); -Warnings: -Note 1265 Data truncated for column 'v' at row 1 -select concat('*',v,'*',c,'*',t,'*') from t1; -concat('*',v,'*',c,'*',t,'*') -*+ *+*+ * -*+ *+*+ * -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `v` varchar(10) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `t` text -) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1 -create table t2 like t1; -show create table t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `v` varchar(10) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `t` text -) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1 -create table t3 select * from t1; -show create table t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `v` varchar(10) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `t` text -) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1 -alter table t1 modify c varchar(10); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `v` varchar(10) DEFAULT NULL, - `c` varchar(10) DEFAULT NULL, - `t` text -) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1 -alter table t1 modify v char(10); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `v` char(10) DEFAULT NULL, - `c` varchar(10) DEFAULT NULL, - `t` text -) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1 -alter table t1 modify t varchar(10); -Warnings: -Note 1265 Data truncated for column 't' at row 2 -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `v` char(10) DEFAULT NULL, - `c` varchar(10) DEFAULT NULL, - `t` varchar(10) DEFAULT NULL -) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1 -select concat('*',v,'*',c,'*',t,'*') from t1; -concat('*',v,'*',c,'*',t,'*') -*+*+*+ * -*+*+*+ * -drop table t1,t2,t3; -create table t1 (v varchar(10), c char(10), t text, key(v), key(c), key(t(10))); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `v` varchar(10) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `t` text, - KEY `v` (`v`), - KEY `c` (`c`), - KEY `t` (`t`(10)) -) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1 -select count(*) from t1; -count(*) -270 -insert into t1 values(concat('a',char(1)),concat('a',char(1)),concat('a',char(1))); -select count(*) from t1 where v='a'; -count(*) -10 -select count(*) from t1 where c='a'; -count(*) -10 -select count(*) from t1 where t='a'; -count(*) -10 -select count(*) from t1 where v='a '; -count(*) -10 -select count(*) from t1 where c='a '; -count(*) -10 -select count(*) from t1 where t='a '; -count(*) -10 -select count(*) from t1 where v between 'a' and 'a '; -count(*) -10 -select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; -count(*) -10 -select count(*) from t1 where v like 'a%'; -count(*) -11 -select count(*) from t1 where c like 'a%'; -count(*) -11 -select count(*) from t1 where t like 'a%'; -count(*) -11 -select count(*) from t1 where v like 'a %'; -count(*) -9 -explain select count(*) from t1 where v='a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 13 const # Using where -explain select count(*) from t1 where c='a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref c c 11 const # Using where -explain select count(*) from t1 where t='a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range t t 13 NULL # Using where -explain select count(*) from t1 where v like 'a%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 13 NULL # Using where -explain select count(*) from t1 where v between 'a' and 'a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 13 const # Using where -explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 13 const # Using where -alter table t1 add unique(v); -ERROR 23000: Duplicate entry '{ ' for key 'v_2' -alter table t1 add key(v); -select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a'; -qq -*a*a*a* -*a *a*a * -*a *a*a * -*a *a*a * -*a *a*a * -*a *a*a * -*a *a*a * -*a *a*a * -*a *a*a * -*a *a*a * -explain select * from t1 where v='a'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v,v_2 # 13 const # Using where -select v,count(*) from t1 group by v limit 10; -v count(*) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select v,count(t) from t1 group by v limit 10; -v count(t) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select v,count(c) from t1 group by v limit 10; -v count(c) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select sql_big_result v,count(t) from t1 group by v limit 10; -v count(t) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select sql_big_result v,count(c) from t1 group by v limit 10; -v count(c) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select c,count(*) from t1 group by c limit 10; -c count(*) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select c,count(t) from t1 group by c limit 10; -c count(t) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select sql_big_result c,count(t) from t1 group by c limit 10; -c count(t) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select t,count(*) from t1 group by t limit 10; -t count(*) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select t,count(t) from t1 group by t limit 10; -t count(t) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select sql_big_result t,count(t) from t1 group by t limit 10; -t count(t) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -alter table t1 modify v varchar(300), drop key v, drop key v_2, add key v (v); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `v` varchar(300) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `t` text, - KEY `c` (`c`), - KEY `t` (`t`(10)), - KEY `v` (`v`) -) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1 -select count(*) from t1 where v='a'; -count(*) -10 -select count(*) from t1 where v='a '; -count(*) -10 -select count(*) from t1 where v between 'a' and 'a '; -count(*) -10 -select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; -count(*) -10 -select count(*) from t1 where v like 'a%'; -count(*) -11 -select count(*) from t1 where v like 'a %'; -count(*) -9 -explain select count(*) from t1 where v='a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 303 const # Using where -explain select count(*) from t1 where v like 'a%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 303 NULL # Using where -explain select count(*) from t1 where v between 'a' and 'a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 303 const # Using where -explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 303 const # Using where -explain select * from t1 where v='a'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 303 const # Using where -select v,count(*) from t1 group by v limit 10; -v count(*) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select v,count(t) from t1 group by v limit 10; -v count(t) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select sql_big_result v,count(t) from t1 group by v limit 10; -v count(t) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -alter table t1 drop key v, add key v (v(30)); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `v` varchar(300) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `t` text, - KEY `c` (`c`), - KEY `t` (`t`(10)), - KEY `v` (`v`(30)) -) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1 -select count(*) from t1 where v='a'; -count(*) -10 -select count(*) from t1 where v='a '; -count(*) -10 -select count(*) from t1 where v between 'a' and 'a '; -count(*) -10 -select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; -count(*) -10 -select count(*) from t1 where v like 'a%'; -count(*) -11 -select count(*) from t1 where v like 'a %'; -count(*) -9 -explain select count(*) from t1 where v='a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 33 const # Using where -explain select count(*) from t1 where v like 'a%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 33 NULL # Using where -explain select count(*) from t1 where v between 'a' and 'a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 33 const # Using where -explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 33 const # Using where -explain select * from t1 where v='a'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 33 const # Using where -select v,count(*) from t1 group by v limit 10; -v count(*) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select v,count(t) from t1 group by v limit 10; -v count(t) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select sql_big_result v,count(t) from t1 group by v limit 10; -v count(t) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -alter table t1 modify v varchar(600), drop key v, add key v (v); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `v` varchar(600) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `t` text, - KEY `c` (`c`), - KEY `t` (`t`(10)), - KEY `v` (`v`) -) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1 -select v,count(*) from t1 group by v limit 10; -v count(*) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select v,count(t) from t1 group by v limit 10; -v count(t) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select sql_big_result v,count(t) from t1 group by v limit 10; -v count(t) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -drop table t1; -create table t1 (a char(10), unique (a)); -insert into t1 values ('a '); -insert into t1 values ('a '); -ERROR 23000: Duplicate entry 'a' for key 'a' -alter table t1 modify a varchar(10); -insert into t1 values ('a '),('a '),('a '),('a '); -ERROR 23000: Duplicate entry 'a ' for key 'a' -insert into t1 values ('a '); -ERROR 23000: Duplicate entry 'a ' for key 'a' -insert into t1 values ('a '); -ERROR 23000: Duplicate entry 'a ' for key 'a' -insert into t1 values ('a '); -ERROR 23000: Duplicate entry 'a ' for key 'a' -update t1 set a='a ' where a like 'a%'; -select concat(a,'.') from t1; -concat(a,'.') -a . -update t1 set a='abc ' where a like 'a '; -select concat(a,'.') from t1; -concat(a,'.') -a . -update t1 set a='a ' where a like 'a %'; -select concat(a,'.') from t1; -concat(a,'.') -a . -update t1 set a='a ' where a like 'a '; -select concat(a,'.') from t1; -concat(a,'.') -a . -drop table t1; -create table t1 (v varchar(10), c char(10), t text, key(v(5)), key(c(5)), key(t(5))); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `v` varchar(10) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `t` text, - KEY `v` (`v`(5)), - KEY `c` (`c`(5)), - KEY `t` (`t`(5)) -) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1 -drop table t1; -create table t1 (v char(10) character set utf8); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `v` char(10) CHARACTER SET utf8 DEFAULT NULL -) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1 -drop table t1; -create table t1 (v varchar(10), c char(10)) row_format=fixed; -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `v` varchar(10) DEFAULT NULL, - `c` char(10) DEFAULT NULL -) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED -insert into t1 values('a','a'),('a ','a '); -select concat('*',v,'*',c,'*') from t1; -concat('*',v,'*',c,'*') -*a*a* -*a *a* -drop table t1; -create table t1 (v varchar(65530), key(v(10))); -insert into t1 values(repeat('a',65530)); -select length(v) from t1 where v=repeat('a',65530); -length(v) -65530 -drop table t1; -create table t1(a int, b varchar(12), key ba(b, a)); -insert into t1 values (1, 'A'), (20, NULL); -explain select * from t1 where a=20 and b is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref ba ba 20 const,const 1 Using where -select * from t1 where a=20 and b is null; -a b -20 NULL -drop table t1; -create table t1 (v varchar(65530), key(v)); -Warnings: -Warning 1071 Specified key was too long; max key length is MAX_KEY_LENGTH bytes -drop table if exists t1; -create table t1 (v varchar(65536)); -Warnings: -Note 1246 Converting column 'v' from VARCHAR to TEXT -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `v` mediumtext -) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1 -drop table t1; -create table t1 (v varchar(65530) character set utf8); -Warnings: -Note 1246 Converting column 'v' from VARCHAR to TEXT -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `v` mediumtext CHARACTER SET utf8 -) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1 -drop table t1; -set storage_engine=MyISAM; -create table t1 (a varchar(255) character set utf8, -b varchar(255) character set utf8, -c varchar(255) character set utf8, -d varchar(255) character set utf8, -key (a,b,c,d)) engine=bdb; -drop table t1; -create table t1 (a varchar(255) character set utf8, -b varchar(255) character set utf8, -c varchar(255) character set utf8, -d varchar(255) character set utf8, -e varchar(255) character set utf8, -key (a,b,c,d,e)) engine=bdb; -ERROR 42000: Specified key was too long; max key length is 3072 bytes -set autocommit=0; -create table t1 (a int) engine=bdb; -commit; -alter table t1 add primary key(a); -drop table t1; -End of 5.0 tests -create table t1 (a int) engine=bdb; -set session transaction isolation level repeatable read; -set transaction isolation level serializable; -begin; -select @@tx_isolation; -@@tx_isolation -SERIALIZABLE -insert into t1 values (1); -set transaction isolation level read committed; -ERROR 25001: Transaction isolation level can't be changed while a transaction is in progress -rollback; -begin; -select @@tx_isolation; -@@tx_isolation -REPEATABLE-READ -insert into t1 values (1); -rollback; -drop table t1; -End of 5.1 tests diff --git a/mysql-test/r/bdb_cache.result b/mysql-test/r/bdb_cache.result deleted file mode 100644 index 6506ce0412a..00000000000 --- a/mysql-test/r/bdb_cache.result +++ /dev/null @@ -1,99 +0,0 @@ -drop table if exists t1, t2, t3; -flush status; -set autocommit=0; -create table t1 (a int not null) engine=bdb; -insert into t1 values (1),(2),(3); -select * from t1; -a -1 -2 -3 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -drop table t1; -set autocommit=1; -create table t1 (a int not null) engine=bdb; -begin; -insert into t1 values (1),(2),(3); -select * from t1; -a -1 -2 -3 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 0 -drop table t1; -create table t1 (a int not null) engine=bdb; -create table t2 (a int not null) engine=bdb; -create table t3 (a int not null) engine=bdb; -insert into t1 values (1),(2); -insert into t2 values (1),(2); -insert into t3 values (1),(2); -select * from t1; -a -1 -2 -select * from t2; -a -1 -2 -select * from t3; -a -1 -2 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 3 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 0 -begin; -select * from t1; -a -1 -2 -select * from t2; -a -1 -2 -select * from t3; -a -1 -2 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 3 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 0 -insert into t1 values (3); -insert into t2 values (3); -insert into t1 values (4); -select * from t1; -a -1 -2 -3 -4 -select * from t2; -a -1 -2 -3 -select * from t3; -a -1 -2 -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 3 -show status like "Qcache_hits"; -Variable_name Value -Qcache_hits 0 -commit; -show status like "Qcache_queries_in_cache"; -Variable_name Value -Qcache_queries_in_cache 1 -drop table if exists t1, t2, t3; diff --git a/mysql-test/r/bdb_gis.result b/mysql-test/r/bdb_gis.result deleted file mode 100644 index 4a3752e5426..00000000000 --- a/mysql-test/r/bdb_gis.result +++ /dev/null @@ -1,462 +0,0 @@ -SET storage_engine=bdb; -DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; -CREATE TABLE gis_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POINT); -CREATE TABLE gis_line (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g LINESTRING); -CREATE TABLE gis_polygon (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POLYGON); -CREATE TABLE gis_multi_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTIPOINT); -CREATE TABLE gis_multi_line (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTILINESTRING); -CREATE TABLE gis_multi_polygon (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTIPOLYGON); -CREATE TABLE gis_geometrycollection (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g GEOMETRYCOLLECTION); -CREATE TABLE gis_geometry (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g GEOMETRY); -SHOW CREATE TABLE gis_point; -Table Create Table -gis_point CREATE TABLE `gis_point` ( - `fid` int(11) NOT NULL AUTO_INCREMENT, - `g` point DEFAULT NULL, - PRIMARY KEY (`fid`) -) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1 -SHOW FIELDS FROM gis_point; -Field Type Null Key Default Extra -fid int(11) NO PRI NULL auto_increment -g point YES NULL -SHOW FIELDS FROM gis_line; -Field Type Null Key Default Extra -fid int(11) NO PRI NULL auto_increment -g linestring YES NULL -SHOW FIELDS FROM gis_polygon; -Field Type Null Key Default Extra -fid int(11) NO PRI NULL auto_increment -g polygon YES NULL -SHOW FIELDS FROM gis_multi_point; -Field Type Null Key Default Extra -fid int(11) NO PRI NULL auto_increment -g multipoint YES NULL -SHOW FIELDS FROM gis_multi_line; -Field Type Null Key Default Extra -fid int(11) NO PRI NULL auto_increment -g multilinestring YES NULL -SHOW FIELDS FROM gis_multi_polygon; -Field Type Null Key Default Extra -fid int(11) NO PRI NULL auto_increment -g multipolygon YES NULL -SHOW FIELDS FROM gis_geometrycollection; -Field Type Null Key Default Extra -fid int(11) NO PRI NULL auto_increment -g geometrycollection YES NULL -SHOW FIELDS FROM gis_geometry; -Field Type Null Key Default Extra -fid int(11) NO PRI NULL auto_increment -g geometry YES NULL -INSERT INTO gis_point VALUES -(101, PointFromText('POINT(10 10)')), -(102, PointFromText('POINT(20 10)')), -(103, PointFromText('POINT(20 20)')), -(104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)')))); -INSERT INTO gis_line VALUES -(105, LineFromText('LINESTRING(0 0,0 10,10 0)')), -(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')), -(107, LineStringFromWKB(LineString(Point(10, 10), Point(40, 10)))); -INSERT INTO gis_polygon VALUES -(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')), -(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')), -(110, PolyFromWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))); -INSERT INTO gis_multi_point VALUES -(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')), -(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')), -(113, MPointFromWKB(MultiPoint(Point(3, 6), Point(4, 10)))); -INSERT INTO gis_multi_line VALUES -(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')), -(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')), -(116, MLineFromWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))); -INSERT INTO gis_multi_polygon VALUES -(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), -(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), -(119, MPolyFromWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))); -INSERT INTO gis_geometrycollection VALUES -(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')), -(121, GeometryFromWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9))))); -INSERT into gis_geometry SELECT * FROM gis_point; -INSERT into gis_geometry SELECT * FROM gis_line; -INSERT into gis_geometry SELECT * FROM gis_polygon; -INSERT into gis_geometry SELECT * FROM gis_multi_point; -INSERT into gis_geometry SELECT * FROM gis_multi_line; -INSERT into gis_geometry SELECT * FROM gis_multi_polygon; -INSERT into gis_geometry SELECT * FROM gis_geometrycollection; -SELECT fid, AsText(g) FROM gis_point ORDER by fid; -fid AsText(g) -101 POINT(10 10) -102 POINT(20 10) -103 POINT(20 20) -104 POINT(10 20) -SELECT fid, AsText(g) FROM gis_line ORDER by fid; -fid AsText(g) -105 LINESTRING(0 0,0 10,10 0) -106 LINESTRING(10 10,20 10,20 20,10 20,10 10) -107 LINESTRING(10 10,40 10) -SELECT fid, AsText(g) FROM gis_polygon ORDER by fid; -fid AsText(g) -108 POLYGON((10 10,20 10,20 20,10 20,10 10)) -109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10)) -110 POLYGON((0 0,30 0,30 30,0 0)) -SELECT fid, AsText(g) FROM gis_multi_point ORDER by fid; -fid AsText(g) -111 MULTIPOINT(0 0,10 10,10 20,20 20) -112 MULTIPOINT(1 1,11 11,11 21,21 21) -113 MULTIPOINT(3 6,4 10) -SELECT fid, AsText(g) FROM gis_multi_line ORDER by fid; -fid AsText(g) -114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) -115 MULTILINESTRING((10 48,10 21,10 0)) -116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7)) -SELECT fid, AsText(g) FROM gis_multi_polygon ORDER by fid; -fid AsText(g) -117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) -118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) -119 MULTIPOLYGON(((0 3,3 3,3 0,0 3))) -SELECT fid, AsText(g) FROM gis_geometrycollection ORDER by fid; -fid AsText(g) -120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10)) -121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9)) -SELECT fid, AsText(g) FROM gis_geometry ORDER by fid; -fid AsText(g) -101 POINT(10 10) -102 POINT(20 10) -103 POINT(20 20) -104 POINT(10 20) -105 LINESTRING(0 0,0 10,10 0) -106 LINESTRING(10 10,20 10,20 20,10 20,10 10) -107 LINESTRING(10 10,40 10) -108 POLYGON((10 10,20 10,20 20,10 20,10 10)) -109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10)) -110 POLYGON((0 0,30 0,30 30,0 0)) -111 MULTIPOINT(0 0,10 10,10 20,20 20) -112 MULTIPOINT(1 1,11 11,11 21,21 21) -113 MULTIPOINT(3 6,4 10) -114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48)) -115 MULTILINESTRING((10 48,10 21,10 0)) -116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7)) -117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) -118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18))) -119 MULTIPOLYGON(((0 3,3 3,3 0,0 3))) -120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10)) -121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9)) -SELECT fid, Dimension(g) FROM gis_geometry ORDER by fid; -fid Dimension(g) -101 0 -102 0 -103 0 -104 0 -105 1 -106 1 -107 1 -108 2 -109 2 -110 2 -111 0 -112 0 -113 0 -114 1 -115 1 -116 1 -117 2 -118 2 -119 2 -120 1 -121 1 -SELECT fid, GeometryType(g) FROM gis_geometry ORDER by fid; -fid GeometryType(g) -101 POINT -102 POINT -103 POINT -104 POINT -105 LINESTRING -106 LINESTRING -107 LINESTRING -108 POLYGON -109 POLYGON -110 POLYGON -111 MULTIPOINT -112 MULTIPOINT -113 MULTIPOINT -114 MULTILINESTRING -115 MULTILINESTRING -116 MULTILINESTRING -117 MULTIPOLYGON -118 MULTIPOLYGON -119 MULTIPOLYGON -120 GEOMETRYCOLLECTION -121 GEOMETRYCOLLECTION -SELECT fid, IsEmpty(g) FROM gis_geometry ORDER by fid; -fid IsEmpty(g) -101 0 -102 0 -103 0 -104 0 -105 0 -106 0 -107 0 -108 0 -109 0 -110 0 -111 0 -112 0 -113 0 -114 0 -115 0 -116 0 -117 0 -118 0 -119 0 -120 0 -121 0 -SELECT fid, AsText(Envelope(g)) FROM gis_geometry ORDER by fid; -fid AsText(Envelope(g)) -101 POLYGON((10 10,10 10,10 10,10 10,10 10)) -102 POLYGON((20 10,20 10,20 10,20 10,20 10)) -103 POLYGON((20 20,20 20,20 20,20 20,20 20)) -104 POLYGON((10 20,10 20,10 20,10 20,10 20)) -105 POLYGON((0 0,10 0,10 10,0 10,0 0)) -106 POLYGON((10 10,20 10,20 20,10 20,10 10)) -107 POLYGON((10 10,40 10,40 10,10 10,10 10)) -108 POLYGON((10 10,20 10,20 20,10 20,10 10)) -109 POLYGON((0 0,50 0,50 50,0 50,0 0)) -110 POLYGON((0 0,30 0,30 30,0 30,0 0)) -111 POLYGON((0 0,20 0,20 20,0 20,0 0)) -112 POLYGON((1 1,21 1,21 21,1 21,1 1)) -113 POLYGON((3 6,4 6,4 10,3 10,3 6)) -114 POLYGON((10 0,16 0,16 48,10 48,10 0)) -115 POLYGON((10 0,10 0,10 48,10 48,10 0)) -116 POLYGON((1 2,21 2,21 8,1 8,1 2)) -117 POLYGON((28 0,84 0,84 42,28 42,28 0)) -118 POLYGON((28 0,84 0,84 42,28 42,28 0)) -119 POLYGON((0 0,3 0,3 3,0 3,0 0)) -120 POLYGON((0 0,10 0,10 10,0 10,0 0)) -121 POLYGON((3 6,44 6,44 9,3 9,3 6)) -explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelope(g)) from gis_geometry; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21 100.00 -Warnings: -Note 1003 select dimension(`test`.`gis_geometry`.`g`) AS `Dimension(g)`,geometrytype(`test`.`gis_geometry`.`g`) AS `GeometryType(g)`,isempty(`test`.`gis_geometry`.`g`) AS `IsEmpty(g)`,astext(envelope(`test`.`gis_geometry`.`g`)) AS `AsText(Envelope(g))` from `test`.`gis_geometry` -SELECT fid, X(g) FROM gis_point ORDER by fid; -fid X(g) -101 10 -102 20 -103 20 -104 10 -SELECT fid, Y(g) FROM gis_point ORDER by fid; -fid Y(g) -101 10 -102 10 -103 20 -104 20 -explain extended select X(g),Y(g) FROM gis_point; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 100.00 -Warnings: -Note 1003 select x(`test`.`gis_point`.`g`) AS `X(g)`,y(`test`.`gis_point`.`g`) AS `Y(g)` from `test`.`gis_point` -SELECT fid, AsText(StartPoint(g)) FROM gis_line ORDER by fid; -fid AsText(StartPoint(g)) -105 POINT(0 0) -106 POINT(10 10) -107 POINT(10 10) -SELECT fid, AsText(EndPoint(g)) FROM gis_line ORDER by fid; -fid AsText(EndPoint(g)) -105 POINT(10 0) -106 POINT(10 10) -107 POINT(40 10) -SELECT fid, GLength(g) FROM gis_line ORDER by fid; -fid GLength(g) -105 24.142135623731 -106 40 -107 30 -SELECT fid, NumPoints(g) FROM gis_line ORDER by fid; -fid NumPoints(g) -105 3 -106 5 -107 2 -SELECT fid, AsText(PointN(g, 2)) FROM gis_line ORDER by fid; -fid AsText(PointN(g, 2)) -105 POINT(0 10) -106 POINT(20 10) -107 POINT(40 10) -SELECT fid, IsClosed(g) FROM gis_line ORDER by fid; -fid IsClosed(g) -105 0 -106 1 -107 0 -explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),NumPoints(g),AsText(PointN(g, 2)),IsClosed(g) FROM gis_line; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 100.00 -Warnings: -Note 1003 select astext(startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint(g))`,astext(endpoint(`test`.`gis_line`.`g`)) AS `AsText(EndPoint(g))`,glength(`test`.`gis_line`.`g`) AS `GLength(g)`,numpoints(`test`.`gis_line`.`g`) AS `NumPoints(g)`,astext(pointn(`test`.`gis_line`.`g`,2)) AS `AsText(PointN(g, 2))`,isclosed(`test`.`gis_line`.`g`) AS `IsClosed(g)` from `test`.`gis_line` -SELECT fid, AsText(Centroid(g)) FROM gis_polygon ORDER by fid; -fid AsText(Centroid(g)) -108 POINT(15 15) -109 POINT(25.416666666667 25.416666666667) -110 POINT(20 10) -SELECT fid, Area(g) FROM gis_polygon ORDER by fid; -fid Area(g) -108 100 -109 2400 -110 450 -SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon ORDER by fid; -fid AsText(ExteriorRing(g)) -108 LINESTRING(10 10,20 10,20 20,10 20,10 10) -109 LINESTRING(0 0,50 0,50 50,0 50,0 0) -110 LINESTRING(0 0,30 0,30 30,0 0) -SELECT fid, NumInteriorRings(g) FROM gis_polygon ORDER by fid; -fid NumInteriorRings(g) -108 0 -109 1 -110 0 -SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon ORDER by fid; -fid AsText(InteriorRingN(g, 1)) -108 NULL -109 LINESTRING(10 10,20 10,20 20,10 20,10 10) -110 NULL -explain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumInteriorRings(g),AsText(InteriorRingN(g, 1)) FROM gis_polygon; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 100.00 -Warnings: -Note 1003 select astext(centroid(`test`.`gis_polygon`.`g`)) AS `AsText(Centroid(g))`,area(`test`.`gis_polygon`.`g`) AS `Area(g)`,astext(exteriorring(`test`.`gis_polygon`.`g`)) AS `AsText(ExteriorRing(g))`,numinteriorrings(`test`.`gis_polygon`.`g`) AS `NumInteriorRings(g)`,astext(interiorringn(`test`.`gis_polygon`.`g`,1)) AS `AsText(InteriorRingN(g, 1))` from `test`.`gis_polygon` -SELECT fid, IsClosed(g) FROM gis_multi_line ORDER by fid; -fid IsClosed(g) -114 0 -115 0 -116 0 -SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon ORDER by fid; -fid AsText(Centroid(g)) -117 POINT(55.588527753042 17.426536064114) -118 POINT(55.588527753042 17.426536064114) -119 POINT(2 2) -SELECT fid, Area(g) FROM gis_multi_polygon ORDER by fid; -fid Area(g) -117 1684.5 -118 1684.5 -119 4.5 -SELECT fid, NumGeometries(g) from gis_multi_point ORDER by fid; -fid NumGeometries(g) -111 4 -112 4 -113 2 -SELECT fid, NumGeometries(g) from gis_multi_line ORDER by fid; -fid NumGeometries(g) -114 2 -115 1 -116 2 -SELECT fid, NumGeometries(g) from gis_multi_polygon ORDER by fid; -fid NumGeometries(g) -117 2 -118 2 -119 1 -SELECT fid, NumGeometries(g) from gis_geometrycollection ORDER by fid; -fid NumGeometries(g) -120 2 -121 2 -explain extended SELECT fid, NumGeometries(g) from gis_multi_point; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00 -Warnings: -Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,numgeometries(`test`.`gis_multi_point`.`g`) AS `NumGeometries(g)` from `test`.`gis_multi_point` -SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point ORDER by fid; -fid AsText(GeometryN(g, 2)) -111 POINT(10 10) -112 POINT(11 11) -113 POINT(4 10) -SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line ORDER by fid; -fid AsText(GeometryN(g, 2)) -114 LINESTRING(16 0,16 23,16 48) -115 NULL -116 LINESTRING(2 5,5 8,21 7) -SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon ORDER by fid; -fid AsText(GeometryN(g, 2)) -117 POLYGON((59 18,67 18,67 13,59 13,59 18)) -118 POLYGON((59 18,67 18,67 13,59 13,59 18)) -119 NULL -SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection ORDER by fid; -fid AsText(GeometryN(g, 2)) -120 LINESTRING(0 0,10 10) -121 LINESTRING(3 6,7 9) -SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection ORDER by fid; -fid AsText(GeometryN(g, 1)) -120 POINT(0 0) -121 POINT(44 6) -explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00 -Warnings: -Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,astext(geometryn(`test`.`gis_multi_point`.`g`,2)) AS `AsText(GeometryN(g, 2))` from `test`.`gis_multi_point` -SELECT g1.fid as first, g2.fid as second, -Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o, -Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t, -Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r -FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; -first second w c o e d t i r -120 120 1 1 0 1 0 0 1 0 -120 121 0 0 0 0 0 0 1 0 -121 120 0 0 1 0 0 0 1 0 -121 121 1 1 0 1 0 0 1 0 -explain extended SELECT g1.fid as first, g2.fid as second, -Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o, -Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t, -Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r -FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE g1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort -1 SIMPLE g2 ALL NULL NULL NULL NULL 2 100.00 -Warnings: -Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,within(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,contains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,overlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,equals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,disjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,intersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid` -DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; -CREATE TABLE t1 ( -a INTEGER PRIMARY KEY AUTO_INCREMENT, -gp point, -ln linestring, -pg polygon, -mp multipoint, -mln multilinestring, -mpg multipolygon, -gc geometrycollection, -gm geometry -); -SHOW FIELDS FROM t1; -Field Type Null Key Default Extra -a int(11) NO PRI NULL auto_increment -gp point YES NULL -ln linestring YES NULL -pg polygon YES NULL -mp multipoint YES NULL -mln multilinestring YES NULL -mpg multipolygon YES NULL -gc geometrycollection YES NULL -gm geometry YES NULL -ALTER TABLE t1 ADD fid INT; -SHOW FIELDS FROM t1; -Field Type Null Key Default Extra -a int(11) NO PRI NULL auto_increment -gp point YES NULL -ln linestring YES NULL -pg polygon YES NULL -mp multipoint YES NULL -mln multilinestring YES NULL -mpg multipolygon YES NULL -gc geometrycollection YES NULL -gm geometry YES NULL -fid int(11) YES NULL -DROP TABLE t1; -create table t1 (pk integer primary key auto_increment, a geometry not null); -insert into t1 (a) values (GeomFromText('Point(1 2)')); -insert into t1 (a) values ('Garbage'); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field -insert IGNORE into t1 (a) values ('Garbage'); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field -drop table t1; -create table t1 (pk integer primary key auto_increment, fl geometry); -insert into t1 (fl) values (1); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field -insert into t1 (fl) values (1.11); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field -insert into t1 (fl) values ("qwerty"); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field -insert into t1 (fl) values (pointfromtext('point(1,1)')); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field -drop table t1; diff --git a/mysql-test/r/binlog_stm_binlog.result b/mysql-test/r/binlog_stm_binlog.result index 4e23db4828f..60735be3ac6 100644 --- a/mysql-test/r/binlog_stm_binlog.result +++ b/mysql-test/r/binlog_stm_binlog.result @@ -12,7 +12,7 @@ master-bin.000001 367 Xid 1 394 COMMIT /* XID */ drop table t1; drop table if exists t1, t2; reset master; -create table t1 (a int) engine=bdb; +create table t1 (a int) engine=innodb; create table t2 (a int) engine=innodb; begin; insert t1 values (5); @@ -22,11 +22,11 @@ insert t2 values (5); commit; show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=bdb +master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=innodb master-bin.000001 # Query 1 # use `test`; create table t2 (a int) engine=innodb master-bin.000001 # Query 1 # use `test`; BEGIN master-bin.000001 # Query 1 # use `test`; insert t1 values (5) -master-bin.000001 # Query 1 # use `test`; COMMIT +master-bin.000001 # Xid 1 # COMMIT /* xid= */ master-bin.000001 # Query 1 # use `test`; BEGIN master-bin.000001 # Query 1 # use `test`; insert t2 values (5) master-bin.000001 # Xid 1 # COMMIT /* xid= */ diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 3dcf88b8df5..2f82cb2aecb 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -479,7 +479,7 @@ drop table t1; create table t1 ( c char(10) character set utf8, unique key a (c(1)) -) engine=bdb; +) engine=innodb; insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('aa'); ERROR 23000: Duplicate entry 'aa' for key 'a' @@ -637,7 +637,7 @@ drop table t1; create table t1 ( c char(10) character set utf8 collate utf8_bin, unique key a (c(1)) -) engine=bdb; +) engine=innodb; insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('aa'); ERROR 23000: Duplicate entry 'aa' for key 'a' @@ -707,7 +707,7 @@ drop table t1; create table t1 ( str varchar(255) character set utf8 not null, key str (str(2)) -) engine=bdb; +) engine=innodb; INSERT INTO t1 VALUES ('str'); INSERT INTO t1 VALUES ('str2'); select * from t1 where str='str'; @@ -796,7 +796,7 @@ insert into t1 values(1,'foo'),(2,'foobar'); select * from t1 where b like 'foob%'; a b 2 foobar -alter table t1 engine=bdb; +alter table t1 engine=innodb; select * from t1 where b like 'foob%'; a b 2 foobar diff --git a/mysql-test/r/have_bdb.require b/mysql-test/r/have_bdb.require deleted file mode 100644 index 969cd6863db..00000000000 --- a/mysql-test/r/have_bdb.require +++ /dev/null @@ -1,2 +0,0 @@ -Variable_name Value -have_bdb YES diff --git a/mysql-test/r/index_merge_bdb.result b/mysql-test/r/index_merge_bdb.result deleted file mode 100644 index 3113bf95d3a..00000000000 --- a/mysql-test/r/index_merge_bdb.result +++ /dev/null @@ -1,136 +0,0 @@ -drop table if exists t1; -create table t1 ( -pk int primary key, -key1 int, -key2 int, -filler char(200), -filler2 char(200), -index(key1), -index(key2) -) engine=bdb; -select * from t1 where (key1 >= 2 and key1 <= 10) or (pk >= 4 and pk <=8 ); -pk key1 key2 filler filler2 -2 2 2 filler-data filler-data-2 -3 3 3 filler-data filler-data-2 -9 9 9 filler-data filler-data-2 -10 10 10 filler-data filler-data-2 -4 4 4 filler-data filler-data-2 -5 5 5 filler-data filler-data-2 -6 6 6 filler-data filler-data-2 -7 7 7 filler-data filler-data-2 -8 8 8 filler-data filler-data-2 -set @maxv=1000; -select * from t1 where -(pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10) -or key1=18 or key1=60; -pk key1 key2 filler filler2 -18 18 18 filler-data filler-data-2 -60 60 60 filler-data filler-data-2 -1 1 1 filler-data filler-data-2 -2 2 2 filler-data filler-data-2 -3 3 3 filler-data filler-data-2 -4 4 4 filler-data filler-data-2 -11 11 11 filler-data filler-data-2 -12 12 12 filler-data filler-data-2 -13 13 13 filler-data filler-data-2 -14 14 14 filler-data filler-data-2 -50 50 50 filler-data filler-data-2 -51 51 51 filler-data filler-data-2 -52 52 52 filler-data filler-data-2 -53 53 53 filler-data filler-data-2 -54 54 54 filler-data filler-data-2 -991 991 991 filler-data filler-data-2 -992 992 992 filler-data filler-data-2 -993 993 993 filler-data filler-data-2 -994 994 994 filler-data filler-data-2 -995 995 995 filler-data filler-data-2 -996 996 996 filler-data filler-data-2 -997 997 997 filler-data filler-data-2 -998 998 998 filler-data filler-data-2 -999 999 999 filler-data filler-data-2 -1000 1000 1000 filler-data filler-data-2 -select * from t1 where -(pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10) -or key1 < 3 or key1 > @maxv-11; -pk key1 key2 filler filler2 -990 990 990 filler-data filler-data-2 -1 1 1 filler-data filler-data-2 -2 2 2 filler-data filler-data-2 -3 3 3 filler-data filler-data-2 -4 4 4 filler-data filler-data-2 -11 11 11 filler-data filler-data-2 -12 12 12 filler-data filler-data-2 -13 13 13 filler-data filler-data-2 -14 14 14 filler-data filler-data-2 -50 50 50 filler-data filler-data-2 -51 51 51 filler-data filler-data-2 -52 52 52 filler-data filler-data-2 -53 53 53 filler-data filler-data-2 -54 54 54 filler-data filler-data-2 -991 991 991 filler-data filler-data-2 -992 992 992 filler-data filler-data-2 -993 993 993 filler-data filler-data-2 -994 994 994 filler-data filler-data-2 -995 995 995 filler-data filler-data-2 -996 996 996 filler-data filler-data-2 -997 997 997 filler-data filler-data-2 -998 998 998 filler-data filler-data-2 -999 999 999 filler-data filler-data-2 -1000 1000 1000 filler-data filler-data-2 -select * from t1 where -(pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10) -or -(key1 < 5) or (key1 > 10 and key1 < 15) or (key1 >= 50 and key1 < 55 ) or (key1 > @maxv-10); -pk key1 key2 filler filler2 -1 1 1 filler-data filler-data-2 -2 2 2 filler-data filler-data-2 -3 3 3 filler-data filler-data-2 -4 4 4 filler-data filler-data-2 -11 11 11 filler-data filler-data-2 -12 12 12 filler-data filler-data-2 -13 13 13 filler-data filler-data-2 -14 14 14 filler-data filler-data-2 -50 50 50 filler-data filler-data-2 -51 51 51 filler-data filler-data-2 -52 52 52 filler-data filler-data-2 -53 53 53 filler-data filler-data-2 -54 54 54 filler-data filler-data-2 -991 991 991 filler-data filler-data-2 -992 992 992 filler-data filler-data-2 -993 993 993 filler-data filler-data-2 -994 994 994 filler-data filler-data-2 -995 995 995 filler-data filler-data-2 -996 996 996 filler-data filler-data-2 -997 997 997 filler-data filler-data-2 -998 998 998 filler-data filler-data-2 -999 999 999 filler-data filler-data-2 -1000 1000 1000 filler-data filler-data-2 -select * from t1 where -(pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) -or -(key1 < 5) or (key1 > @maxv-10); -pk key1 key2 filler filler2 -1 1 1 filler-data filler-data-2 -2 2 2 filler-data filler-data-2 -3 3 3 filler-data filler-data-2 -4 4 4 filler-data filler-data-2 -991 991 991 filler-data filler-data-2 -992 992 992 filler-data filler-data-2 -993 993 993 filler-data filler-data-2 -994 994 994 filler-data filler-data-2 -995 995 995 filler-data filler-data-2 -996 996 996 filler-data filler-data-2 -997 997 997 filler-data filler-data-2 -998 998 998 filler-data filler-data-2 -999 999 999 filler-data filler-data-2 -1000 1000 1000 filler-data filler-data-2 -11 11 11 filler-data filler-data-2 -12 12 12 filler-data filler-data-2 -13 13 13 filler-data filler-data-2 -14 14 14 filler-data filler-data-2 -50 50 50 filler-data filler-data-2 -51 51 51 filler-data filler-data-2 -52 52 52 filler-data filler-data-2 -53 53 53 filler-data filler-data-2 -54 54 54 filler-data filler-data-2 -drop table t1; diff --git a/mysql-test/r/ps_6bdb.result b/mysql-test/r/ps_6bdb.result deleted file mode 100644 index 94e6da6ccd1..00000000000 --- a/mysql-test/r/ps_6bdb.result +++ /dev/null @@ -1,3120 +0,0 @@ -use test; -drop table if exists t1, t9 ; -create table t1 -( -a int, b varchar(30), -primary key(a) -) engine = 'BDB' ; -create table t9 -( -c1 tinyint, c2 smallint, c3 mediumint, c4 int, -c5 integer, c6 bigint, c7 float, c8 double, -c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4), -c13 date, c14 datetime, c15 timestamp, c16 time, -c17 year, c18 tinyint, c19 bool, c20 char, -c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext, -c25 blob, c26 text, c27 mediumblob, c28 mediumtext, -c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'), -c32 set('monday', 'tuesday', 'wednesday'), -primary key(c1) -) engine = 'BDB' ; -delete from t1 ; -insert into t1 values (1,'one'); -insert into t1 values (2,'two'); -insert into t1 values (3,'three'); -insert into t1 values (4,'four'); -commit ; -delete from t9 ; -insert into t9 -set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, -c10= 1, c11= 1, c12 = 1, -c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', -c16= '11:11:11', c17= '2004', -c18= 1, c19=true, c20= 'a', c21= '123456789a', -c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', -c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', -c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; -insert into t9 -set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, -c10= 9, c11= 9, c12 = 9, -c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', -c16= '11:11:11', c17= '2004', -c18= 1, c19=false, c20= 'a', c21= '123456789a', -c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', -c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', -c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; -commit ; -test_sequence ------- simple select tests ------ -prepare stmt1 from ' select * from t9 order by c1 ' ; -execute stmt1; -Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def test t9 t9 c1 c1 1 4 1 N 49155 0 63 -def test t9 t9 c2 c2 2 6 1 Y 32768 0 63 -def test t9 t9 c3 c3 9 9 1 Y 32768 0 63 -def test t9 t9 c4 c4 3 11 1 Y 32768 0 63 -def test t9 t9 c5 c5 3 11 1 Y 32768 0 63 -def test t9 t9 c6 c6 8 20 1 Y 32768 0 63 -def test t9 t9 c7 c7 4 12 1 Y 32768 31 63 -def test t9 t9 c8 c8 5 22 1 Y 32768 31 63 -def test t9 t9 c9 c9 5 22 1 Y 32768 31 63 -def test t9 t9 c10 c10 5 22 1 Y 32768 31 63 -def test t9 t9 c11 c11 246 9 6 Y 0 4 63 -def test t9 t9 c12 c12 246 10 6 Y 0 4 63 -def test t9 t9 c13 c13 10 10 10 Y 128 0 63 -def test t9 t9 c14 c14 12 19 19 Y 128 0 63 -def test t9 t9 c15 c15 7 19 19 N 1249 0 63 -def test t9 t9 c16 c16 11 8 8 Y 128 0 63 -def test t9 t9 c17 c17 13 4 4 Y 32864 0 63 -def test t9 t9 c18 c18 1 4 1 Y 32768 0 63 -def test t9 t9 c19 c19 1 1 1 Y 32768 0 63 -def test t9 t9 c20 c20 254 1 1 Y 0 0 8 -def test t9 t9 c21 c21 254 10 10 Y 0 0 8 -def test t9 t9 c22 c22 253 30 30 Y 0 0 8 -def test t9 t9 c23 c23 252 255 8 Y 144 0 63 -def test t9 t9 c24 c24 252 255 8 Y 16 0 8 -def test t9 t9 c25 c25 252 65535 4 Y 144 0 63 -def test t9 t9 c26 c26 252 65535 4 Y 16 0 8 -def test t9 t9 c27 c27 252 16777215 10 Y 144 0 63 -def test t9 t9 c28 c28 252 16777215 10 Y 16 0 8 -def test t9 t9 c29 c29 252 4294967295 8 Y 144 0 63 -def test t9 t9 c30 c30 252 4294967295 8 Y 16 0 8 -def test t9 t9 c31 c31 254 5 3 Y 256 0 8 -def test t9 t9 c32 c32 254 24 7 Y 2048 0 8 -c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32 -1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday -9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday -set @arg00='SELECT' ; -@arg00 a from t1 where a=1; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a from t1 where a=1' at line 1 -prepare stmt1 from ' ? a from t1 where a=1 '; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1 -set @arg00=1 ; -select @arg00, b from t1 where a=1 ; -@arg00 b -1 one -prepare stmt1 from ' select ?, b from t1 where a=1 ' ; -execute stmt1 using @arg00 ; -? b -1 one -set @arg00='lion' ; -select @arg00, b from t1 where a=1 ; -@arg00 b -lion one -prepare stmt1 from ' select ?, b from t1 where a=1 ' ; -execute stmt1 using @arg00 ; -? b -lion one -set @arg00=NULL ; -select @arg00, b from t1 where a=1 ; -@arg00 b -NULL one -prepare stmt1 from ' select ?, b from t1 where a=1 ' ; -execute stmt1 using @arg00 ; -? b -NULL one -set @arg00=1 ; -select b, a - @arg00 from t1 where a=1 ; -b a - @arg00 -one 0 -prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ; -execute stmt1 using @arg00 ; -b a - ? -one 0 -set @arg00=null ; -select @arg00 as my_col ; -my_col -NULL -prepare stmt1 from ' select ? as my_col'; -execute stmt1 using @arg00 ; -my_col -NULL -select @arg00 + 1 as my_col ; -my_col -NULL -prepare stmt1 from ' select ? + 1 as my_col'; -execute stmt1 using @arg00 ; -my_col -NULL -select 1 + @arg00 as my_col ; -my_col -NULL -prepare stmt1 from ' select 1 + ? as my_col'; -execute stmt1 using @arg00 ; -my_col -NULL -set @arg00='MySQL' ; -select substr(@arg00,1,2) from t1 where a=1 ; -substr(@arg00,1,2) -My -prepare stmt1 from ' select substr(?,1,2) from t1 where a=1 ' ; -execute stmt1 using @arg00 ; -substr(?,1,2) -My -set @arg00=3 ; -select substr('MySQL',@arg00,5) from t1 where a=1 ; -substr('MySQL',@arg00,5) -SQL -prepare stmt1 from ' select substr(''MySQL'',?,5) from t1 where a=1 ' ; -execute stmt1 using @arg00 ; -substr('MySQL',?,5) -SQL -select substr('MySQL',1,@arg00) from t1 where a=1 ; -substr('MySQL',1,@arg00) -MyS -prepare stmt1 from ' select substr(''MySQL'',1,?) from t1 where a=1 ' ; -execute stmt1 using @arg00 ; -substr('MySQL',1,?) -MyS -set @arg00='MySQL' ; -select a , concat(@arg00,b) from t1 order by a; -a concat(@arg00,b) -1 MySQLone -2 MySQLtwo -3 MySQLthree -4 MySQLfour -prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ; -execute stmt1 using @arg00; -a concat(?,b) -1 MySQLone -2 MySQLtwo -3 MySQLthree -4 MySQLfour -select a , concat(b,@arg00) from t1 order by a ; -a concat(b,@arg00) -1 oneMySQL -2 twoMySQL -3 threeMySQL -4 fourMySQL -prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ; -execute stmt1 using @arg00; -a concat(b,?) -1 oneMySQL -2 twoMySQL -3 threeMySQL -4 fourMySQL -set @arg00='MySQL' ; -select group_concat(@arg00,b order by a) from t1 -group by 'a' ; -group_concat(@arg00,b order by a) -MySQLone,MySQLtwo,MySQLthree,MySQLfour -prepare stmt1 from ' select group_concat(?,b order by a) from t1 -group by ''a'' ' ; -execute stmt1 using @arg00; -group_concat(?,b order by a) -MySQLone,MySQLtwo,MySQLthree,MySQLfour -select group_concat(b,@arg00 order by a) from t1 -group by 'a' ; -group_concat(b,@arg00 order by a) -oneMySQL,twoMySQL,threeMySQL,fourMySQL -prepare stmt1 from ' select group_concat(b,? order by a) from t1 -group by ''a'' ' ; -execute stmt1 using @arg00; -group_concat(b,? order by a) -oneMySQL,twoMySQL,threeMySQL,fourMySQL -set @arg00='first' ; -set @arg01='second' ; -set @arg02=NULL; -select @arg00, @arg01 from t1 where a=1 ; -@arg00 @arg01 -first second -prepare stmt1 from ' select ?, ? from t1 where a=1 ' ; -execute stmt1 using @arg00, @arg01 ; -? ? -first second -execute stmt1 using @arg02, @arg01 ; -? ? -NULL second -execute stmt1 using @arg00, @arg02 ; -? ? -first NULL -execute stmt1 using @arg02, @arg02 ; -? ? -NULL NULL -drop table if exists t5 ; -create table t5 (id1 int(11) not null default '0', -value2 varchar(100), value1 varchar(100)) ; -insert into t5 values (1,'hh','hh'),(2,'hh','hh'), -(1,'ii','ii'),(2,'ii','ii') ; -prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ; -set @arg00=1 ; -set @arg01='hh' ; -execute stmt1 using @arg00, @arg01 ; -id1 value1 -1 hh -1 ii -2 hh -drop table t5 ; -drop table if exists t5 ; -create table t5(session_id char(9) not null) ; -insert into t5 values ('abc') ; -prepare stmt1 from ' select * from t5 -where ?=''1111'' and session_id = ''abc'' ' ; -set @arg00='abc' ; -execute stmt1 using @arg00 ; -session_id -set @arg00='1111' ; -execute stmt1 using @arg00 ; -session_id -abc -set @arg00='abc' ; -execute stmt1 using @arg00 ; -session_id -drop table t5 ; -set @arg00='FROM' ; -select a @arg00 t1 where a=1 ; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 t1 where a=1' at line 1 -prepare stmt1 from ' select a ? t1 where a=1 ' ; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? t1 where a=1' at line 1 -set @arg00='t1' ; -select a from @arg00 where a=1 ; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 where a=1' at line 1 -prepare stmt1 from ' select a from ? where a=1 ' ; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? where a=1' at line 1 -set @arg00='WHERE' ; -select a from t1 @arg00 a=1 ; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a=1' at line 1 -prepare stmt1 from ' select a from t1 ? a=1 ' ; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a=1' at line 1 -set @arg00=1 ; -select a FROM t1 where a=@arg00 ; -a -1 -prepare stmt1 from ' select a FROM t1 where a=? ' ; -execute stmt1 using @arg00 ; -a -1 -set @arg00=1000 ; -execute stmt1 using @arg00 ; -a -set @arg00=NULL ; -select a FROM t1 where a=@arg00 ; -a -prepare stmt1 from ' select a FROM t1 where a=? ' ; -execute stmt1 using @arg00 ; -a -set @arg00=4 ; -select a FROM t1 where a=sqrt(@arg00) ; -a -2 -prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ; -execute stmt1 using @arg00 ; -a -2 -set @arg00=NULL ; -select a FROM t1 where a=sqrt(@arg00) ; -a -prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ; -execute stmt1 using @arg00 ; -a -set @arg00=2 ; -set @arg01=3 ; -select a FROM t1 where a in (@arg00,@arg01) order by a; -a -2 -3 -prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a '; -execute stmt1 using @arg00, @arg01; -a -2 -3 -set @arg00= 'one' ; -set @arg01= 'two' ; -set @arg02= 'five' ; -prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ; -execute stmt1 using @arg00, @arg01, @arg02 ; -b -one -two -prepare stmt1 from ' select b FROM t1 where b like ? '; -set @arg00='two' ; -execute stmt1 using @arg00 ; -b -two -set @arg00='tw%' ; -execute stmt1 using @arg00 ; -b -two -set @arg00='%wo' ; -execute stmt1 using @arg00 ; -b -two -set @arg00=null ; -insert into t9 set c1= 0, c5 = NULL ; -select c5 from t9 where c5 > NULL ; -c5 -prepare stmt1 from ' select c5 from t9 where c5 > ? '; -execute stmt1 using @arg00 ; -c5 -select c5 from t9 where c5 < NULL ; -c5 -prepare stmt1 from ' select c5 from t9 where c5 < ? '; -execute stmt1 using @arg00 ; -c5 -select c5 from t9 where c5 = NULL ; -c5 -prepare stmt1 from ' select c5 from t9 where c5 = ? '; -execute stmt1 using @arg00 ; -c5 -select c5 from t9 where c5 <=> NULL ; -c5 -NULL -prepare stmt1 from ' select c5 from t9 where c5 <=> ? '; -execute stmt1 using @arg00 ; -c5 -NULL -delete from t9 where c1= 0 ; -set @arg00='>' ; -select a FROM t1 where a @arg00 1 ; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 1' at line 1 -prepare stmt1 from ' select a FROM t1 where a ? 1 ' ; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? 1' at line 1 -set @arg00=1 ; -select a,b FROM t1 where a is not NULL -AND b is not NULL group by a - @arg00 ; -a b -1 one -2 two -3 three -4 four -prepare stmt1 from ' select a,b FROM t1 where a is not NULL -AND b is not NULL group by a - ? ' ; -execute stmt1 using @arg00 ; -a b -1 one -2 two -3 three -4 four -set @arg00='two' ; -select a,b FROM t1 where a is not NULL -AND b is not NULL having b <> @arg00 order by a ; -a b -1 one -3 three -4 four -prepare stmt1 from ' select a,b FROM t1 where a is not NULL -AND b is not NULL having b <> ? order by a ' ; -execute stmt1 using @arg00 ; -a b -1 one -3 three -4 four -set @arg00=1 ; -select a,b FROM t1 where a is not NULL -AND b is not NULL order by a - @arg00 ; -a b -1 one -2 two -3 three -4 four -prepare stmt1 from ' select a,b FROM t1 where a is not NULL -AND b is not NULL order by a - ? ' ; -execute stmt1 using @arg00 ; -a b -1 one -2 two -3 three -4 four -set @arg00=2 ; -select a,b from t1 order by 2 ; -a b -4 four -1 one -3 three -2 two -prepare stmt1 from ' select a,b from t1 -order by ? '; -execute stmt1 using @arg00; -a b -4 four -1 one -3 three -2 two -set @arg00=1 ; -execute stmt1 using @arg00; -a b -1 one -2 two -3 three -4 four -set @arg00=0 ; -execute stmt1 using @arg00; -ERROR 42S22: Unknown column '?' in 'order clause' -set @arg00=1; -prepare stmt1 from ' select a,b from t1 order by a -limit 1 '; -execute stmt1 ; -a b -1 one -prepare stmt1 from ' select a,b from t1 order by a limit ? '; -execute stmt1 using @arg00; -a b -1 one -set @arg00='b' ; -set @arg01=0 ; -set @arg02=2 ; -set @arg03=2 ; -select sum(a), @arg00 from t1 where a > @arg01 -and b is not null group by substr(b,@arg02) -having sum(a) <> @arg03 ; -sum(a) @arg00 -3 b -1 b -4 b -prepare stmt1 from ' select sum(a), ? from t1 where a > ? -and b is not null group by substr(b,?) -having sum(a) <> ? '; -execute stmt1 using @arg00, @arg01, @arg02, @arg03; -sum(a) ? -3 b -1 b -4 b -test_sequence ------- join tests ------ -select first.a as a1, second.a as a2 -from t1 first, t1 second -where first.a = second.a order by a1 ; -a1 a2 -1 1 -2 2 -3 3 -4 4 -prepare stmt1 from ' select first.a as a1, second.a as a2 - from t1 first, t1 second - where first.a = second.a order by a1 '; -execute stmt1 ; -a1 a2 -1 1 -2 2 -3 3 -4 4 -set @arg00='ABC'; -set @arg01='two'; -set @arg02='one'; -select first.a, @arg00, second.a FROM t1 first, t1 second -where @arg01 = first.b or first.a = second.a or second.b = @arg02 -order by second.a, first.a; -a @arg00 a -1 ABC 1 -2 ABC 1 -3 ABC 1 -4 ABC 1 -2 ABC 2 -2 ABC 3 -3 ABC 3 -2 ABC 4 -4 ABC 4 -prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second - where ? = first.b or first.a = second.a or second.b = ? - order by second.a, first.a'; -execute stmt1 using @arg00, @arg01, @arg02; -a ? a -1 ABC 1 -2 ABC 1 -3 ABC 1 -4 ABC 1 -2 ABC 2 -2 ABC 3 -3 ABC 3 -2 ABC 4 -4 ABC 4 -drop table if exists t2 ; -create table t2 as select * from t1 ; -set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ; -set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ; -set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ; -set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ; -set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ; -set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ; -set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ; -set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ; -set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ; -the join statement is: -SELECT * FROM t2 right join t1 using(a) order by t2.a -prepare stmt1 from @query9 ; -execute stmt1 ; -a b b -1 one one -2 two two -3 three three -4 four four -execute stmt1 ; -a b b -1 one one -2 two two -3 three three -4 four four -execute stmt1 ; -a b b -1 one one -2 two two -3 three three -4 four four -the join statement is: -SELECT * FROM t2 natural right join t1 order by t2.a -prepare stmt1 from @query8 ; -execute stmt1 ; -a b -1 one -2 two -3 three -4 four -execute stmt1 ; -a b -1 one -2 two -3 three -4 four -execute stmt1 ; -a b -1 one -2 two -3 three -4 four -the join statement is: -SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a -prepare stmt1 from @query7 ; -execute stmt1 ; -a b a b -1 one 1 one -2 two 2 two -3 three 3 three -4 four 4 four -execute stmt1 ; -a b a b -1 one 1 one -2 two 2 two -3 three 3 three -4 four 4 four -execute stmt1 ; -a b a b -1 one 1 one -2 two 2 two -3 three 3 three -4 four 4 four -the join statement is: -SELECT * FROM t2 left join t1 using(a) order by t2.a -prepare stmt1 from @query6 ; -execute stmt1 ; -a b b -1 one one -2 two two -3 three three -4 four four -execute stmt1 ; -a b b -1 one one -2 two two -3 three three -4 four four -execute stmt1 ; -a b b -1 one one -2 two two -3 three three -4 four four -the join statement is: -SELECT * FROM t2 natural left join t1 order by t2.a -prepare stmt1 from @query5 ; -execute stmt1 ; -a b -1 one -2 two -3 three -4 four -execute stmt1 ; -a b -1 one -2 two -3 three -4 four -execute stmt1 ; -a b -1 one -2 two -3 three -4 four -the join statement is: -SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a -prepare stmt1 from @query4 ; -execute stmt1 ; -a b a b -1 one 1 one -2 two 2 two -3 three 3 three -4 four 4 four -execute stmt1 ; -a b a b -1 one 1 one -2 two 2 two -3 three 3 three -4 four 4 four -execute stmt1 ; -a b a b -1 one 1 one -2 two 2 two -3 three 3 three -4 four 4 four -the join statement is: -SELECT * FROM t2 join t1 using(a) order by t2.a -prepare stmt1 from @query3 ; -execute stmt1 ; -a b b -1 one one -2 two two -3 three three -4 four four -execute stmt1 ; -a b b -1 one one -2 two two -3 three three -4 four four -execute stmt1 ; -a b b -1 one one -2 two two -3 three three -4 four four -the join statement is: -SELECT * FROM t2 natural join t1 order by t2.a -prepare stmt1 from @query2 ; -execute stmt1 ; -a b -1 one -2 two -3 three -4 four -execute stmt1 ; -a b -1 one -2 two -3 three -4 four -execute stmt1 ; -a b -1 one -2 two -3 three -4 four -the join statement is: -SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a -prepare stmt1 from @query1 ; -execute stmt1 ; -a b a b -1 one 1 one -2 two 2 two -3 three 3 three -4 four 4 four -execute stmt1 ; -a b a b -1 one 1 one -2 two 2 two -3 three 3 three -4 four 4 four -execute stmt1 ; -a b a b -1 one 1 one -2 two 2 two -3 three 3 three -4 four 4 four -drop table t2 ; -test_sequence ------- subquery tests ------ -prepare stmt1 from ' select a, b FROM t1 outer_table where - a = (select a from t1 where b = ''two'') '; -execute stmt1 ; -a b -2 two -set @arg00='two' ; -select a, b FROM t1 outer_table where -a = (select a from t1 where b = 'two' ) and b=@arg00 ; -a b -2 two -prepare stmt1 from ' select a, b FROM t1 outer_table where - a = (select a from t1 where b = ''two'') and b=? '; -execute stmt1 using @arg00; -a b -2 two -set @arg00='two' ; -select a, b FROM t1 outer_table where -a = (select a from t1 where b = @arg00 ) and b='two' ; -a b -2 two -prepare stmt1 from ' select a, b FROM t1 outer_table where - a = (select a from t1 where b = ? ) and b=''two'' ' ; -execute stmt1 using @arg00; -a b -2 two -set @arg00=3 ; -set @arg01='three' ; -select a,b FROM t1 where (a,b) in (select 3, 'three'); -a b -3 three -select a FROM t1 where (a,b) in (select @arg00,@arg01); -a -3 -prepare stmt1 from ' select a FROM t1 where (a,b) in (select ?, ?) '; -execute stmt1 using @arg00, @arg01; -a -3 -set @arg00=1 ; -set @arg01='two' ; -set @arg02=2 ; -set @arg03='two' ; -select a, @arg00, b FROM t1 outer_table where -b=@arg01 and a = (select @arg02 from t1 where b = @arg03 ) ; -a @arg00 b -2 1 two -prepare stmt1 from ' select a, ?, b FROM t1 outer_table where - b=? and a = (select ? from t1 where b = ? ) ' ; -execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; -a ? b -2 1 two -prepare stmt1 from 'select c4 FROM t9 where - c13 = (select MAX(b) from t1 where a = ?) and c22 = ? ' ; -execute stmt1 using @arg01, @arg02; -c4 -prepare stmt1 from ' select a, b FROM t1 outer_table where - a = (select a from t1 where b = outer_table.b ) order by a '; -execute stmt1 ; -a b -1 one -2 two -3 three -4 four -prepare stmt1 from ' SELECT a as ccc from t1 where a+1= - (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) '; -execute stmt1 ; -ccc -1 -deallocate prepare stmt1 ; -prepare stmt1 from ' SELECT a as ccc from t1 where a+1= - (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) '; -execute stmt1 ; -ccc -1 -deallocate prepare stmt1 ; -prepare stmt1 from ' SELECT a as ccc from t1 where a+1= - (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) '; -execute stmt1 ; -ccc -1 -deallocate prepare stmt1 ; -set @arg00='two' ; -select a, b FROM t1 outer_table where -a = (select a from t1 where b = outer_table.b ) and b=@arg00 ; -a b -2 two -prepare stmt1 from ' select a, b FROM t1 outer_table where - a = (select a from t1 where b = outer_table.b) and b=? '; -execute stmt1 using @arg00; -a b -2 two -set @arg00=2 ; -select a, b FROM t1 outer_table where -a = (select a from t1 where a = @arg00 and b = outer_table.b) and b='two' ; -a b -2 two -prepare stmt1 from ' select a, b FROM t1 outer_table where - a = (select a from t1 where a = ? and b = outer_table.b) and b=''two'' ' ; -execute stmt1 using @arg00; -a b -2 two -set @arg00=2 ; -select a, b FROM t1 outer_table where -a = (select a from t1 where outer_table.a = @arg00 and a=2) and b='two' ; -a b -2 two -prepare stmt1 from ' select a, b FROM t1 outer_table where - a = (select a from t1 where outer_table.a = ? and a=2) and b=''two'' ' ; -execute stmt1 using @arg00; -a b -2 two -set @arg00=1 ; -set @arg01='two' ; -set @arg02=2 ; -set @arg03='two' ; -select a, @arg00, b FROM t1 outer_table where -b=@arg01 and a = (select @arg02 from t1 where outer_table.b = @arg03 -and outer_table.a=a ) ; -a @arg00 b -2 1 two -prepare stmt1 from ' select a, ?, b FROM t1 outer_table where - b=? and a = (select ? from t1 where outer_table.b = ? - and outer_table.a=a ) ' ; -execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; -a ? b -2 1 two -set @arg00=1 ; -set @arg01=0 ; -select a, @arg00 -from ( select a - @arg00 as a from t1 where a=@arg00 ) as t2 -where a=@arg01; -a @arg00 -0 1 -prepare stmt1 from ' select a, ? - from ( select a - ? as a from t1 where a=? ) as t2 - where a=? '; -execute stmt1 using @arg00, @arg00, @arg00, @arg01 ; -a ? -0 1 -drop table if exists t2 ; -create table t2 as select * from t1; -prepare stmt1 from ' select a in (select a from t2) from t1 ' ; -execute stmt1 ; -a in (select a from t2) -1 -1 -1 -1 -drop table if exists t5, t6, t7 ; -create table t5 (a int , b int) ; -create table t6 like t5 ; -create table t7 like t5 ; -insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7), -(2, -1), (3, 10) ; -insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ; -insert into t7 values (3, 3), (2, 2), (1, 1) ; -prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6 - where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b - group by t5.a order by sum limit 1) from t7 ' ; -execute stmt1 ; -a (select count(distinct t5.b) as sum from t5, t6 - where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b - group by t5.a order by sum limit 1) -3 1 -2 2 -1 2 -execute stmt1 ; -a (select count(distinct t5.b) as sum from t5, t6 - where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b - group by t5.a order by sum limit 1) -3 1 -2 2 -1 2 -execute stmt1 ; -a (select count(distinct t5.b) as sum from t5, t6 - where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b - group by t5.a order by sum limit 1) -3 1 -2 2 -1 2 -drop table t5, t6, t7 ; -drop table if exists t2 ; -create table t2 as select * from t9; -set @stmt= ' SELECT - (SELECT SUM(c1 + c12 + 0.0) FROM t2 - where (t9.c2 - 0e-3) = t2.c2 - GROUP BY t9.c15 LIMIT 1) as scalar_s, - exists (select 1.0e+0 from t2 - where t2.c3 * 9.0000000000 = t9.c4) as exists_s, - c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s, - (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s -FROM t9, -(select c25 x, c32 y from t2) tt WHERE x = c25 ' ; -prepare stmt1 from @stmt ; -execute stmt1 ; -execute stmt1 ; -set @stmt= concat('explain ',@stmt); -prepare stmt1 from @stmt ; -execute stmt1 ; -execute stmt1 ; -set @stmt= ' SELECT - (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2 - GROUP BY t9.c15 LIMIT 1) as scalar_s, - exists (select ? from t2 - where t2.c3*?=t9.c4) as exists_s, - c5*? in (select c6+? from t2) as in_s, - (c7-?, c8-?) in (select c9+?, c10+? from t2) as in_row_s -FROM t9, -(select c25 x, c32 y from t2) tt WHERE x =c25 ' ; -set @arg00= 0.0 ; -set @arg01= 0e-3 ; -set @arg02= 1.0e+0 ; -set @arg03= 9.0000000000 ; -set @arg04= 4 ; -set @arg05= 0.3e+1 ; -set @arg06= 4 ; -set @arg07= 4 ; -set @arg08= 4.0 ; -set @arg09= 40e-1 ; -prepare stmt1 from @stmt ; -execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, -@arg07, @arg08, @arg09 ; -execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, -@arg07, @arg08, @arg09 ; -set @stmt= concat('explain ',@stmt); -prepare stmt1 from @stmt ; -execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, -@arg07, @arg08, @arg09 ; -execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, -@arg07, @arg08, @arg09 ; -drop table t2 ; -select 1 < (select a from t1) ; -ERROR 21000: Subquery returns more than 1 row -prepare stmt1 from ' select 1 < (select a from t1) ' ; -execute stmt1 ; -ERROR 21000: Subquery returns more than 1 row -select 1 as my_col ; -my_col -1 -test_sequence ------- union tests ------ -prepare stmt1 from ' select a FROM t1 where a=1 - union distinct - select a FROM t1 where a=1 '; -execute stmt1 ; -a -1 -execute stmt1 ; -a -1 -prepare stmt1 from ' select a FROM t1 where a=1 - union all - select a FROM t1 where a=1 '; -execute stmt1 ; -a -1 -1 -prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ; -ERROR 21000: The used SELECT statements have a different number of columns -prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ; -ERROR 21000: The used SELECT statements have a different number of columns -prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ; -ERROR 21000: The used SELECT statements have a different number of columns -prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ; -ERROR 21000: The used SELECT statements have a different number of columns -set @arg00=1 ; -select @arg00 FROM t1 where a=1 -union distinct -select 1 FROM t1 where a=1; -@arg00 -1 -prepare stmt1 from ' select ? FROM t1 where a=1 - union distinct - select 1 FROM t1 where a=1 ' ; -execute stmt1 using @arg00; -? -1 -set @arg00=1 ; -select 1 FROM t1 where a=1 -union distinct -select @arg00 FROM t1 where a=1; -1 -1 -prepare stmt1 from ' select 1 FROM t1 where a=1 - union distinct - select ? FROM t1 where a=1 ' ; -execute stmt1 using @arg00; -1 -1 -set @arg00='a' ; -select @arg00 FROM t1 where a=1 -union distinct -select @arg00 FROM t1 where a=1; -@arg00 -a -prepare stmt1 from ' select ? FROM t1 where a=1 - union distinct - select ? FROM t1 where a=1 '; -execute stmt1 using @arg00, @arg00; -? -a -prepare stmt1 from ' select ? - union distinct - select ? '; -execute stmt1 using @arg00, @arg00; -? -a -set @arg00='a' ; -set @arg01=1 ; -set @arg02='a' ; -set @arg03=2 ; -select @arg00 FROM t1 where a=@arg01 -union distinct -select @arg02 FROM t1 where a=@arg03; -@arg00 -a -prepare stmt1 from ' select ? FROM t1 where a=? - union distinct - select ? FROM t1 where a=? ' ; -execute stmt1 using @arg00, @arg01, @arg02, @arg03; -? -a -set @arg00=1 ; -prepare stmt1 from ' select sum(a) + 200, ? from t1 -union distinct -select sum(a) + 200, 1 from t1 -group by b ' ; -execute stmt1 using @arg00; -sum(a) + 200 ? -210 1 -204 1 -201 1 -203 1 -202 1 -set @Oporto='Oporto' ; -set @Lisboa='Lisboa' ; -set @0=0 ; -set @1=1 ; -set @2=2 ; -set @3=3 ; -set @4=4 ; -select @Oporto,@Lisboa,@0,@1,@2,@3,@4 ; -@Oporto @Lisboa @0 @1 @2 @3 @4 -Oporto Lisboa 0 1 2 3 4 -select sum(a) + 200 as the_sum, @Oporto as the_town from t1 -group by b -union distinct -select sum(a) + 200, @Lisboa from t1 -group by b ; -the_sum the_town -204 Oporto -201 Oporto -203 Oporto -202 Oporto -204 Lisboa -201 Lisboa -203 Lisboa -202 Lisboa -prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1 - group by b - union distinct - select sum(a) + 200, ? from t1 - group by b ' ; -execute stmt1 using @Oporto, @Lisboa; -the_sum the_town -204 Oporto -201 Oporto -203 Oporto -202 Oporto -204 Lisboa -201 Lisboa -203 Lisboa -202 Lisboa -select sum(a) + 200 as the_sum, @Oporto as the_town from t1 -where a > @1 -group by b -union distinct -select sum(a) + 200, @Lisboa from t1 -where a > @2 -group by b ; -the_sum the_town -204 Oporto -203 Oporto -202 Oporto -204 Lisboa -203 Lisboa -prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1 - where a > ? - group by b - union distinct - select sum(a) + 200, ? from t1 - where a > ? - group by b ' ; -execute stmt1 using @Oporto, @1, @Lisboa, @2; -the_sum the_town -204 Oporto -203 Oporto -202 Oporto -204 Lisboa -203 Lisboa -select sum(a) + 200 as the_sum, @Oporto as the_town from t1 -where a > @1 -group by b -having avg(a) > @2 -union distinct -select sum(a) + 200, @Lisboa from t1 -where a > @2 -group by b -having avg(a) > @3; -the_sum the_town -204 Oporto -203 Oporto -204 Lisboa -prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1 - where a > ? - group by b - having avg(a) > ? - union distinct - select sum(a) + 200, ? from t1 - where a > ? - group by b - having avg(a) > ? '; -execute stmt1 using @Oporto, @1, @2, @Lisboa, @2, @3; -the_sum the_town -204 Oporto -203 Oporto -204 Lisboa -test_sequence ------- explain select tests ------ -prepare stmt1 from ' explain select * from t9 ' ; -execute stmt1; -Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def id 8 3 1 N 32929 0 63 -def select_type 253 19 6 N 1 31 8 -def table 253 64 2 Y 0 31 8 -def type 253 10 3 Y 0 31 8 -def possible_keys 253 4096 0 Y 0 31 8 -def key 253 64 0 Y 0 31 8 -def key_len 253 4096 0 Y 128 31 63 -def ref 253 1024 0 Y 0 31 8 -def rows 8 10 1 Y 32928 0 63 -def Extra 253 255 0 N 1 31 8 -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t9 ALL NULL NULL NULL NULL 3 -test_sequence ------- delete tests ------ -delete from t1 ; -insert into t1 values (1,'one'); -insert into t1 values (2,'two'); -insert into t1 values (3,'three'); -insert into t1 values (4,'four'); -commit ; -delete from t9 ; -insert into t9 -set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, -c10= 1, c11= 1, c12 = 1, -c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', -c16= '11:11:11', c17= '2004', -c18= 1, c19=true, c20= 'a', c21= '123456789a', -c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', -c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', -c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; -insert into t9 -set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, -c10= 9, c11= 9, c12 = 9, -c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', -c16= '11:11:11', c17= '2004', -c18= 1, c19=false, c20= 'a', c21= '123456789a', -c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', -c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', -c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; -commit ; -prepare stmt1 from 'delete from t1 where a=2' ; -execute stmt1; -select a,b from t1 where a=2; -a b -execute stmt1; -insert into t1 values(0,NULL); -set @arg00=NULL; -prepare stmt1 from 'delete from t1 where b=?' ; -execute stmt1 using @arg00; -select a,b from t1 where b is NULL ; -a b -0 NULL -set @arg00='one'; -execute stmt1 using @arg00; -select a,b from t1 where b=@arg00; -a b -prepare stmt1 from 'truncate table t1' ; -test_sequence ------- update tests ------ -delete from t1 ; -insert into t1 values (1,'one'); -insert into t1 values (2,'two'); -insert into t1 values (3,'three'); -insert into t1 values (4,'four'); -commit ; -delete from t9 ; -insert into t9 -set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, -c10= 1, c11= 1, c12 = 1, -c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', -c16= '11:11:11', c17= '2004', -c18= 1, c19=true, c20= 'a', c21= '123456789a', -c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', -c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', -c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; -insert into t9 -set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, -c10= 9, c11= 9, c12 = 9, -c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', -c16= '11:11:11', c17= '2004', -c18= 1, c19=false, c20= 'a', c21= '123456789a', -c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', -c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', -c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; -commit ; -prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ; -execute stmt1; -select a,b from t1 where a=2; -a b -2 a=two -execute stmt1; -select a,b from t1 where a=2; -a b -2 a=two -set @arg00=NULL; -prepare stmt1 from 'update t1 set b=? where a=2' ; -execute stmt1 using @arg00; -select a,b from t1 where a=2; -a b -2 NULL -set @arg00='two'; -execute stmt1 using @arg00; -select a,b from t1 where a=2; -a b -2 two -set @arg00=2; -prepare stmt1 from 'update t1 set b=NULL where a=?' ; -execute stmt1 using @arg00; -select a,b from t1 where a=@arg00; -a b -2 NULL -update t1 set b='two' where a=@arg00; -set @arg00=2000; -execute stmt1 using @arg00; -select a,b from t1 where a=@arg00; -a b -set @arg00=2; -set @arg01=22; -prepare stmt1 from 'update t1 set a=? where a=?' ; -execute stmt1 using @arg00, @arg00; -select a,b from t1 where a=@arg00; -a b -2 two -execute stmt1 using @arg01, @arg00; -select a,b from t1 where a=@arg01; -a b -22 two -execute stmt1 using @arg00, @arg01; -select a,b from t1 where a=@arg00; -a b -2 two -set @arg00=NULL; -set @arg01=2; -execute stmt1 using @arg00, @arg01; -Warnings: -Warning 1048 Column 'a' cannot be null -select a,b from t1 order by a; -a b -0 two -1 one -3 three -4 four -set @arg00=0; -execute stmt1 using @arg01, @arg00; -select a,b from t1 order by a; -a b -1 one -2 two -3 three -4 four -set @arg00=23; -set @arg01='two'; -set @arg02=2; -set @arg03='two'; -set @arg04=2; -drop table if exists t2; -create table t2 as select a,b from t1 ; -prepare stmt1 from 'update t1 set a=? where b=? - and a in (select ? from t2 - where b = ? or a = ?)'; -execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ; -affected rows: 1 -info: Rows matched: 1 Changed: 1 Warnings: 0 -select a,b from t1 where a = @arg00 ; -a b -23 two -prepare stmt1 from 'update t1 set a=? where b=? - and a not in (select ? from t2 - where b = ? or a = ?)'; -execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ; -affected rows: 1 -info: Rows matched: 1 Changed: 1 Warnings: 0 -select a,b from t1 order by a ; -a b -1 one -2 two -3 three -4 four -drop table t2 ; -create table t2 -( -a int, b varchar(30), -primary key(a) -) engine = 'BDB' ; -insert into t2(a,b) select a, b from t1 ; -prepare stmt1 from 'update t1 set a=? where b=? - and a in (select ? from t2 - where b = ? or a = ?)'; -execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ; -affected rows: 1 -info: Rows matched: 1 Changed: 1 Warnings: 0 -select a,b from t1 where a = @arg00 ; -a b -23 two -prepare stmt1 from 'update t1 set a=? where b=? - and a not in (select ? from t2 - where b = ? or a = ?)'; -execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ; -affected rows: 1 -info: Rows matched: 1 Changed: 1 Warnings: 0 -select a,b from t1 order by a ; -a b -1 one -2 two -3 three -4 four -drop table t2 ; -set @arg00=1; -prepare stmt1 from 'update t1 set b=''bla'' -where a=2 -limit 1'; -execute stmt1 ; -select a,b from t1 where b = 'bla' ; -a b -2 bla -prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?'; -execute stmt1 using @arg00; -test_sequence ------- insert tests ------ -delete from t1 ; -insert into t1 values (1,'one'); -insert into t1 values (2,'two'); -insert into t1 values (3,'three'); -insert into t1 values (4,'four'); -commit ; -delete from t9 ; -insert into t9 -set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, -c10= 1, c11= 1, c12 = 1, -c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', -c16= '11:11:11', c17= '2004', -c18= 1, c19=true, c20= 'a', c21= '123456789a', -c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', -c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', -c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; -insert into t9 -set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, -c10= 9, c11= 9, c12 = 9, -c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', -c16= '11:11:11', c17= '2004', -c18= 1, c19=false, c20= 'a', c21= '123456789a', -c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', -c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', -c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; -commit ; -prepare stmt1 from 'insert into t1 values(5, ''five'' )'; -execute stmt1; -select a,b from t1 where a = 5; -a b -5 five -set @arg00='six' ; -prepare stmt1 from 'insert into t1 values(6, ? )'; -execute stmt1 using @arg00; -select a,b from t1 where b = @arg00; -a b -6 six -execute stmt1 using @arg00; -ERROR 23000: Duplicate entry '6' for key 'PRIMARY' -set @arg00=NULL ; -prepare stmt1 from 'insert into t1 values(0, ? )'; -execute stmt1 using @arg00; -select a,b from t1 where b is NULL; -a b -0 NULL -set @arg00=8 ; -set @arg01='eight' ; -prepare stmt1 from 'insert into t1 values(?, ? )'; -execute stmt1 using @arg00, @arg01 ; -select a,b from t1 where b = @arg01; -a b -8 eight -set @NULL= null ; -set @arg00= 'abc' ; -execute stmt1 using @NULL, @NULL ; -ERROR 23000: Column 'a' cannot be null -execute stmt1 using @NULL, @NULL ; -ERROR 23000: Column 'a' cannot be null -execute stmt1 using @NULL, @arg00 ; -ERROR 23000: Column 'a' cannot be null -execute stmt1 using @NULL, @arg00 ; -ERROR 23000: Column 'a' cannot be null -set @arg01= 10000 + 2 ; -execute stmt1 using @arg01, @arg00 ; -set @arg01= 10000 + 1 ; -execute stmt1 using @arg01, @arg00 ; -select * from t1 where a > 10000 order by a ; -a b -10001 abc -10002 abc -delete from t1 where a > 10000 ; -set @arg01= 10000 + 2 ; -execute stmt1 using @arg01, @NULL ; -set @arg01= 10000 + 1 ; -execute stmt1 using @arg01, @NULL ; -select * from t1 where a > 10000 order by a ; -a b -10001 NULL -10002 NULL -delete from t1 where a > 10000 ; -set @arg01= 10000 + 10 ; -execute stmt1 using @arg01, @arg01 ; -set @arg01= 10000 + 9 ; -execute stmt1 using @arg01, @arg01 ; -set @arg01= 10000 + 8 ; -execute stmt1 using @arg01, @arg01 ; -set @arg01= 10000 + 7 ; -execute stmt1 using @arg01, @arg01 ; -set @arg01= 10000 + 6 ; -execute stmt1 using @arg01, @arg01 ; -set @arg01= 10000 + 5 ; -execute stmt1 using @arg01, @arg01 ; -set @arg01= 10000 + 4 ; -execute stmt1 using @arg01, @arg01 ; -set @arg01= 10000 + 3 ; -execute stmt1 using @arg01, @arg01 ; -set @arg01= 10000 + 2 ; -execute stmt1 using @arg01, @arg01 ; -set @arg01= 10000 + 1 ; -execute stmt1 using @arg01, @arg01 ; -select * from t1 where a > 10000 order by a ; -a b -10001 10001 -10002 10002 -10003 10003 -10004 10004 -10005 10005 -10006 10006 -10007 10007 -10008 10008 -10009 10009 -10010 10010 -delete from t1 where a > 10000 ; -set @arg00=81 ; -set @arg01='8-1' ; -set @arg02=82 ; -set @arg03='8-2' ; -prepare stmt1 from 'insert into t1 values(?,?),(?,?)'; -execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; -select a,b from t1 where a in (@arg00,@arg02) ; -a b -81 8-1 -82 8-2 -set @arg00=9 ; -set @arg01='nine' ; -prepare stmt1 from 'insert into t1 set a=?, b=? '; -execute stmt1 using @arg00, @arg01 ; -select a,b from t1 where a = @arg00 ; -a b -9 nine -set @arg00=6 ; -set @arg01=1 ; -prepare stmt1 from 'insert into t1 set a=?, b=''sechs'' - on duplicate key update a=a + ?, b=concat(b,''modified'') '; -execute stmt1 using @arg00, @arg01; -select * from t1 order by a; -a b -0 NULL -1 one -2 two -3 three -4 four -5 five -7 sixmodified -8 eight -9 nine -81 8-1 -82 8-2 -set @arg00=81 ; -set @arg01=1 ; -execute stmt1 using @arg00, @arg01; -ERROR 23000: Duplicate entry '82' for key 'PRIMARY' -drop table if exists t2 ; -create table t2 (id int auto_increment primary key) -ENGINE= 'BDB' ; -prepare stmt1 from ' select last_insert_id() ' ; -insert into t2 values (NULL) ; -execute stmt1 ; -last_insert_id() -1 -insert into t2 values (NULL) ; -execute stmt1 ; -last_insert_id() -2 -drop table t2 ; -set @1000=1000 ; -set @x1000_2="x1000_2" ; -set @x1000_3="x1000_3" ; -set @x1000="x1000" ; -set @1100=1100 ; -set @x1100="x1100" ; -set @100=100 ; -set @updated="updated" ; -insert into t1 values(1000,'x1000_1') ; -insert into t1 values(@1000,@x1000_2),(@1000,@x1000_3) -on duplicate key update a = a + @100, b = concat(b,@updated) ; -select a,b from t1 where a >= 1000 order by a ; -a b -1000 x1000_3 -1100 x1000_1updated -delete from t1 where a >= 1000 ; -insert into t1 values(1000,'x1000_1') ; -prepare stmt1 from ' insert into t1 values(?,?),(?,?) - on duplicate key update a = a + ?, b = concat(b,?) '; -execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ; -select a,b from t1 where a >= 1000 order by a ; -a b -1000 x1000_3 -1100 x1000_1updated -delete from t1 where a >= 1000 ; -insert into t1 values(1000,'x1000_1') ; -execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ; -select a,b from t1 where a >= 1000 order by a ; -a b -1200 x1000_1updatedupdated -delete from t1 where a >= 1000 ; -prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' '; -execute stmt1; -execute stmt1; -execute stmt1; -test_sequence ------- multi table tests ------ -delete from t1 ; -delete from t9 ; -insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ; -insert into t9 (c1,c21) -values (1, 'one'), (2, 'two'), (3, 'three') ; -prepare stmt_delete from " delete t1, t9 - from t1, t9 where t1.a=t9.c1 and t1.b='updated' "; -prepare stmt_update from " update t1, t9 - set t1.b='updated', t9.c21='updated' - where t1.a=t9.c1 and t1.a=? "; -prepare stmt_select1 from " select a, b from t1 order by a" ; -prepare stmt_select2 from " select c1, c21 from t9 order by c1" ; -set @arg00= 1 ; -execute stmt_update using @arg00 ; -execute stmt_delete ; -execute stmt_select1 ; -a b -2 two -3 three -execute stmt_select2 ; -c1 c21 -2 two -3 three -set @arg00= @arg00 + 1 ; -execute stmt_update using @arg00 ; -execute stmt_delete ; -execute stmt_select1 ; -a b -3 three -execute stmt_select2 ; -c1 c21 -3 three -set @arg00= @arg00 + 1 ; -execute stmt_update using @arg00 ; -execute stmt_delete ; -execute stmt_select1 ; -a b -execute stmt_select2 ; -c1 c21 -set @arg00= @arg00 + 1 ; -delete from t1 ; -insert into t1 values (1,'one'); -insert into t1 values (2,'two'); -insert into t1 values (3,'three'); -insert into t1 values (4,'four'); -commit ; -delete from t9 ; -insert into t9 -set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, -c10= 1, c11= 1, c12 = 1, -c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', -c16= '11:11:11', c17= '2004', -c18= 1, c19=true, c20= 'a', c21= '123456789a', -c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', -c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', -c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; -insert into t9 -set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, -c10= 9, c11= 9, c12 = 9, -c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', -c16= '11:11:11', c17= '2004', -c18= 1, c19=false, c20= 'a', c21= '123456789a', -c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', -c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', -c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; -commit ; -insert into t1 values(0,NULL) ; -set @duplicate='duplicate ' ; -set @1000=1000 ; -set @5=5 ; -select a,b from t1 where a < 5 order by a ; -a b -0 NULL -1 one -2 two -3 three -4 four -insert into t1 select a + @1000, concat(@duplicate,b) from t1 -where a < @5 ; -affected rows: 5 -info: Records: 5 Duplicates: 0 Warnings: 0 -select a,b from t1 where a >= 1000 order by a ; -a b -1000 NULL -1001 duplicate one -1002 duplicate two -1003 duplicate three -1004 duplicate four -delete from t1 where a >= 1000 ; -prepare stmt1 from ' insert into t1 select a + ?, concat(?,b) from t1 -where a < ? ' ; -execute stmt1 using @1000, @duplicate, @5; -affected rows: 5 -info: Records: 5 Duplicates: 0 Warnings: 0 -select a,b from t1 where a >= 1000 order by a ; -a b -1000 NULL -1001 duplicate one -1002 duplicate two -1003 duplicate three -1004 duplicate four -delete from t1 where a >= 1000 ; -set @1=1 ; -set @2=2 ; -set @100=100 ; -set @float=1.00; -set @five='five' ; -drop table if exists t2; -create table t2 like t1 ; -insert into t2 (b,a) -select @duplicate, sum(first.a) from t1 first, t1 second -where first.a <> @5 and second.b = first.b -and second.b <> @five -group by second.b -having sum(second.a) > @2 -union -select b, a + @100 from t1 -where (a,b) in ( select sqrt(a+@1)+CAST(@float AS signed),b -from t1); -affected rows: 3 -info: Records: 3 Duplicates: 0 Warnings: 0 -select a,b from t2 order by a ; -a b -3 duplicate -4 duplicate -103 three -delete from t2 ; -prepare stmt1 from ' insert into t2 (b,a) -select ?, sum(first.a) - from t1 first, t1 second - where first.a <> ? and second.b = first.b and second.b <> ? - group by second.b - having sum(second.a) > ? -union -select b, a + ? from t1 - where (a,b) in ( select sqrt(a+?)+CAST(? AS signed),b - from t1 ) ' ; -execute stmt1 using @duplicate, @5, @five, @2, @100, @1, @float ; -affected rows: 3 -info: Records: 3 Duplicates: 0 Warnings: 0 -select a,b from t2 order by a ; -a b -3 duplicate -4 duplicate -103 three -drop table t2; -drop table if exists t5 ; -set @arg01= 8; -set @arg02= 8.0; -set @arg03= 80.00000000000e-1; -set @arg04= 'abc' ; -set @arg05= CAST('abc' as binary) ; -set @arg06= '1991-08-05' ; -set @arg07= CAST('1991-08-05' as date); -set @arg08= '1991-08-05 01:01:01' ; -set @arg09= CAST('1991-08-05 01:01:01' as datetime) ; -set @arg10= unix_timestamp('1991-01-01 01:01:01'); -set @arg11= YEAR('1991-01-01 01:01:01'); -set @arg12= 8 ; -set @arg12= NULL ; -set @arg13= 8.0 ; -set @arg13= NULL ; -set @arg14= 'abc'; -set @arg14= NULL ; -set @arg15= CAST('abc' as binary) ; -set @arg15= NULL ; -create table t5 as select -8 as const01, @arg01 as param01, -8.0 as const02, @arg02 as param02, -80.00000000000e-1 as const03, @arg03 as param03, -'abc' as const04, @arg04 as param04, -CAST('abc' as binary) as const05, @arg05 as param05, -'1991-08-05' as const06, @arg06 as param06, -CAST('1991-08-05' as date) as const07, @arg07 as param07, -'1991-08-05 01:01:01' as const08, @arg08 as param08, -CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09, -unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10, -YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11, -NULL as const12, @arg12 as param12, -@arg13 as param13, -@arg14 as param14, -@arg15 as param15; -show create table t5 ; -Table Create Table -t5 CREATE TABLE `t5` ( - `const01` int(1) NOT NULL DEFAULT '0', - `param01` bigint(20) DEFAULT NULL, - `const02` decimal(2,1) NOT NULL DEFAULT '0.0', - `param02` decimal(65,30) DEFAULT NULL, - `const03` double NOT NULL DEFAULT '0', - `param03` double DEFAULT NULL, - `const04` varchar(3) NOT NULL DEFAULT '', - `param04` longtext, - `const05` varbinary(3) NOT NULL DEFAULT '', - `param05` longblob, - `const06` varchar(10) NOT NULL DEFAULT '', - `param06` longtext, - `const07` date DEFAULT NULL, - `param07` longblob, - `const08` varchar(19) NOT NULL DEFAULT '', - `param08` longtext, - `const09` datetime DEFAULT NULL, - `param09` longblob, - `const10` int(10) NOT NULL DEFAULT '0', - `param10` bigint(20) DEFAULT NULL, - `const11` int(4) DEFAULT NULL, - `param11` bigint(20) DEFAULT NULL, - `const12` binary(0) DEFAULT NULL, - `param12` bigint(20) DEFAULT NULL, - `param13` decimal(65,30) DEFAULT NULL, - `param14` longtext, - `param15` longblob -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -select * from t5 ; -Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def test t5 t5 const01 const01 3 1 1 N 32769 0 63 -def test t5 t5 param01 param01 8 20 1 Y 32768 0 63 -def test t5 t5 const02 const02 246 4 3 N 1 1 63 -def test t5 t5 param02 param02 246 67 32 Y 0 30 63 -def test t5 t5 const03 const03 5 17 1 N 32769 31 63 -def test t5 t5 param03 param03 5 23 1 Y 32768 31 63 -def test t5 t5 const04 const04 253 3 3 N 1 0 8 -def test t5 t5 param04 param04 252 4294967295 3 Y 16 0 8 -def test t5 t5 const05 const05 253 3 3 N 129 0 63 -def test t5 t5 param05 param05 252 4294967295 3 Y 144 0 63 -def test t5 t5 const06 const06 253 10 10 N 1 0 8 -def test t5 t5 param06 param06 252 4294967295 10 Y 16 0 8 -def test t5 t5 const07 const07 10 10 10 Y 128 0 63 -def test t5 t5 param07 param07 252 4294967295 10 Y 144 0 63 -def test t5 t5 const08 const08 253 19 19 N 1 0 8 -def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8 -def test t5 t5 const09 const09 12 19 19 Y 128 0 63 -def test t5 t5 param09 param09 252 4294967295 19 Y 144 0 63 -def test t5 t5 const10 const10 3 10 9 N 32769 0 63 -def test t5 t5 param10 param10 8 20 9 Y 32768 0 63 -def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 -def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 -def test t5 t5 const12 const12 254 0 0 Y 128 0 63 -def test t5 t5 param12 param12 8 20 0 Y 32768 0 63 -def test t5 t5 param13 param13 246 67 0 Y 0 30 63 -def test t5 t5 param14 param14 252 4294967295 0 Y 16 0 8 -def test t5 t5 param15 param15 252 4294967295 0 Y 144 0 63 -const01 8 -param01 8 -const02 8.0 -param02 8.000000000000000000000000000000 -const03 8 -param03 8 -const04 abc -param04 abc -const05 abc -param05 abc -const06 1991-08-05 -param06 1991-08-05 -const07 1991-08-05 -param07 1991-08-05 -const08 1991-08-05 01:01:01 -param08 1991-08-05 01:01:01 -const09 1991-08-05 01:01:01 -param09 1991-08-05 01:01:01 -const10 662680861 -param10 662680861 -const11 1991 -param11 1991 -const12 NULL -param12 NULL -param13 NULL -param14 NULL -param15 NULL -drop table t5 ; -test_sequence ------- data type conversion tests ------ -delete from t1 ; -insert into t1 values (1,'one'); -insert into t1 values (2,'two'); -insert into t1 values (3,'three'); -insert into t1 values (4,'four'); -commit ; -delete from t9 ; -insert into t9 -set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1, -c10= 1, c11= 1, c12 = 1, -c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', -c16= '11:11:11', c17= '2004', -c18= 1, c19=true, c20= 'a', c21= '123456789a', -c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', -c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', -c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday'; -insert into t9 -set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9, -c10= 9, c11= 9, c12 = 9, -c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11', -c16= '11:11:11', c17= '2004', -c18= 1, c19=false, c20= 'a', c21= '123456789a', -c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext', -c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext', -c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday'; -commit ; -insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ; -select * from t9 order by c1 ; -c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32 -0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL -1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday -9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday -test_sequence ------- select @parameter:= column ------ -prepare full_info from "select @arg01, @arg02, @arg03, @arg04, - @arg05, @arg06, @arg07, @arg08, - @arg09, @arg10, @arg11, @arg12, - @arg13, @arg14, @arg15, @arg16, - @arg17, @arg18, @arg19, @arg20, - @arg21, @arg22, @arg23, @arg24, - @arg25, @arg26, @arg27, @arg28, - @arg29, @arg30, @arg31, @arg32" ; -select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, -@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8, -@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12, -@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16, -@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20, -@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24, -@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28, -@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32 -from t9 where c1= 1 ; -@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32 -1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday -execute full_info ; -Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def @arg01 253 20 1 Y 128 0 63 -def @arg02 253 20 1 Y 128 0 63 -def @arg03 253 20 1 Y 128 0 63 -def @arg04 253 20 1 Y 128 0 63 -def @arg05 253 20 1 Y 128 0 63 -def @arg06 253 20 1 Y 128 0 63 -def @arg07 253 23 1 Y 128 31 63 -def @arg08 253 23 1 Y 128 31 63 -def @arg09 253 23 1 Y 128 31 63 -def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 -def @arg13 253 8192 10 Y 128 31 63 -def @arg14 253 8192 19 Y 128 31 63 -def @arg15 253 8192 19 Y 128 31 63 -def @arg16 253 8192 8 Y 128 31 63 -def @arg17 253 20 4 Y 128 0 63 -def @arg18 253 20 1 Y 128 0 63 -def @arg19 253 20 1 Y 128 0 63 -def @arg20 253 8192 1 Y 0 31 8 -def @arg21 253 8192 10 Y 0 31 8 -def @arg22 253 8192 30 Y 0 31 8 -def @arg23 253 8192 8 Y 128 31 63 -def @arg24 253 8192 8 Y 0 31 8 -def @arg25 253 8192 4 Y 128 31 63 -def @arg26 253 8192 4 Y 0 31 8 -def @arg27 253 8192 10 Y 128 31 63 -def @arg28 253 8192 10 Y 0 31 8 -def @arg29 253 8192 8 Y 128 31 63 -def @arg30 253 8192 8 Y 0 31 8 -def @arg31 253 8192 3 Y 0 31 8 -def @arg32 253 8192 6 Y 0 31 8 -@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 -1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday -select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, -@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8, -@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12, -@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16, -@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20, -@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24, -@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28, -@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32 -from t9 where c1= 0 ; -@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32 -0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL -execute full_info ; -Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def @arg01 253 20 1 Y 128 0 63 -def @arg02 253 20 0 Y 128 0 63 -def @arg03 253 20 0 Y 128 0 63 -def @arg04 253 20 0 Y 128 0 63 -def @arg05 253 20 0 Y 128 0 63 -def @arg06 253 20 0 Y 128 0 63 -def @arg07 253 23 0 Y 128 31 63 -def @arg08 253 23 0 Y 128 31 63 -def @arg09 253 23 0 Y 128 31 63 -def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 -def @arg13 253 8192 0 Y 128 31 63 -def @arg14 253 8192 0 Y 128 31 63 -def @arg15 253 8192 19 Y 128 31 63 -def @arg16 253 8192 0 Y 128 31 63 -def @arg17 253 20 0 Y 128 0 63 -def @arg18 253 20 0 Y 128 0 63 -def @arg19 253 20 0 Y 128 0 63 -def @arg20 253 8192 0 Y 0 31 8 -def @arg21 253 8192 0 Y 0 31 8 -def @arg22 253 8192 0 Y 0 31 8 -def @arg23 253 8192 0 Y 128 31 63 -def @arg24 253 8192 0 Y 0 31 8 -def @arg25 253 8192 0 Y 128 31 63 -def @arg26 253 8192 0 Y 0 31 8 -def @arg27 253 8192 0 Y 128 31 63 -def @arg28 253 8192 0 Y 0 31 8 -def @arg29 253 8192 0 Y 128 31 63 -def @arg30 253 8192 0 Y 0 31 8 -def @arg31 253 8192 0 Y 0 31 8 -def @arg32 253 8192 0 Y 0 31 8 -@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 -0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL -prepare stmt1 from "select - @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4, - @arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8, - @arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12, - @arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16, - @arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20, - @arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24, - @arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28, - @arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32 -from t9 where c1= ?" ; -set @my_key= 1 ; -execute stmt1 using @my_key ; -@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32 -1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday -execute full_info ; -Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def @arg01 253 20 1 Y 128 0 63 -def @arg02 253 20 1 Y 128 0 63 -def @arg03 253 20 1 Y 128 0 63 -def @arg04 253 20 1 Y 128 0 63 -def @arg05 253 20 1 Y 128 0 63 -def @arg06 253 20 1 Y 128 0 63 -def @arg07 253 23 1 Y 128 31 63 -def @arg08 253 23 1 Y 128 31 63 -def @arg09 253 23 1 Y 128 31 63 -def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 -def @arg13 253 8192 10 Y 128 31 63 -def @arg14 253 8192 19 Y 128 31 63 -def @arg15 253 8192 19 Y 128 31 63 -def @arg16 253 8192 8 Y 128 31 63 -def @arg17 253 20 4 Y 128 0 63 -def @arg18 253 20 1 Y 128 0 63 -def @arg19 253 20 1 Y 128 0 63 -def @arg20 253 8192 1 Y 0 31 8 -def @arg21 253 8192 10 Y 0 31 8 -def @arg22 253 8192 30 Y 0 31 8 -def @arg23 253 8192 8 Y 128 31 63 -def @arg24 253 8192 8 Y 0 31 8 -def @arg25 253 8192 4 Y 128 31 63 -def @arg26 253 8192 4 Y 0 31 8 -def @arg27 253 8192 10 Y 128 31 63 -def @arg28 253 8192 10 Y 0 31 8 -def @arg29 253 8192 8 Y 128 31 63 -def @arg30 253 8192 8 Y 0 31 8 -def @arg31 253 8192 3 Y 0 31 8 -def @arg32 253 8192 6 Y 0 31 8 -@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 -1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday -set @my_key= 0 ; -execute stmt1 using @my_key ; -@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32 -0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL -execute full_info ; -Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def @arg01 253 20 1 Y 128 0 63 -def @arg02 253 20 0 Y 128 0 63 -def @arg03 253 20 0 Y 128 0 63 -def @arg04 253 20 0 Y 128 0 63 -def @arg05 253 20 0 Y 128 0 63 -def @arg06 253 20 0 Y 128 0 63 -def @arg07 253 23 0 Y 128 31 63 -def @arg08 253 23 0 Y 128 31 63 -def @arg09 253 23 0 Y 128 31 63 -def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 -def @arg13 253 8192 0 Y 128 31 63 -def @arg14 253 8192 0 Y 128 31 63 -def @arg15 253 8192 19 Y 128 31 63 -def @arg16 253 8192 0 Y 128 31 63 -def @arg17 253 20 0 Y 128 0 63 -def @arg18 253 20 0 Y 128 0 63 -def @arg19 253 20 0 Y 128 0 63 -def @arg20 253 8192 0 Y 0 31 8 -def @arg21 253 8192 0 Y 0 31 8 -def @arg22 253 8192 0 Y 0 31 8 -def @arg23 253 8192 0 Y 128 31 63 -def @arg24 253 8192 0 Y 0 31 8 -def @arg25 253 8192 0 Y 128 31 63 -def @arg26 253 8192 0 Y 0 31 8 -def @arg27 253 8192 0 Y 128 31 63 -def @arg28 253 8192 0 Y 0 31 8 -def @arg29 253 8192 0 Y 128 31 63 -def @arg30 253 8192 0 Y 0 31 8 -def @arg31 253 8192 0 Y 0 31 8 -def @arg32 253 8192 0 Y 0 31 8 -@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 -0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL -prepare stmt1 from "select ? := c1 from t9 where c1= 1" ; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':= c1 from t9 where c1= 1' at line 1 -test_sequence ------- select column, .. into @parm,.. ------ -select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, -c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, -c25, c26, c27, c28, c29, c30, c31, c32 -into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, -@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, -@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24, -@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32 -from t9 where c1= 1 ; -execute full_info ; -Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def @arg01 253 20 1 Y 128 0 63 -def @arg02 253 20 1 Y 128 0 63 -def @arg03 253 20 1 Y 128 0 63 -def @arg04 253 20 1 Y 128 0 63 -def @arg05 253 20 1 Y 128 0 63 -def @arg06 253 20 1 Y 128 0 63 -def @arg07 253 23 1 Y 128 31 63 -def @arg08 253 23 1 Y 128 31 63 -def @arg09 253 23 1 Y 128 31 63 -def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 -def @arg13 253 8192 10 Y 128 31 63 -def @arg14 253 8192 19 Y 128 31 63 -def @arg15 253 8192 19 Y 128 31 63 -def @arg16 253 8192 8 Y 128 31 63 -def @arg17 253 20 4 Y 128 0 63 -def @arg18 253 20 1 Y 128 0 63 -def @arg19 253 20 1 Y 128 0 63 -def @arg20 253 8192 1 Y 0 31 8 -def @arg21 253 8192 10 Y 0 31 8 -def @arg22 253 8192 30 Y 0 31 8 -def @arg23 253 8192 8 Y 128 31 63 -def @arg24 253 8192 8 Y 0 31 8 -def @arg25 253 8192 4 Y 128 31 63 -def @arg26 253 8192 4 Y 0 31 8 -def @arg27 253 8192 10 Y 128 31 63 -def @arg28 253 8192 10 Y 0 31 8 -def @arg29 253 8192 8 Y 128 31 63 -def @arg30 253 8192 8 Y 0 31 8 -def @arg31 253 8192 3 Y 0 31 8 -def @arg32 253 8192 6 Y 0 31 8 -@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 -1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday -select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, -c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, -c25, c26, c27, c28, c29, c30, c31, c32 -into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, -@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, -@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24, -@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32 -from t9 where c1= 0 ; -execute full_info ; -Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def @arg01 253 20 1 Y 128 0 63 -def @arg02 253 20 0 Y 128 0 63 -def @arg03 253 20 0 Y 128 0 63 -def @arg04 253 20 0 Y 128 0 63 -def @arg05 253 20 0 Y 128 0 63 -def @arg06 253 20 0 Y 128 0 63 -def @arg07 253 23 0 Y 128 31 63 -def @arg08 253 23 0 Y 128 31 63 -def @arg09 253 23 0 Y 128 31 63 -def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 -def @arg13 253 8192 0 Y 128 31 63 -def @arg14 253 8192 0 Y 128 31 63 -def @arg15 253 8192 19 Y 128 31 63 -def @arg16 253 8192 0 Y 128 31 63 -def @arg17 253 20 0 Y 128 0 63 -def @arg18 253 20 0 Y 128 0 63 -def @arg19 253 20 0 Y 128 0 63 -def @arg20 253 8192 0 Y 0 31 8 -def @arg21 253 8192 0 Y 0 31 8 -def @arg22 253 8192 0 Y 0 31 8 -def @arg23 253 8192 0 Y 128 31 63 -def @arg24 253 8192 0 Y 0 31 8 -def @arg25 253 8192 0 Y 128 31 63 -def @arg26 253 8192 0 Y 0 31 8 -def @arg27 253 8192 0 Y 128 31 63 -def @arg28 253 8192 0 Y 0 31 8 -def @arg29 253 8192 0 Y 128 31 63 -def @arg30 253 8192 0 Y 0 31 8 -def @arg31 253 8192 0 Y 0 31 8 -def @arg32 253 8192 0 Y 0 31 8 -@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 -0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL -prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, - c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, - c25, c26, c27, c28, c29, c30, c31, c32 -into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, - @arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, - @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24, - @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32 -from t9 where c1= ?" ; -set @my_key= 1 ; -execute stmt1 using @my_key ; -execute full_info ; -Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def @arg01 253 20 1 Y 128 0 63 -def @arg02 253 20 1 Y 128 0 63 -def @arg03 253 20 1 Y 128 0 63 -def @arg04 253 20 1 Y 128 0 63 -def @arg05 253 20 1 Y 128 0 63 -def @arg06 253 20 1 Y 128 0 63 -def @arg07 253 23 1 Y 128 31 63 -def @arg08 253 23 1 Y 128 31 63 -def @arg09 253 23 1 Y 128 31 63 -def @arg10 253 23 1 Y 128 31 63 -def @arg11 253 67 6 Y 128 30 63 -def @arg12 253 67 6 Y 128 30 63 -def @arg13 253 8192 10 Y 128 31 63 -def @arg14 253 8192 19 Y 128 31 63 -def @arg15 253 8192 19 Y 128 31 63 -def @arg16 253 8192 8 Y 128 31 63 -def @arg17 253 20 4 Y 128 0 63 -def @arg18 253 20 1 Y 128 0 63 -def @arg19 253 20 1 Y 128 0 63 -def @arg20 253 8192 1 Y 0 31 8 -def @arg21 253 8192 10 Y 0 31 8 -def @arg22 253 8192 30 Y 0 31 8 -def @arg23 253 8192 8 Y 128 31 63 -def @arg24 253 8192 8 Y 0 31 8 -def @arg25 253 8192 4 Y 128 31 63 -def @arg26 253 8192 4 Y 0 31 8 -def @arg27 253 8192 10 Y 128 31 63 -def @arg28 253 8192 10 Y 0 31 8 -def @arg29 253 8192 8 Y 128 31 63 -def @arg30 253 8192 8 Y 0 31 8 -def @arg31 253 8192 3 Y 0 31 8 -def @arg32 253 8192 6 Y 0 31 8 -@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 -1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday -set @my_key= 0 ; -execute stmt1 using @my_key ; -execute full_info ; -Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def @arg01 253 20 1 Y 128 0 63 -def @arg02 253 20 0 Y 128 0 63 -def @arg03 253 20 0 Y 128 0 63 -def @arg04 253 20 0 Y 128 0 63 -def @arg05 253 20 0 Y 128 0 63 -def @arg06 253 20 0 Y 128 0 63 -def @arg07 253 23 0 Y 128 31 63 -def @arg08 253 23 0 Y 128 31 63 -def @arg09 253 23 0 Y 128 31 63 -def @arg10 253 23 0 Y 128 31 63 -def @arg11 253 67 0 Y 128 30 63 -def @arg12 253 67 0 Y 128 30 63 -def @arg13 253 8192 0 Y 128 31 63 -def @arg14 253 8192 0 Y 128 31 63 -def @arg15 253 8192 19 Y 128 31 63 -def @arg16 253 8192 0 Y 128 31 63 -def @arg17 253 20 0 Y 128 0 63 -def @arg18 253 20 0 Y 128 0 63 -def @arg19 253 20 0 Y 128 0 63 -def @arg20 253 8192 0 Y 0 31 8 -def @arg21 253 8192 0 Y 0 31 8 -def @arg22 253 8192 0 Y 0 31 8 -def @arg23 253 8192 0 Y 128 31 63 -def @arg24 253 8192 0 Y 0 31 8 -def @arg25 253 8192 0 Y 128 31 63 -def @arg26 253 8192 0 Y 0 31 8 -def @arg27 253 8192 0 Y 128 31 63 -def @arg28 253 8192 0 Y 0 31 8 -def @arg29 253 8192 0 Y 128 31 63 -def @arg30 253 8192 0 Y 0 31 8 -def @arg31 253 8192 0 Y 0 31 8 -def @arg32 253 8192 0 Y 0 31 8 -@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 -0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL -prepare stmt1 from "select c1 into ? from t9 where c1= 1" ; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? from t9 where c1= 1' at line 1 -test_sequence --- insert into numeric columns -- -insert into t9 -( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) -values -( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ; -set @arg00= 21 ; -insert into t9 -( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) -values -( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, -@arg00, @arg00, @arg00, @arg00, @arg00 ) ; -prepare stmt1 from "insert into t9 - ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) -values - ( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ; -execute stmt1 ; -set @arg00= 23; -prepare stmt2 from "insert into t9 - ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) -values - ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; -execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, -@arg00, @arg00, @arg00, @arg00 ; -insert into t9 -( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) -values -( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, -30.0, 30.0, 30.0 ) ; -set @arg00= 31.0 ; -insert into t9 -( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) -values -( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, -@arg00, @arg00, @arg00, @arg00, @arg00 ) ; -prepare stmt1 from "insert into t9 - ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) -values - ( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, - 32.0, 32.0, 32.0 )" ; -execute stmt1 ; -set @arg00= 33.0; -prepare stmt2 from "insert into t9 - ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) -values - ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; -execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, -@arg00, @arg00, @arg00, @arg00 ; -insert into t9 -( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) -values -( '40', '40', '40', '40', '40', '40', '40', '40', -'40', '40', '40' ) ; -set @arg00= '41' ; -insert into t9 -( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) -values -( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, -@arg00, @arg00, @arg00, @arg00, @arg00 ) ; -prepare stmt1 from "insert into t9 - ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) -values - ( '42', '42', '42', '42', '42', '42', '42', '42', - '42', '42', '42' )" ; -execute stmt1 ; -set @arg00= '43'; -prepare stmt2 from "insert into t9 - ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) -values - ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; -execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, -@arg00, @arg00, @arg00, @arg00 ; -insert into t9 -( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) -values -( CAST('50' as binary), CAST('50' as binary), -CAST('50' as binary), CAST('50' as binary), CAST('50' as binary), -CAST('50' as binary), CAST('50' as binary), CAST('50' as binary), -CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ; -set @arg00= CAST('51' as binary) ; -insert into t9 -( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) -values -( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, -@arg00, @arg00, @arg00, @arg00, @arg00 ) ; -prepare stmt1 from "insert into t9 - ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) -values - ( CAST('52' as binary), CAST('52' as binary), - CAST('52' as binary), CAST('52' as binary), CAST('52' as binary), - CAST('52' as binary), CAST('52' as binary), CAST('52' as binary), - CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ; -execute stmt1 ; -set @arg00= CAST('53' as binary) ; -prepare stmt2 from "insert into t9 - ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) -values - ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; -execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, -@arg00, @arg00, @arg00, @arg00 ; -set @arg00= 2 ; -set @arg00= NULL ; -insert into t9 -( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) -values -( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -NULL, NULL, NULL ) ; -insert into t9 -( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) -values -( 61, @arg00, @arg00, @arg00, @arg00, @arg00, -@arg00, @arg00, @arg00, @arg00, @arg00 ) ; -prepare stmt1 from "insert into t9 - ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) -values - ( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL )" ; -execute stmt1 ; -prepare stmt2 from "insert into t9 - ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) -values - ( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; -execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, -@arg00, @arg00, @arg00, @arg00 ; -set @arg00= 8.0 ; -set @arg00= NULL ; -insert into t9 -( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) -values -( 71, @arg00, @arg00, @arg00, @arg00, @arg00, -@arg00, @arg00, @arg00, @arg00, @arg00 ) ; -prepare stmt2 from "insert into t9 - ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) -values - ( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; -execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, -@arg00, @arg00, @arg00, @arg00 ; -set @arg00= 'abc' ; -set @arg00= NULL ; -insert into t9 -( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) -values -( 81, @arg00, @arg00, @arg00, @arg00, @arg00, -@arg00, @arg00, @arg00, @arg00, @arg00 ) ; -prepare stmt2 from "insert into t9 - ( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) -values - ( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; -execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, -@arg00, @arg00, @arg00, @arg00 ; -select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 -from t9 where c1 >= 20 -order by c1 ; -c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c12 -20 20 20 20 20 20 20 20 20 20 20.0000 -21 21 21 21 21 21 21 21 21 21 21.0000 -22 22 22 22 22 22 22 22 22 22 22.0000 -23 23 23 23 23 23 23 23 23 23 23.0000 -30 30 30 30 30 30 30 30 30 30 30.0000 -31 31 31 31 31 31 31 31 31 31 31.0000 -32 32 32 32 32 32 32 32 32 32 32.0000 -33 33 33 33 33 33 33 33 33 33 33.0000 -40 40 40 40 40 40 40 40 40 40 40.0000 -41 41 41 41 41 41 41 41 41 41 41.0000 -42 42 42 42 42 42 42 42 42 42 42.0000 -43 43 43 43 43 43 43 43 43 43 43.0000 -50 50 50 50 50 50 50 50 50 50 50.0000 -51 51 51 51 51 51 51 51 51 51 51.0000 -52 52 52 52 52 52 52 52 52 52 52.0000 -53 53 53 53 53 53 53 53 53 53 53.0000 -60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL -61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL -62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL -63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL -71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL -73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL -81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL -83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL -test_sequence --- select .. where numeric column = .. -- -set @arg00= 20; -select 'true' as found from t9 -where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20 -and c8= 20 and c9= 20 and c10= 20 and c12= 20; -found -true -select 'true' as found from t9 -where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 -and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 -and c12= @arg00; -found -true -prepare stmt1 from "select 'true' as found from t9 -where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20 - and c8= 20 and c9= 20 and c10= 20 and c12= 20 "; -execute stmt1 ; -found -true -prepare stmt1 from "select 'true' as found from t9 -where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? - and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? - and c12= ? "; -execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, -@arg00, @arg00, @arg00, @arg00 ; -found -true -set @arg00= 20.0; -select 'true' as found from t9 -where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0 -and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0; -found -true -select 'true' as found from t9 -where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 -and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 -and c12= @arg00; -found -true -prepare stmt1 from "select 'true' as found from t9 -where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0 - and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 "; -execute stmt1 ; -found -true -prepare stmt1 from "select 'true' as found from t9 -where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? - and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? - and c12= ? "; -execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, -@arg00, @arg00, @arg00, @arg00 ; -found -true -select 'true' as found from t9 -where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20' - and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20'; -found -true -prepare stmt1 from "select 'true' as found from t9 -where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20' - and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' "; -execute stmt1 ; -found -true -set @arg00= '20'; -select 'true' as found from t9 -where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 -and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 -and c12= @arg00; -found -true -prepare stmt1 from "select 'true' as found from t9 -where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? - and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? - and c12= ? "; -execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, -@arg00, @arg00, @arg00, @arg00 ; -found -true -select 'true' as found from t9 -where c1= CAST('20' as binary) and c2= CAST('20' as binary) and -c3= CAST('20' as binary) and c4= CAST('20' as binary) and -c5= CAST('20' as binary) and c6= CAST('20' as binary) and -c7= CAST('20' as binary) and c8= CAST('20' as binary) and -c9= CAST('20' as binary) and c10= CAST('20' as binary) and -c12= CAST('20' as binary); -found -true -prepare stmt1 from "select 'true' as found from t9 -where c1= CAST('20' as binary) and c2= CAST('20' as binary) and - c3= CAST('20' as binary) and c4= CAST('20' as binary) and - c5= CAST('20' as binary) and c6= CAST('20' as binary) and - c7= CAST('20' as binary) and c8= CAST('20' as binary) and - c9= CAST('20' as binary) and c10= CAST('20' as binary) and - c12= CAST('20' as binary) "; -execute stmt1 ; -found -true -set @arg00= CAST('20' as binary) ; -select 'true' as found from t9 -where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00 -and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00 -and c12= @arg00; -found -true -prepare stmt1 from "select 'true' as found from t9 -where c1= ? and c2= ? and c3= ? and c4= ? and c5= ? - and c6= ? and c7= ? and c8= ? and c9= ? and c10= ? - and c12= ? "; -execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, -@arg00, @arg00, @arg00, @arg00 ; -found -true -delete from t9 ; -test_sequence --- some numeric overflow experiments -- -prepare my_insert from "insert into t9 - ( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 ) -values - ( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ; -prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 -from t9 where c21 = 'O' "; -prepare my_delete from "delete from t9 where c21 = 'O' "; -set @arg00= 9223372036854775807 ; -execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, -@arg00, @arg00, @arg00, @arg00, @arg00 ; -Warnings: -Warning 1264 Out of range value for column 'c1' at row 1 -Warning 1264 Out of range value for column 'c2' at row 1 -Warning 1264 Out of range value for column 'c3' at row 1 -Warning 1264 Out of range value for column 'c4' at row 1 -Warning 1264 Out of range value for column 'c5' at row 1 -Warning 1264 Out of range value for column 'c12' at row 1 -execute my_select ; -c1 127 -c2 32767 -c3 8388607 -c4 2147483647 -c5 2147483647 -c6 9223372036854775807 -c7 9.22337e+18 -c8 9.22337203685478e+18 -c9 9.22337203685478e+18 -c10 9.22337203685478e+18 -c12 9999.9999 -execute my_delete ; -set @arg00= '9223372036854775807' ; -execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, -@arg00, @arg00, @arg00, @arg00, @arg00 ; -Warnings: -Warning 1264 Out of range value for column 'c1' at row 1 -Warning 1264 Out of range value for column 'c2' at row 1 -Warning 1264 Out of range value for column 'c3' at row 1 -Warning 1264 Out of range value for column 'c4' at row 1 -Warning 1264 Out of range value for column 'c5' at row 1 -Warning 1264 Out of range value for column 'c12' at row 1 -execute my_select ; -c1 127 -c2 32767 -c3 8388607 -c4 2147483647 -c5 2147483647 -c6 9223372036854775807 -c7 9.22337e+18 -c8 9.22337203685478e+18 -c9 9.22337203685478e+18 -c10 9.22337203685478e+18 -c12 9999.9999 -execute my_delete ; -set @arg00= -9223372036854775808 ; -execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, -@arg00, @arg00, @arg00, @arg00, @arg00 ; -Warnings: -Warning 1264 Out of range value for column 'c1' at row 1 -Warning 1264 Out of range value for column 'c2' at row 1 -Warning 1264 Out of range value for column 'c3' at row 1 -Warning 1264 Out of range value for column 'c4' at row 1 -Warning 1264 Out of range value for column 'c5' at row 1 -Warning 1264 Out of range value for column 'c12' at row 1 -execute my_select ; -c1 -128 -c2 -32768 -c3 -8388608 -c4 -2147483648 -c5 -2147483648 -c6 -9223372036854775808 -c7 -9.22337e+18 -c8 -9.22337203685478e+18 -c9 -9.22337203685478e+18 -c10 -9.22337203685478e+18 -c12 -9999.9999 -execute my_delete ; -set @arg00= '-9223372036854775808' ; -execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, -@arg00, @arg00, @arg00, @arg00, @arg00 ; -Warnings: -Warning 1264 Out of range value for column 'c1' at row 1 -Warning 1264 Out of range value for column 'c2' at row 1 -Warning 1264 Out of range value for column 'c3' at row 1 -Warning 1264 Out of range value for column 'c4' at row 1 -Warning 1264 Out of range value for column 'c5' at row 1 -Warning 1264 Out of range value for column 'c12' at row 1 -execute my_select ; -c1 -128 -c2 -32768 -c3 -8388608 -c4 -2147483648 -c5 -2147483648 -c6 -9223372036854775808 -c7 -9.22337e+18 -c8 -9.22337203685478e+18 -c9 -9.22337203685478e+18 -c10 -9.22337203685478e+18 -c12 -9999.9999 -execute my_delete ; -set @arg00= 1.11111111111111111111e+50 ; -execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, -@arg00, @arg00, @arg00, @arg00, @arg00 ; -Warnings: -Warning 1264 Out of range value for column 'c1' at row 1 -Warning 1264 Out of range value for column 'c2' at row 1 -Warning 1264 Out of range value for column 'c3' at row 1 -Warning 1264 Out of range value for column 'c4' at row 1 -Warning 1264 Out of range value for column 'c5' at row 1 -Warning 1264 Out of range value for column 'c6' at row 1 -Warning 1264 Out of range value for column 'c7' at row 1 -Warning 1264 Out of range value for column 'c12' at row 1 -execute my_select ; -c1 127 -c2 32767 -c3 8388607 -c4 2147483647 -c5 2147483647 -c6 9223372036854775807 -c7 3.40282e+38 -c8 1.11111111111111e+50 -c9 1.11111111111111e+50 -c10 1.11111111111111e+50 -c12 9999.9999 -execute my_delete ; -set @arg00= '1.11111111111111111111e+50' ; -execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, -@arg00, @arg00, @arg00, @arg00, @arg00 ; -Warnings: -Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1265 Data truncated for column 'c2' at row 1 -Warning 1265 Data truncated for column 'c3' at row 1 -Warning 1265 Data truncated for column 'c4' at row 1 -Warning 1265 Data truncated for column 'c5' at row 1 -Warning 1265 Data truncated for column 'c6' at row 1 -Warning 1264 Out of range value for column 'c7' at row 1 -Warning 1264 Out of range value for column 'c12' at row 1 -execute my_select ; -c1 1 -c2 1 -c3 1 -c4 1 -c5 1 -c6 1 -c7 3.40282e+38 -c8 1.11111111111111e+50 -c9 1.11111111111111e+50 -c10 1.11111111111111e+50 -c12 9999.9999 -execute my_delete ; -set @arg00= -1.11111111111111111111e+50 ; -execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, -@arg00, @arg00, @arg00, @arg00, @arg00 ; -Warnings: -Warning 1264 Out of range value for column 'c1' at row 1 -Warning 1264 Out of range value for column 'c2' at row 1 -Warning 1264 Out of range value for column 'c3' at row 1 -Warning 1264 Out of range value for column 'c4' at row 1 -Warning 1264 Out of range value for column 'c5' at row 1 -Warning 1264 Out of range value for column 'c6' at row 1 -Warning 1264 Out of range value for column 'c7' at row 1 -Warning 1264 Out of range value for column 'c12' at row 1 -execute my_select ; -c1 -128 -c2 -32768 -c3 -8388608 -c4 -2147483648 -c5 -2147483648 -c6 -9223372036854775808 -c7 -3.40282e+38 -c8 -1.11111111111111e+50 -c9 -1.11111111111111e+50 -c10 -1.11111111111111e+50 -c12 -9999.9999 -execute my_delete ; -set @arg00= '-1.11111111111111111111e+50' ; -execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, -@arg00, @arg00, @arg00, @arg00, @arg00 ; -Warnings: -Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1265 Data truncated for column 'c2' at row 1 -Warning 1265 Data truncated for column 'c3' at row 1 -Warning 1265 Data truncated for column 'c4' at row 1 -Warning 1265 Data truncated for column 'c5' at row 1 -Warning 1265 Data truncated for column 'c6' at row 1 -Warning 1264 Out of range value for column 'c7' at row 1 -Warning 1264 Out of range value for column 'c12' at row 1 -execute my_select ; -c1 -1 -c2 -1 -c3 -1 -c4 -1 -c5 -1 -c6 -1 -c7 -3.40282e+38 -c8 -1.11111111111111e+50 -c9 -1.11111111111111e+50 -c10 -1.11111111111111e+50 -c12 -9999.9999 -execute my_delete ; -test_sequence --- insert into string columns -- -Warnings: -Warning 1265 Data truncated for column 'c20' at row 1 -Warnings: -Warning 1265 Data truncated for column 'c20' at row 1 -Warnings: -Warning 1265 Data truncated for column 'c20' at row 1 -Warnings: -Warning 1265 Data truncated for column 'c20' at row 1 -Warnings: -Warning 1265 Data truncated for column 'c20' at row 1 -Warnings: -Warning 1265 Data truncated for column 'c20' at row 1 -Warnings: -Warning 1265 Data truncated for column 'c20' at row 1 -Warnings: -Warning 1265 Data truncated for column 'c20' at row 1 -Warnings: -Warning 1265 Data truncated for column 'c20' at row 1 -Warnings: -Warning 1265 Data truncated for column 'c20' at row 1 -Warnings: -Warning 1265 Data truncated for column 'c20' at row 1 -Warnings: -Warning 1265 Data truncated for column 'c20' at row 1 -Warnings: -Warning 1265 Data truncated for column 'c20' at row 1 -Warnings: -Warning 1265 Data truncated for column 'c20' at row 1 -Warnings: -Warning 1265 Data truncated for column 'c20' at row 1 -Warnings: -Warning 1265 Data truncated for column 'c20' at row 1 -Warnings: -Warning 1265 Data truncated for column 'c20' at row 1 -Warnings: -Warning 1265 Data truncated for column 'c20' at row 1 -Warnings: -Warning 1265 Data truncated for column 'c20' at row 1 -Warnings: -Warning 1265 Data truncated for column 'c20' at row 1 -select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 -from t9 where c1 >= 20 -order by c1 ; -c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 -20 2 20 20 20 20 20 20 20 20 20 20 -21 2 21 21 21 21 21 21 21 21 21 21 -22 2 22 22 22 22 22 22 22 22 22 22 -23 2 23 23 23 23 23 23 23 23 23 23 -30 3 30 30 30 30 30 30 30 30 30 30 -31 3 31 31 31 31 31 31 31 31 31 31 -32 3 32 32 32 32 32 32 32 32 32 32 -33 3 33 33 33 33 33 33 33 33 33 33 -40 4 40 40 40 40 40 40 40 40 40 40 -41 4 41 41 41 41 41 41 41 41 41 41 -42 4 42 42 42 42 42 42 42 42 42 42 -43 4 43 43 43 43 43 43 43 43 43 43 -50 5 50.0 50.0 50.0 50.0 50.0 50.0 50.0 50.0 50.0 50.0 -51 5 51.0 51.0 51.0 51.0 51.0 51.0 51.0 51.0 51.0 51.0 -52 5 52.0 52.0 52.0 52.0 52.0 52.0 52.0 52.0 52.0 52.0 -53 5 53.0 53.0 53.0 53.0 53.0 53.0 53.0 53.0 53.0 53.0 -54 5 54 54 54.00 54.00 54.00 54.00 54.00 54.00 54.00 54.00 -55 5 55 55 55 55 55 55 55 55 55 55 -56 6 56 56 56.00 56.00 56.00 56.00 56.00 56.00 56.00 56.00 -57 6 57 57 57.00 57.00 57.00 57.00 57.00 57.00 57.00 57.00 -60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL -61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL -62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL -63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL -71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL -73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL -81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL -83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL -test_sequence --- select .. where string column = .. -- -set @arg00= '20'; -select 'true' as found from t9 -where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and -c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and -c27= '20' and c28= '20' and c29= '20' and c30= '20' ; -found -true -select 'true' as found from t9 -where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and -c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and -c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00; -found -true -prepare stmt1 from "select 'true' as found from t9 -where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and - c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and - c27= '20' and c28= '20' and c29= '20' and c30= '20'" ; -execute stmt1 ; -found -true -prepare stmt1 from "select 'true' as found from t9 -where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and - c21= ? and c22= ? and c23= ? and c25= ? and - c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ; -execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, -@arg00, @arg00, @arg00, @arg00, @arg00 ; -found -true -set @arg00= CAST('20' as binary); -select 'true' as found from t9 -where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20))) -= CAST('20' as binary) and c21= CAST('20' as binary) -and c22= CAST('20' as binary) and c23= CAST('20' as binary) and -c24= CAST('20' as binary) and c25= CAST('20' as binary) and -c26= CAST('20' as binary) and c27= CAST('20' as binary) and -c28= CAST('20' as binary) and c29= CAST('20' as binary) and -c30= CAST('20' as binary) ; -found -true -select 'true' as found from t9 -where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and -c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and -c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and -c30= @arg00; -found -true -prepare stmt1 from "select 'true' as found from t9 -where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20))) - = CAST('20' as binary) and c21= CAST('20' as binary) - and c22= CAST('20' as binary) and c23= CAST('20' as binary) and - c24= CAST('20' as binary) and c25= CAST('20' as binary) and - c26= CAST('20' as binary) and c27= CAST('20' as binary) and - c28= CAST('20' as binary) and c29= CAST('20' as binary) and - c30= CAST('20' as binary)" ; -execute stmt1 ; -found -true -prepare stmt1 from "select 'true' as found from t9 -where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and - c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and - c29= ? and c30= ?"; -execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, -@arg00, @arg00, @arg00, @arg00, @arg00 ; -found -true -set @arg00= 20; -select 'true' as found from t9 -where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and -c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and -c27= 20 and c28= 20 and c29= 20 and c30= 20 ; -found -true -select 'true' as found from t9 -where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and -c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and -c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00; -found -true -prepare stmt1 from "select 'true' as found from t9 -where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and - c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and - c27= 20 and c28= 20 and c29= 20 and c30= 20" ; -execute stmt1 ; -found -true -prepare stmt1 from "select 'true' as found from t9 -where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and - c21= ? and c22= ? and c23= ? and c25= ? and - c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ; -execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, -@arg00, @arg00, @arg00, @arg00, @arg00 ; -found -true -set @arg00= 20.0; -select 'true' as found from t9 -where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and -c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and -c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ; -found -true -select 'true' as found from t9 -where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and -c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and -c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00; -found -true -prepare stmt1 from "select 'true' as found from t9 -where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and - c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and - c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ; -execute stmt1 ; -found -true -prepare stmt1 from "select 'true' as found from t9 -where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and - c21= ? and c22= ? and c23= ? and c25= ? and - c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ; -execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, -@arg00, @arg00, @arg00, @arg00, @arg00 ; -found -true -delete from t9 ; -test_sequence --- insert into date/time columns -- -Warnings: -Warning 1265 Data truncated for column 'c17' at row 1 -Warnings: -Warning 1265 Data truncated for column 'c17' at row 1 -Warnings: -Warning 1265 Data truncated for column 'c17' at row 1 -Warnings: -Warning 1265 Data truncated for column 'c17' at row 1 -Warnings: -Warning 1265 Data truncated for column 'c17' at row 1 -Warnings: -Warning 1265 Data truncated for column 'c17' at row 1 -Warnings: -Warning 1265 Data truncated for column 'c17' at row 1 -Warnings: -Warning 1265 Data truncated for column 'c17' at row 1 -Warnings: -Warning 1264 Out of range value for column 'c13' at row 1 -Warning 1264 Out of range value for column 'c14' at row 1 -Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value for column 'c16' at row 1 -Warning 1264 Out of range value for column 'c17' at row 1 -Warnings: -Warning 1264 Out of range value for column 'c13' at row 1 -Warning 1264 Out of range value for column 'c14' at row 1 -Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value for column 'c16' at row 1 -Warning 1264 Out of range value for column 'c17' at row 1 -Warnings: -Warning 1264 Out of range value for column 'c13' at row 1 -Warning 1264 Out of range value for column 'c14' at row 1 -Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value for column 'c16' at row 1 -Warning 1264 Out of range value for column 'c17' at row 1 -Warnings: -Warning 1264 Out of range value for column 'c13' at row 1 -Warning 1264 Out of range value for column 'c14' at row 1 -Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value for column 'c16' at row 1 -Warning 1264 Out of range value for column 'c17' at row 1 -Warnings: -Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value for column 'c16' at row 1 -Warning 1264 Out of range value for column 'c17' at row 1 -Warnings: -Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value for column 'c16' at row 1 -Warning 1264 Out of range value for column 'c17' at row 1 -Warnings: -Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value for column 'c16' at row 1 -Warning 1264 Out of range value for column 'c17' at row 1 -Warnings: -Warning 1265 Data truncated for column 'c15' at row 1 -Warning 1264 Out of range value for column 'c16' at row 1 -Warning 1264 Out of range value for column 'c17' at row 1 -select c1, c13, c14, c15, c16, c17 from t9 order by c1 ; -c1 c13 c14 c15 c16 c17 -20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 -21 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 -22 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 -23 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 -30 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 -31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 -32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 -33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991 -40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 -41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 -42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 -43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 -50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 -51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 -52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 -53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000 -60 NULL NULL 1991-01-01 01:01:01 NULL NULL -61 NULL NULL 1991-01-01 01:01:01 NULL NULL -62 NULL NULL 1991-01-01 01:01:01 NULL NULL -63 NULL NULL 1991-01-01 01:01:01 NULL NULL -71 NULL NULL 1991-01-01 01:01:01 NULL NULL -73 NULL NULL 1991-01-01 01:01:01 NULL NULL -81 NULL NULL 1991-01-01 01:01:01 NULL NULL -83 NULL NULL 1991-01-01 01:01:01 NULL NULL -test_sequence --- select .. where date/time column = .. -- -set @arg00= '1991-01-01 01:01:01' ; -select 'true' as found from t9 -where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and -c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and -c17= '1991-01-01 01:01:01' ; -found -true -select 'true' as found from t9 -where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00 -and c17= @arg00 ; -found -true -prepare stmt1 from "select 'true' as found from t9 -where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and - c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and - c17= '1991-01-01 01:01:01'" ; -execute stmt1 ; -found -true -prepare stmt1 from "select 'true' as found from t9 -where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ; -execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ; -found -true -set @arg00= CAST('1991-01-01 01:01:01' as datetime) ; -select 'true' as found from t9 -where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and -c14= CAST('1991-01-01 01:01:01' as datetime) and -c15= CAST('1991-01-01 01:01:01' as datetime) and -c16= CAST('1991-01-01 01:01:01' as datetime) and -c17= CAST('1991-01-01 01:01:01' as datetime) ; -found -true -select 'true' as found from t9 -where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00 -and c17= @arg00 ; -found -true -prepare stmt1 from "select 'true' as found from t9 -where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and - c14= CAST('1991-01-01 01:01:01' as datetime) and - c15= CAST('1991-01-01 01:01:01' as datetime) and - c16= CAST('1991-01-01 01:01:01' as datetime) and - c17= CAST('1991-01-01 01:01:01' as datetime)" ; -execute stmt1 ; -found -true -prepare stmt1 from "select 'true' as found from t9 -where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ; -execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ; -found -true -set @arg00= 1991 ; -select 'true' as found from t9 -where c1= 20 and c17= 1991 ; -found -true -select 'true' as found from t9 -where c1= 20 and c17= @arg00 ; -found -true -prepare stmt1 from "select 'true' as found from t9 -where c1= 20 and c17= 1991" ; -execute stmt1 ; -found -true -prepare stmt1 from "select 'true' as found from t9 -where c1= 20 and c17= ?" ; -execute stmt1 using @arg00 ; -found -true -set @arg00= 1.991e+3 ; -select 'true' as found from t9 -where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ; -found -true -select 'true' as found from t9 -where c1= 20 and abs(c17 - @arg00) < 0.01 ; -found -true -prepare stmt1 from "select 'true' as found from t9 -where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ; -execute stmt1 ; -found -true -prepare stmt1 from "select 'true' as found from t9 -where c1= 20 and abs(c17 - ?) < 0.01" ; -execute stmt1 using @arg00 ; -found -true -drop table t1, t9; diff --git a/mysql-test/r/rowid_order_bdb.result b/mysql-test/r/rowid_order_bdb.result deleted file mode 100644 index bbdc6f6ff77..00000000000 --- a/mysql-test/r/rowid_order_bdb.result +++ /dev/null @@ -1,186 +0,0 @@ -drop table if exists t1, t2, t3,t4; -create table t1 ( -pk1 int not NULL, -key1 int(11), -key2 int(11), -PRIMARY KEY (pk1), -KEY key1 (key1), -KEY key2 (key2) -) engine=bdb; -insert into t1 values (-5, 1, 1), -(-100, 1, 1), -(3, 1, 1), -(0, 1, 1), -(10, 1, 1); -explain select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL 5 Using sort_union(key1,key2); Using where -select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3; -pk1 key1 key2 --100 1 1 --5 1 1 -0 1 1 -3 1 1 -10 1 1 -drop table t1; -create table t1 ( -pk1 int unsigned not NULL, -key1 int(11), -key2 int(11), -PRIMARY KEY (pk1), -KEY key1 (key1), -KEY key2 (key2) -) engine=bdb; -insert into t1 values (0, 1, 1), -(0xFFFFFFFF, 1, 1), -(0xFFFFFFFE, 1, 1), -(1, 1, 1), -(2, 1, 1); -select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3; -pk1 key1 key2 -0 1 1 -1 1 1 -2 1 1 -4294967294 1 1 -4294967295 1 1 -drop table t1; -create table t1 ( -pk1 char(4) not NULL, -key1 int(11), -key2 int(11), -PRIMARY KEY (pk1), -KEY key1 (key1), -KEY key2 (key2) -) engine=bdb collate latin2_general_ci; -insert into t1 values ('a1', 1, 1), -('b2', 1, 1), -('A3', 1, 1), -('B4', 1, 1); -select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3; -pk1 key1 key2 -a1 1 1 -A3 1 1 -b2 1 1 -B4 1 1 -drop table t1; -create table t1 ( -pk1 int not NULL, -pk2 char(4) not NULL collate latin1_german1_ci, -pk3 char(4) not NULL collate latin1_bin, -key1 int(11), -key2 int(11), -PRIMARY KEY (pk1,pk2,pk3), -KEY key1 (key1), -KEY key2 (key2) -) engine=bdb; -insert into t1 values -(1, 'u', 'u', 1, 1), -(1, 'u', char(0xEC), 1, 1), -(1, 'u', 'x', 1, 1); -insert ignore into t1 select pk1, char(0xEC), pk3, key1, key2 from t1; -insert ignore into t1 select pk1, 'x', pk3, key1, key2 from t1 where pk2='u'; -insert ignore into t1 select 2, pk2, pk3, key1, key2 from t1; -select * from t1; -pk1 pk2 pk3 key1 key2 -1 ì u 1 1 -1 ì x 1 1 -1 ì ì 1 1 -1 u u 1 1 -1 u x 1 1 -1 u ì 1 1 -1 x u 1 1 -1 x x 1 1 -1 x ì 1 1 -2 ì u 1 1 -2 ì x 1 1 -2 ì ì 1 1 -2 u u 1 1 -2 u x 1 1 -2 u ì 1 1 -2 x u 1 1 -2 x x 1 1 -2 x ì 1 1 -select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3; -pk1 pk2 pk3 key1 key2 -1 ì u 1 1 -1 ì x 1 1 -1 ì ì 1 1 -1 u u 1 1 -1 u x 1 1 -1 u ì 1 1 -1 x u 1 1 -1 x x 1 1 -1 x ì 1 1 -2 ì u 1 1 -2 ì x 1 1 -2 ì ì 1 1 -2 u u 1 1 -2 u x 1 1 -2 u ì 1 1 -2 x u 1 1 -2 x x 1 1 -2 x ì 1 1 -alter table t1 drop primary key; -select * from t1; -pk1 pk2 pk3 key1 key2 -1 ì u 1 1 -1 ì x 1 1 -1 ì ì 1 1 -1 u u 1 1 -1 u x 1 1 -1 u ì 1 1 -1 x u 1 1 -1 x x 1 1 -1 x ì 1 1 -2 ì u 1 1 -2 ì x 1 1 -2 ì ì 1 1 -2 u u 1 1 -2 u x 1 1 -2 u ì 1 1 -2 x u 1 1 -2 x x 1 1 -2 x ì 1 1 -select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3; -pk1 pk2 pk3 key1 key2 -1 ì u 1 1 -1 ì x 1 1 -1 ì ì 1 1 -1 u u 1 1 -1 u x 1 1 -1 u ì 1 1 -1 x u 1 1 -1 x x 1 1 -1 x ì 1 1 -2 ì u 1 1 -2 ì x 1 1 -2 ì ì 1 1 -2 u u 1 1 -2 u x 1 1 -2 u ì 1 1 -2 x u 1 1 -2 x x 1 1 -2 x ì 1 1 -drop table t1; -create table t1 ( -pk1 varchar(8) NOT NULL default '', -pk2 varchar(4) NOT NULL default '', -key1 int(11), -key2 int(11), -primary key(pk1, pk2), -KEY key1 (key1), -KEY key2 (key2) -) engine=bdb; -insert into t1 values ('','empt',2,2), -('a','a--a',2,2), -('bb','b--b',2,2), -('ccc','c--c',2,2), -('dddd','d--d',2,2); -select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3; -pk1 pk2 key1 key2 - empt 2 2 -a a--a 2 2 -bb b--b 2 2 -ccc c--c 2 2 -dddd d--d 2 2 -drop table t1; diff --git a/mysql-test/t/bdb-alter-table-1.test b/mysql-test/t/bdb-alter-table-1.test deleted file mode 100644 index 9cb469a8df6..00000000000 --- a/mysql-test/t/bdb-alter-table-1.test +++ /dev/null @@ -1,18 +0,0 @@ -# -# Test of problem when shutting down mysqld at once after ALTER TABLE -# --- source include/have_bdb.inc ---disable_warnings -drop table if exists t1; ---enable_warnings - -create table t1(objid BIGINT not null, tablename varchar(64), oid BIGINT not null, test BIGINT, PRIMARY KEY (objid), UNIQUE(tablename)) engine=BDB; -insert into t1 values(1, 't1',4,9); -insert into t1 values(2, 'metatable',1,9); -insert into t1 values(3, 'metaindex',1,9 ); -select * from t1; -alter table t1 drop column test; - -# Now we do a reboot and continue with the next test - -# End of 4.1 tests diff --git a/mysql-test/t/bdb-alter-table-2-master.opt b/mysql-test/t/bdb-alter-table-2-master.opt deleted file mode 100644 index 15ad73c500f..00000000000 --- a/mysql-test/t/bdb-alter-table-2-master.opt +++ /dev/null @@ -1,2 +0,0 @@ ---skip-external-locking - diff --git a/mysql-test/t/bdb-alter-table-2.test b/mysql-test/t/bdb-alter-table-2.test deleted file mode 100644 index 15b8938a11d..00000000000 --- a/mysql-test/t/bdb-alter-table-2.test +++ /dev/null @@ -1,10 +0,0 @@ -# -# Note that this test uses tables from the previous test -# This is to test that the table t1 survives a reboot of MySQL -# The options in the -master.opt file are just there to force the reboot -# --- source include/have_bdb.inc -select * from t1; -drop table t1; - -# End of 4.1 tests diff --git a/mysql-test/t/bdb-crash.test b/mysql-test/t/bdb-crash.test deleted file mode 100644 index 75f4d04d5df..00000000000 --- a/mysql-test/t/bdb-crash.test +++ /dev/null @@ -1,51 +0,0 @@ --- source include/have_bdb.inc - -# test for bug reported by Mark Steele - ---disable_warnings -drop table if exists t1; ---enable_warnings -CREATE TABLE t1 ( - ChargeID int(10) unsigned NOT NULL auto_increment, - ServiceID int(10) unsigned DEFAULT '0' NOT NULL, - ChargeDate date DEFAULT '0000-00-00' NOT NULL, - ChargeAmount decimal(20,2) DEFAULT '0.00' NOT NULL, - FedTaxes decimal(20,2) DEFAULT '0.00' NOT NULL, - ProvTaxes decimal(20,2) DEFAULT '0.00' NOT NULL, - ChargeStatus enum('New','Auth','Unauth','Sale','Denied','Refund') -DEFAULT 'New' NOT NULL, - ChargeAuthorizationMessage text, - ChargeComment text, - ChargeTimeStamp varchar(20), - PRIMARY KEY (ChargeID), - KEY ServiceID (ServiceID), - KEY ChargeDate (ChargeDate) -) engine=BDB; - -BEGIN; -INSERT INTO t1 -VALUES(NULL,1,'2001-03-01',1,1,1,'New',NULL,NULL,'now'); -COMMIT; - -BEGIN; -UPDATE t1 SET ChargeAuthorizationMessage = 'blablabla' WHERE -ChargeID = 1; -COMMIT; - -INSERT INTO t1 -VALUES(NULL,1,'2001-03-01',1,1,1,'New',NULL,NULL,'now'); -select * from t1; -drop table t1; - -# -# Test for bug #2342 "Running ANALYZE TABLE on bdb table -# inside a transaction hangs server thread" - -create table t1 (a int) engine=bdb; - -set autocommit=0; -insert into t1 values(1); -analyze table t1; -drop table t1; - -# End of 4.1 tests diff --git a/mysql-test/t/bdb-deadlock.test b/mysql-test/t/bdb-deadlock.test deleted file mode 100644 index 88243cfc860..00000000000 --- a/mysql-test/t/bdb-deadlock.test +++ /dev/null @@ -1,59 +0,0 @@ -# This test doesn't work with the embedded version as this code -# assumes that one query is running while we are doing queries on -# a second connection. -# This would work if mysqltest run would be threaded and handle each -# connection in a separate thread. -# - --- source include/not_embedded.inc --- source include/have_bdb.inc - -connect (con1,localhost,root,,); -connect (con2,localhost,root,,); - ---disable_warnings -drop table if exists t1,t2; ---enable_warnings -connection con1; -create table t1 (id integer, x integer) engine=BDB; -create table t2 (id integer, x integer) engine=BDB; -insert into t1 values(0, 0); -insert into t2 values(0, 0); -set autocommit=0; -update t1 set x = 1 where id = 0; - -connection con2; -set autocommit=0; -update t2 set x = 1 where id = 0; - -# The following query should hang because con1 is locking the page ---send -select x from t1 where id = 0; - -connection con1; -# This should generate a deadlock as we are trying to access a locked row ---send -select x from t2 where id = 0; - -connection con2; ---error 1213 -reap; -commit; - -connection con1; -reap; -commit; - -connection con2; -select * from t1; -select * from t2; -commit; - -connection con1; -select * from t1; -select * from t2; -commit; - -drop table t1,t2; - -# End of 4.1 tests diff --git a/mysql-test/t/bdb-deadlock.tminus b/mysql-test/t/bdb-deadlock.tminus deleted file mode 100644 index 3918a8ffe9d..00000000000 --- a/mysql-test/t/bdb-deadlock.tminus +++ /dev/null @@ -1,59 +0,0 @@ -# This test doesn't work with the embedded version as this code -# assumes that one query is running while we are doing queries on -# a second connection. -# This would work if mysqltest run would be threaded and handle each -# connection in a separate thread. -# - -#-- source include/not_embedded.inc --- source include/have_bdb.inc - -connect (con1,localhost,root,,); -connect (con2,localhost,root,,); - ---disable_warnings -drop table if exists t1,t2; ---enable_warnings -connection con1; -create table t1 (id integer, x integer) engine=BDB; -create table t2 (id integer, x integer) engine=BDB; -insert into t1 values(0, 0); -insert into t2 values(0, 0); -set autocommit=0; -update t1 set x = 1 where id = 0; - -connection con2; -set autocommit=0; -update t2 set x = 1 where id = 0; - -# The following query should hang because con1 is locking the page ---send -select x from t1 where id = 0; - -connection con1; -# This should generate a deadlock as we are trying to access a locked row ---send -select x from t2 where id = 0; - -connection con2; ---error 1213 -reap; -commit; - -connection con1; -reap; -commit; - -connection con2; -select * from t1; -select * from t2; -commit; - -connection con1; -select * from t1; -select * from t2; -commit; - -drop table t1,t2; - -# End of 4.1 tests diff --git a/mysql-test/t/bdb.test b/mysql-test/t/bdb.test deleted file mode 100644 index ebee341907c..00000000000 --- a/mysql-test/t/bdb.test +++ /dev/null @@ -1,1070 +0,0 @@ --- source include/have_bdb.inc - -# -# Small basic test with ignore -# - ---disable_warnings -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8; ---enable_warnings -create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=bdb; - -insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt'); -select id, code, name from t1 order by id; - -update ignore t1 set id = 8, name = 'Sinisa' where id < 3; -select id, code, name from t1 order by id; -update ignore t1 set id = id + 10, name = 'Ralph' where id < 4; -select id, code, name from t1 order by id; - -drop table t1; - -# -# A bit bigger test -# - -CREATE TABLE t1 ( - id int(11) NOT NULL auto_increment, - parent_id int(11) DEFAULT '0' NOT NULL, - level tinyint(4) DEFAULT '0' NOT NULL, - PRIMARY KEY (id), - KEY parent_id (parent_id), - KEY level (level) -) engine=bdb; -INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2); -update t1 set parent_id=parent_id+100; -select * from t1 where parent_id=102; -update t1 set id=id+1000; --- error 1062 -update t1 set id=1024 where id=1009; -select * from t1; -update ignore t1 set id=id+1; # This will change all rows -select * from t1; -update ignore t1 set id=1023 where id=1010; -select * from t1 where parent_id=102 order by parent_id,id; -# Here and below the differences in result are caused by difference in -# floating point calculations performed in BDB handler. ---replace_result 5 X 6 X -explain select level from t1 where level=1; ---replace_result 5 X 6 X -explain select level,id from t1 where level=1; ---replace_result 5 X 6 X -explain select level,id,parent_id from t1 where level=1; -select level,id from t1 where level=1; -select level,id,parent_id from t1 where level=1; -optimize table t1; -show keys from t1; -drop table t1; - -# -# Test replace -# - -CREATE TABLE t1 ( - gesuchnr int(11) DEFAULT '0' NOT NULL, - benutzer_id int(11) DEFAULT '0' NOT NULL, - PRIMARY KEY (gesuchnr,benutzer_id) -) engine=BDB; - -replace into t1 (gesuchnr,benutzer_id) values (2,1); -replace into t1 (gesuchnr,benutzer_id) values (1,1); -replace into t1 (gesuchnr,benutzer_id) values (1,1); -select * from t1; -drop table t1; - -# test for bug in replace with secondary key -create table t1 (id int not null primary key, x int not null, key (x)) engine=bdb; -insert into t1 (id, x) values (1, 1); -replace into t1 (id, x) values (1, 2); -select * from t1; -drop table t1; - -# -# test delete using hidden_primary_key -# - -create table t1 (a int) engine=bdb; -insert into t1 values (1), (2); -optimize table t1; -delete from t1 where a = 1; -select * from t1; -check table t1; -drop table t1; - -create table t1 (a int,b varchar(20)) engine=bdb; -insert into t1 values (1,""), (2,"testing"); -delete from t1 where a = 1; -select * from t1; -create index skr on t1 (a); -insert into t1 values (3,""), (4,"testing"); -analyze table t1; -show keys from t1; -drop table t1; - -# Test of reading on secondary key with may be null - -create table t1 (a int,b varchar(20),key(a)) engine=bdb; -insert into t1 values (1,""), (2,"testing"); -select * from t1 where a = 1; -drop table t1; - -# -# Test auto_increment on sub key -# - -create table t1 (a char(10) not null, b int not null auto_increment, primary key(a,b)) engine=BDB; -insert into t1 values ("a",1),("b",2),("a",2),("c",1); -insert into t1 values ("a",NULL),("b",NULL),("c",NULL),("e",NULL); -insert into t1 (a) values ("a"),("b"),("c"),("d"); -insert into t1 (a) values ('k'),('d'); -insert into t1 (a) values ("a"); -insert into t1 values ("d",last_insert_id()); -select * from t1; -flush tables; -select count(*) from t1; -drop table t1; - -# -# Test rollback -# - -create table t1 (n int not null primary key) engine=bdb; -set autocommit=0; -insert into t1 values (4); -rollback; -select n, "after rollback" from t1; -insert into t1 values (4); -commit; -select n, "after commit" from t1; -commit; -insert into t1 values (5); --- error 1062 -insert into t1 values (4); -commit; -select n, "after commit" from t1; -set autocommit=1; -insert into t1 values (6); --- error 1062 -insert into t1 values (4); -select n from t1; -set autocommit=0; -# -# savepoints -# -begin; -savepoint `my_savepoint`; -insert into t1 values (7); -savepoint `savept2`; -insert into t1 values (3); -select n from t1; -savepoint savept3; -rollback to savepoint savept2; ---error 1305 -rollback to savepoint savept3; -rollback to savepoint savept2; -release savepoint `my_savepoint`; -select n from t1; --- error 1305 -rollback to savepoint `my_savepoint`; ---error 1305 -rollback to savepoint savept2; -insert into t1 values (8); -savepoint sv; -commit; -savepoint sv; -set autocommit=1; -# nop -rollback; -drop table t1; - -# -# Testing transactions -# - -create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) engine=BDB; -begin; -insert into t1 values(1,'hamdouni'); -select id as afterbegin_id,nom as afterbegin_nom from t1; -rollback; -select id as afterrollback_id,nom as afterrollback_nom from t1; -set autocommit=0; -insert into t1 values(2,'mysql'); -select id as afterautocommit0_id,nom as afterautocommit0_nom from t1; -rollback; -select id as afterrollback_id,nom as afterrollback_nom from t1; -set autocommit=1; -drop table t1; - -# -# Simple not autocommit test -# - -CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=bdb; -insert into t1 values ('pippo', 12); --- error 1062 -insert into t1 values ('pippo', 12); # Gives error -delete from t1; -delete from t1 where id = 'pippo'; -select * from t1; - -insert into t1 values ('pippo', 12); -set autocommit=0; -delete from t1; -rollback; -select * from t1; -delete from t1; -commit; -select * from t1; -drop table t1; -set autocommit=1; - -# -# The following simple tests failed at some point -# - -CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) ENGINE=BDB; -INSERT INTO t1 VALUES (1, 'Jochen'); -select * from t1; -drop table t1; - -CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) ENGINE=BDB; -set autocommit=0; -INSERT INTO t1 SET _userid='marc@anyware.co.uk'; -COMMIT; -SELECT * FROM t1; -SELECT _userid FROM t1 WHERE _userid='marc@anyware.co.uk'; -drop table t1; -set autocommit=1; - -# -# Test when reading on part of unique key -# -CREATE TABLE t1 ( - user_id int(10) DEFAULT '0' NOT NULL, - name varchar(100), - phone varchar(100), - ref_email varchar(100) DEFAULT '' NOT NULL, - detail varchar(200), - PRIMARY KEY (user_id,ref_email) -)engine=bdb; - -INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar'); -select * from t1 where user_id=10292; -INSERT INTO t1 VALUES (10291,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10293,'shirish','2333604','shirish@yahoo.com','ddsds'); -select * from t1 where user_id=10292; -select * from t1 where user_id>=10292; -select * from t1 where user_id>10292; -select * from t1 where user_id<10292; -drop table t1; - -# -# Test that keys are created in right order -# - -CREATE TABLE t1 (a int not null, b int not null,c int not null, -key(a),primary key(a,b), unique(c),key(a),unique(b)); -show index from t1; -drop table t1; - -# -# Test of ALTER TABLE and BDB tables -# - -create table t1 (col1 int not null, col2 char(4) not null, primary key(col1)); -alter table t1 engine=BDB; -insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4'); -select * from t1; -update t1 set col2='7' where col1='4'; -select * from t1; -alter table t1 add co3 int not null; -select * from t1; -update t1 set col2='9' where col1='2'; -select * from t1; -drop table t1; - -# -# INSERT INTO BDB tables -# - -create table t1 (a int not null , b int, primary key (a)) engine = BDB; -create table t2 (a int not null , b int, primary key (a)) engine = myisam; -insert into t1 VALUES (1,3) , (2,3), (3,3); -select * from t1; -insert into t2 select * from t1; -select * from t2; -delete from t1 where b = 3; -select * from t1; -insert into t1 select * from t2; -select * from t1; -select * from t2; -drop table t1,t2; - -# -# Search on unique key -# - -CREATE TABLE t1 ( - id int(11) NOT NULL auto_increment, - ggid varchar(32) binary DEFAULT '' NOT NULL, - email varchar(64) DEFAULT '' NOT NULL, - passwd varchar(32) binary DEFAULT '' NOT NULL, - PRIMARY KEY (id), - UNIQUE ggid (ggid) -) ENGINE=BDB; - -insert into t1 (ggid,passwd) values ('test1','xxx'); -insert into t1 (ggid,passwd) values ('test2','yyy'); --- error 1062 -insert into t1 (ggid,passwd) values ('test2','this will fail'); --- error 1062 -insert into t1 (ggid,id) values ('this will fail',1); - -select * from t1 where ggid='test1'; -select * from t1 where passwd='xxx'; -select * from t1 where id=2; - -replace into t1 (ggid,id) values ('this will work',1); -replace into t1 (ggid,passwd) values ('test2','this will work'); --- error 1062 -update t1 set id=100,ggid='test2' where id=1; -select * from t1; -select * from t1 where id=1; -select * from t1 where id=999; -drop table t1; - -# -# ORDER BY on not primary key -# - -CREATE TABLE t1 ( - user_name varchar(12), - password text, - subscribed char(1), - user_id int(11) DEFAULT '0' NOT NULL, - quota bigint(20), - weight double, - access_date date, - access_time time, - approved datetime, - dummy_primary_key int(11) NOT NULL auto_increment, - PRIMARY KEY (dummy_primary_key) -) ENGINE=BDB; -INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','23:06:59','2000-09-07 23:06:59',1); -INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','23:06:59','2000-09-07 23:06:59',2); -INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','23:06:59','2000-09-07 23:06:59',3); -INSERT INTO t1 VALUES ('user_3','somepassword','Y',3,3,1.7320508075689,'2000-09-07','23:06:59','2000-09-07 23:06:59',4); -INSERT INTO t1 VALUES ('user_4','somepassword','N',4,4,2,'2000-09-07','23:06:59','2000-09-07 23:06:59',5); -select user_name, password , subscribed, user_id, quota, weight, access_date, access_time, approved, dummy_primary_key from t1 order by user_name; -drop table t1; - -# -# Testing of tables without primary keys -# - -CREATE TABLE t1 ( - id int(11) NOT NULL auto_increment, - parent_id int(11) DEFAULT '0' NOT NULL, - level tinyint(4) DEFAULT '0' NOT NULL, - KEY (id), - KEY parent_id (parent_id), - KEY level (level) -) engine=bdb; -INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1); -INSERT INTO t1 values (179,5,2); -update t1 set parent_id=parent_id+100; -select * from t1 where parent_id=102; -update t1 set id=id+1000; -update t1 set id=1024 where id=1009; -select * from t1; -update ignore t1 set id=id+1; # This will change all rows -select * from t1; -update ignore t1 set id=1023 where id=1010; -select * from t1 where parent_id=102; ---replace_result 5 X 6 X -explain select level from t1 where level=1; -select level,id from t1 where level=1; -select level,id,parent_id from t1 where level=1; -select level,id from t1 where level=1 order by id; -delete from t1 where level=1; -select * from t1; -drop table t1; - -# -# Test of index only reads -# -CREATE TABLE t1 ( - sca_code char(6) NOT NULL, - cat_code char(6) NOT NULL, - sca_desc varchar(50), - lan_code char(2) NOT NULL, - sca_pic varchar(100), - sca_sdesc varchar(50), - sca_sch_desc varchar(16), - PRIMARY KEY (sca_code, cat_code, lan_code), - INDEX sca_pic (sca_pic) -) engine = bdb ; - -INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING'); -select count(*) from t1 where sca_code = 'PD'; -select count(*) from t1 where sca_code <= 'PD'; -select count(*) from t1 where sca_pic is null; -alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic); -select count(*) from t1 where sca_code='PD' and sca_pic is null; -select count(*) from t1 where cat_code='E'; - -alter table t1 drop index sca_pic, add index (sca_pic, cat_code); -select count(*) from t1 where sca_code='PD' and sca_pic is null; -select count(*) from t1 where sca_pic >= 'n'; -select sca_pic from t1 where sca_pic is null; -update t1 set sca_pic="test" where sca_pic is null; -delete from t1 where sca_code='pd'; -drop table t1; - -# -# Test of opening table twice and timestamps -# -set @a:=now(); -CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=bdb; -insert into t1 (a) values(1),(2),(3); -select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a; -select a from t1 natural join t1 as t2 where b >= @a order by a; -update t1 set a=5 where a=1; -select a from t1; -drop table t1; - -# -# Test flushing of berkeley DB logs -# -flush logs; - -# -# Test key on blob with null values -# -create table t1 (b blob, i int, key (b(100)), key (i), key (i, b(20))) engine=bdb; -insert into t1 values ('this is a blob', 1), (null, -1), (null, null),("",1),("",2),("",3); -select b from t1 where b = 'this is a blob'; -select * from t1 where b like 't%'; -select b, i from t1 where b is not null; -select * from t1 where b is null and i > 0; -select * from t1 where i is NULL; -update t1 set b='updated' where i=1; -select * from t1; -drop table t1; - -# -# Test with variable length primary key -# -create table t1 (a varchar(100) not null, primary key(a), b int not null) engine=bdb; -insert into t1 values("hello",1),("world",2); -select * from t1 order by b desc; -optimize table t1; -show keys from t1; -drop table t1; - -# -# Test of bug in create index with NULL columns -# -create table t1 (i int, j int )ENGINE=BDB; -insert into t1 values (1,2); -select * from t1 where i=1 and j=2; -create index ax1 on t1 (i,j); -select * from t1 where i=1 and j=2; -drop table t1; - -# -# Test of with CONST tables and TEXT columns -# This gave a wrong result because the row information was freed too early -# - -create table t1 -( - branch_id int auto_increment primary key, - branch_name varchar(255) not null, - branch_active int not null default 1, - - unique branch_name(branch_name), - index branch_active(branch_active) -) engine=bdb; -create table t2 -( - target_id int auto_increment primary key, - target_name varchar(255) not null, - target_active int not null default 1, - - unique target_name(target_name), - index target_active(target_active) -) engine=bdb; -create table t3 -( - platform_id int auto_increment primary key, - platform_name varchar(255) not null, - platform_active int not null default 1, - - unique platform_name(platform_name), - index platform_active(platform_active) -) engine=bdb; -create table t4 -( - product_id int auto_increment primary key, - product_name varchar(255) not null, - version_file varchar(255) not null, - product_active int not null default 1, - - unique product_name(product_name), - index product_active(product_active) -) engine=bdb; -create table t5 -( - product_file_id int auto_increment primary key, - product_id int not null, - file_name varchar(255) not null, - /* cvs module used to find the file version */ - module_name varchar(255) not null, - /* flag whether the file is still included in the product */ - file_included int not null default 1, - - unique product_file(product_id,file_name), - index file_included(file_included) -) engine=bdb; -create table t6 -( - file_platform_id int auto_increment primary key, - product_file_id int not null, - platform_id int not null, - branch_id int not null, - /* filename in the build system */ - build_filename varchar(255) not null, - /* default filename in the build archive */ - archive_filename varchar(255) not null, - - unique file_platform(product_file_id,platform_id,branch_id) -) engine=bdb; -create table t8 -( - archive_id int auto_increment primary key, - branch_id int not null, - target_id int not null, - platform_id int not null, - product_id int not null, - status_id int not null default 1, - - unique archive(branch_id,target_id,platform_id,product_id), - index status_id(status_id) -) engine=bdb; -create table t7 -( - build_id int auto_increment primary key, - branch_id int not null, - target_id int not null, - build_number int not null, - build_date date not null, - /* build system tag, e.g. 'rmanight-022301-1779' */ - build_tag varchar(255) not null, - /* path relative to the build archive root, e.g. 'current' */ - build_path text not null, - - unique build(branch_id,target_id,build_number) -) engine=bdb; - -insert into t1 (branch_name) -values ('RealMedia'); -insert into t1 (branch_name) -values ('RP8REV'); -insert into t1 (branch_name) -values ('SERVER_8_0_GOLD'); - -insert into t2 (target_name) -values ('rmanight'); -insert into t2 (target_name) -values ('playerall'); -insert into t2 (target_name) -values ('servproxyall'); - -insert into t3 (platform_name) -values ('linux-2.0-libc6-i386'); -insert into t3 (platform_name) -values ('win32-i386'); - -insert into t4 (product_name, version_file) -values ('realserver', 'servinst'); -insert into t4 (product_name, version_file) -values ('realproxy', 'prxyinst'); -insert into t4 (product_name, version_file) -values ('realplayer', 'playinst'); -insert into t4 (product_name, version_file) -values ('plusplayer', 'plusinst'); - -create temporary table tmp1 - select branch_id, target_id, platform_id, product_id - from t1, t2, t3, t4 ; -create temporary table tmp2 - select tmp1.branch_id, tmp1.target_id, tmp1.platform_id, tmp1.product_id - from tmp1 left join t8 - using (branch_id,target_id,platform_id,product_id) - where t8.archive_id is null ; -insert into t8 - (branch_id, target_id, platform_id, product_id, status_id) - select branch_id, target_id, platform_id, product_id, 1 - from tmp2 ; -drop table tmp1 ; -drop table tmp2 ; - -insert into t5 (product_id, file_name, module_name) -values (1, 'servinst', 'server'); - -insert into t5 (product_id, file_name, module_name) -values (2, 'prxyinst', 'server'); - -insert into t5 (product_id, file_name, module_name) -values (3, 'playinst', 'rpapp'); - -insert into t5 (product_id, file_name, module_name) -values (4, 'plusinst', 'rpapp'); - -insert into t6 -(product_file_id,platform_id,branch_id,build_filename,archive_filename) -values (1, 2, 3, 'servinst.exe', 'win32-servinst.exe'); - -insert into t6 -(product_file_id,platform_id,branch_id,build_filename,archive_filename) -values (1, 1, 3, 'v80_linux-2.0-libc6-i386_servinst.bin', 'linux2-servinst.exe'); - -insert into t6 -(product_file_id,platform_id,branch_id,build_filename,archive_filename) -values (3, 2, 2, 'playinst.exe', 'win32-playinst.exe'); - -insert into t6 -(product_file_id,platform_id,branch_id,build_filename,archive_filename) -values (4, 2, 2, 'playinst.exe', 'win32-playinst.exe'); - -insert into t7 -(branch_id,target_id,build_number,build_tag,build_date,build_path) -values (2, 2, 1071, 'playerall-022101-1071', '2001-02-21', 'current'); - -insert into t7 -(branch_id,target_id,build_number,build_tag,build_date,build_path) -values (2, 2, 1072, 'playerall-022201-1072', '2001-02-22', 'current'); - -insert into t7 -(branch_id,target_id,build_number,build_tag,build_date,build_path) -values (3, 3, 388, 'servproxyall-022201-388', '2001-02-22', 'current'); - -insert into t7 -(branch_id,target_id,build_number,build_tag,build_date,build_path) -values (3, 3, 389, 'servproxyall-022301-389', '2001-02-23', 'current'); - -insert into t7 -(branch_id,target_id,build_number,build_tag,build_date,build_path) -values (4, 4, 100, 'foo target-010101-100', '2001-01-01', 'current'); - -update t8 -set status_id=2 -where branch_id=2 and target_id=2 and platform_id=2 and product_id=1; - -select t7.build_path -from - t1, - t7, - t2, - t3, - t4, - t5, - t6 -where - t7.branch_id = t1.branch_id and - t7.target_id = t2.target_id and - t5.product_id = t4.product_id and - t6.product_file_id = t5.product_file_id and - t6.platform_id = t3.platform_id and - t6.branch_id = t6.branch_id and - t7.build_id = 1 and - t4.product_id = 3 and - t5.file_name = 'playinst' and - t3.platform_id = 2; - -drop table t1, t2, t3, t4, t5, t6, t7, t8; - -# -# Test with blob + tinyint key -# - -CREATE TABLE t1 ( - a tinytext NOT NULL, - b tinyint(3) unsigned NOT NULL default '0', - PRIMARY KEY (a(32),b) -) ENGINE=BDB; -INSERT INTO t1 VALUES ('a',1),('a',2); -SELECT * FROM t1 WHERE a='a' AND b=2; -SELECT * FROM t1 WHERE a='a' AND b in (2); -SELECT * FROM t1 WHERE a='a' AND b in (1,2); -drop table t1; - -# -# Test min-max optimization -# - -CREATE TABLE t1 ( - a int3 unsigned NOT NULL, - b int1 unsigned NOT NULL, - UNIQUE (a, b) -) ENGINE = BDB; - -INSERT INTO t1 VALUES (1, 1); -SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1; -drop table t1; - -# -# Test problem with BDB and lock tables with duplicate write. -# - -create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=bdb; -insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); -LOCK TABLES t1 WRITE; ---error 1062 -insert into t1 values (99,1,2,'D'),(1,1,2,'D'); -select id from t1; -select id from t1; -UNLOCK TABLES; -DROP TABLE t1; - -create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=bdb; -insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); -LOCK TABLES t1 WRITE; -begin; ---error 1062 -insert into t1 values (99,1,2,'D'),(1,1,2,'D'); -select id from t1; -insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D'); -commit; -select id,id3 from t1; -UNLOCK TABLES; -DROP TABLE t1; - -# -# Test with empty tables (crashed with lock error) -# - -CREATE TABLE t1 (SYAIN_NO char(5) NOT NULL default '', KINMU_DATE char(6) NOT NULL default '', PRIMARY KEY (SYAIN_NO,KINMU_DATE)) ENGINE=BerkeleyDB; -CREATE TABLE t2 ( SYAIN_NO char(5) NOT NULL default '',STR_DATE char(8) NOT NULL default '',PRIMARY KEY (SYAIN_NO,STR_DATE) ) ENGINE=BerkeleyDB; -select T1.KINMU_DATE from t1 T1 ,t2 T2 where T1.SYAIN_NO = '12345' and T1.KINMU_DATE = '200106' and T2.SYAIN_NO = T1.SYAIN_NO; -select T1.KINMU_DATE from t1 T1 ,t2 T2 where T1.SYAIN_NO = '12345' and T1.KINMU_DATE = '200106' and T2.SYAIN_NO = T1.SYAIN_NO; -DROP TABLE t1,t2; - -# -# Test problem with joining table to itself on a multi-part unique key -# - -create table t1 (a int(11) not null, b int(11) not null, unique (a,b)) engine=bdb; -insert into t1 values (1,1), (1,2); -select * from t1 where a = 1; -select t1.*, t2.* from t1, t1 t2 where t1.a = t2.a and t2.a = 1; -select * from t1 where a = 1; -drop table t1; - -# -# This caused a deadlock in BDB internal locks -# - -create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=bdb; -insert into t1 values (0,0,0,'ABCDEFGHIJ'); -create table t2 (id int NOT NULL,primary key (id)) engine=bdb; -LOCK TABLES t1 WRITE, t2 WRITE; -insert into t2 values(1); -SELECT t1.* FROM t1 WHERE id IN (1); -SELECT t1.* FROM t2 left outer join t1 on (t1.id=t2.id); -delete from t1 where id3 >= 0 and id3 <= 0; -drop table t1,t2; - -# -# Test problems with NULL -# - -CREATE TABLE t1 (i varchar(48) NOT NULL default '', p varchar(255) default NULL,s varchar(48) NOT NULL default '', PRIMARY KEY (i), UNIQUE(p,s)) ENGINE=BDB; -INSERT INTO t1 VALUES ('00000000-e6c4ddeaa6-003b8-83458387','programs/xxxxxxxx.wmv','00000000-e6c4ddeb32-003bc-83458387'); -SELECT * FROM t1 WHERE p='programs/xxxxxxxx.wmv'; -drop table t1; - -# -# Test problem which gave error 'Can't find record in 't1'' -# - -CREATE TABLE t1 ( STR_DATE varchar(8) NOT NULL default '',INFO_NOTE varchar(200) default NULL,PRIMARY KEY (STR_DATE) ) ENGINE=BerkeleyDB; -select INFO_NOTE from t1 where STR_DATE = '20010610'; -select INFO_NOTE from t1 where STR_DATE < '20010610'; -select INFO_NOTE from t1 where STR_DATE > '20010610'; -drop table t1; - -# -# Test problem with multi table delete which quickly shows up with bdb tables. -# - -create table t1 (a int not null, b int, primary key (a)) engine =bdb; -create table t2 (a int not null, b int, primary key (a)) engine =bdb; -insert into t1 values (2, 3),(1, 7),(10, 7); -insert into t2 values (2, 3),(1, 7),(10, 7); -select * from t1; -select * from t2; -delete t1, t2 from t1, t2 where t1.a = t2.a; -select * from t1; -select * from t2; -select * from t2; -drop table t1,t2; - -# -# The bug #971 -# - -create table t1 (x int not null, index(x)) engine=bdb; -insert into t1 values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); -select * from t1 where x <= 10 and x >= 7; -select * from t1 where x <= 10 and x >= 7 order by x; -select * from t1 where x <= 10 and x >= 7 order by x desc; -select * from t1 where x <= 8 and x >= 5 order by x desc; -select * from t1 where x < 8 and x > 5 order by x desc; -drop table t1; - -# -# Test of multi-table-updates (bug #1980). -# - -create table t1 ( c char(8) not null ) engine=bdb; -insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9'); -insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F'); - -alter table t1 add b char(8) not null; -alter table t1 add a char(8) not null; -alter table t1 add primary key (a,b,c); -update t1 set a=c, b=c; - -create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=bdb; -insert into t2 select * from t1; - -delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b; -drop table t1,t2; - -# -# Test index only read (Bug #2509) -# -create table t1 (a char(10), key(a), b int not null, key(b)) engine=bdb; -insert into t1 values ('a',1),('A',2); -explain select a from t1; -select a from t1; -explain select b from t1; -select b from t1; -alter table t1 modify a char(10) binary; -explain select a from t1; -select a from t1; -drop table t1; - -# -# bug#2686 - index_merge select on BerkeleyDB table with varchar PK crashes -# - -create table t1( - pk1 text not null, pk2 text not null, pk3 char(4), - key1 int, key2 int, - primary key(pk1(4), pk2(4), pk3), key(key1), key(key2) -) engine=bdb; -insert into t1 values (concat('aaa-', repeat('A', 4000)), - concat('eee-', repeat('e', 4000)), 'a++a', 1, 1); -insert into t1 values (concat('bbb-', repeat('B', 4000)), - concat('ggg-', repeat('G', 4000)), 'b++b', 1, 1); -select substring(pk1, 1, 4), substring(pk1, 4001), - substring(pk2, 1, 4), substring(pk2, 4001), pk3, key1, key2 - from t1 force index(key1, key2) where key1 < 3 or key2 < 3; -drop table t1; - -# -# bug#2688 - Wrong index_merge query results for BDB table with -# variable length primary key -# - -create table t1 ( - pk1 varchar(8) not null default '', - pk2 varchar(4) not null default '', - key1 int(11) default null, - key2 int(11) default null, - primary key (pk1,pk2), - key key1 (key1), - key key2 (key2)) engine=bdb; -insert into t1 values ('','empt',2,2), ('a','a--a',2,2), - ('bb','b--b',2,2), ('ccc','c--c',2,2), ('dddd','d--d',2,2); -select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3; -drop table t1; - - -# -# Bug #4000: problem with active cursor. -# - -set autocommit=0; -create table t1(b varchar(30)) engine=bdb; -insert into t1 values ('one'); -commit; -select b FROM t1 outer_table where -exists (select 'two' from t1 where 'two' = outer_table.b); -drop table t1; -set autocommit=1; - -# -# Bug #4089: subselect and open cursor. -# - -create table t1(a int primary key, b varchar(30)) engine=bdb; -insert into t1 values (1,'one'), (2,'two'), (3,'three'), (4,'four'); -create table t2 like t1; -insert t2 select * from t1; -select a from t1 where a in (select a from t2); -delete from t2; -insert into t2 (a, b) - select a, b from t1 where (a, b) in (select a, b from t1); -select * from t2; -drop table t1, t2; - -# -# Bug #4304: TRUNCATE <table of type BDB> , wrong result -# - -create table t1 (a int, b varchar(30), primary key(a)) engine = bdb; -insert into t1 values (1,'one'); -commit; -truncate t1; -select * from t1; -drop table t1; - -# -# Check that BDB works fine with a string which is -# longer than 255 bytes for multibyte characters. -# -SET NAMES utf8; -create table t1 (a varchar(255) character set utf8) engine=bdb; -set @a:= convert(repeat(_latin1 0xFF, 255) using utf8); -insert into t1 values (@a); -select a, length(a), char_length(a) from t1; -drop table t1; -SET NAMES latin1; - -# -# Bug #5832 SELECT doesn't return records in some cases -# -CREATE TABLE t1 ( - id int unsigned NOT NULL auto_increment, - list_id smallint unsigned NOT NULL, - term TEXT NOT NULL, - PRIMARY KEY(id), - INDEX(list_id, term(4)) -) ENGINE=BDB CHARSET=utf8; -INSERT INTO t1 SET list_id = 1, term = "letterc"; -INSERT INTO t1 SET list_id = 1, term = "letterb"; -INSERT INTO t1 SET list_id = 1, term = "lettera"; -INSERT INTO t1 SET list_id = 1, term = "letterd"; -SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterc"); -SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterb"); -SELECT id FROM t1 WHERE (list_id = 1) AND (term = "lettera"); -SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterd"); -DROP TABLE t1; - -# -# Bug #15536: Crash when DELETE with subquery using BDB tables -# -create table t1 (a int, key(a)) engine=bdb; -create table t2 (b int, key(b)) engine=bdb; -insert into t1 values (1),(1),(2),(3),(4); -insert into t2 values (1),(5),(6),(7); -delete from t1 where (a in (select b from t2)); -select count(*) from t1; -# INSERT also blows up ---error 1242 -insert into t1 set a=(select b from t2); -select count(*) from t1; -# UPDATE also blows up -update t1 set a = a + 1 where (a in (select b from t2)); -select count(*) from t1; -drop table t1, t2; - ---echo End of 4.1 tests - -# -# alter temp table -# -create temporary table t1 (a int, primary key(a)) engine=bdb; -select * from t1; -alter table t1 add b int; -select * from t1; -drop table t1; - - -# -# Test varchar -# - -let $default=`select @@storage_engine`; -set storage_engine=bdb; -source include/varchar.inc; - -# -# Some errors/warnings on create -# - ---replace_result 1024 MAX_KEY_LENGTH 3072 MAX_KEY_LENGTH -create table t1 (v varchar(65530), key(v)); -drop table if exists t1; -create table t1 (v varchar(65536)); -show create table t1; -drop table t1; -create table t1 (v varchar(65530) character set utf8); -show create table t1; -drop table t1; - -# End varchar test -eval set storage_engine=$default; - -# -# Test that we can create a large key -# -create table t1 (a varchar(255) character set utf8, - b varchar(255) character set utf8, - c varchar(255) character set utf8, - d varchar(255) character set utf8, - key (a,b,c,d)) engine=bdb; -drop table t1; ---error ER_TOO_LONG_KEY -create table t1 (a varchar(255) character set utf8, - b varchar(255) character set utf8, - c varchar(255) character set utf8, - d varchar(255) character set utf8, - e varchar(255) character set utf8, - key (a,b,c,d,e)) engine=bdb; - -# -# Bug #14212: Server crash after COMMIT + ALTER TABLE -# -set autocommit=0; -create table t1 (a int) engine=bdb; -commit; -alter table t1 add primary key(a); -drop table t1; - - ---echo End of 5.0 tests - -# -# Bug #7955: SET TRANSACTION ISIOLATION LEVEL lives longer than next -# transaciton -# -create table t1 (a int) engine=bdb; -set session transaction isolation level repeatable read; -set transaction isolation level serializable; -begin; -select @@tx_isolation; -insert into t1 values (1); ---error ER_CANT_CHANGE_TX_ISOLATION -set transaction isolation level read committed; -rollback; -begin; -select @@tx_isolation; -insert into t1 values (1); -rollback; -drop table t1; - ---echo End of 5.1 tests diff --git a/mysql-test/t/bdb_cache-master.opt b/mysql-test/t/bdb_cache-master.opt deleted file mode 100644 index 5f0ebff98f6..00000000000 --- a/mysql-test/t/bdb_cache-master.opt +++ /dev/null @@ -1 +0,0 @@ ---set-variable=query_cache_size=1M diff --git a/mysql-test/t/bdb_cache.test b/mysql-test/t/bdb_cache.test deleted file mode 100644 index 85328920d71..00000000000 --- a/mysql-test/t/bdb_cache.test +++ /dev/null @@ -1,53 +0,0 @@ --- source include/have_bdb.inc --- source include/have_query_cache.inc - -# -# Without auto_commit. -# ---disable_warnings -drop table if exists t1, t2, t3; ---enable_warnings -flush status; -set autocommit=0; -create table t1 (a int not null) engine=bdb; -insert into t1 values (1),(2),(3); -select * from t1; -show status like "Qcache_queries_in_cache"; -drop table t1; -set autocommit=1; -create table t1 (a int not null) engine=bdb; -begin; -insert into t1 values (1),(2),(3); -select * from t1; -show status like "Qcache_queries_in_cache"; -drop table t1; -create table t1 (a int not null) engine=bdb; -create table t2 (a int not null) engine=bdb; -create table t3 (a int not null) engine=bdb; -insert into t1 values (1),(2); -insert into t2 values (1),(2); -insert into t3 values (1),(2); -select * from t1; -select * from t2; -select * from t3; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -begin; -select * from t1; -select * from t2; -select * from t3; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -insert into t1 values (3); -insert into t2 values (3); -insert into t1 values (4); -select * from t1; -select * from t2; -select * from t3; -show status like "Qcache_queries_in_cache"; -show status like "Qcache_hits"; -commit; -show status like "Qcache_queries_in_cache"; -drop table if exists t1, t2, t3; - -# End of 4.1 tests diff --git a/mysql-test/t/bdb_gis.test b/mysql-test/t/bdb_gis.test deleted file mode 100644 index 88dcbb7cbe9..00000000000 --- a/mysql-test/t/bdb_gis.test +++ /dev/null @@ -1,3 +0,0 @@ --- source include/have_bdb.inc -SET storage_engine=bdb; ---source include/gis_generic.inc diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index 77b76a14171..ccb3e7f718c 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -360,7 +360,7 @@ drop table t1; create table t1 ( c char(10) character set utf8, unique key a (c(1)) -) engine=bdb; +) engine=innodb; --enable_warnings insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); --error 1062 @@ -483,7 +483,7 @@ drop table t1; create table t1 ( c char(10) character set utf8 collate utf8_bin, unique key a (c(1)) -) engine=bdb; +) engine=innodb; --enable_warnings insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); --error 1062 @@ -558,7 +558,7 @@ drop table t1; create table t1 ( str varchar(255) character set utf8 not null, key str (str(2)) -) engine=bdb; +) engine=innodb; --enable_warnings INSERT INTO t1 VALUES ('str'); INSERT INTO t1 VALUES ('str2'); @@ -644,7 +644,7 @@ create table t1 ( insert into t1 values(1,'foo'),(2,'foobar'); select * from t1 where b like 'foob%'; --disable_warnings -alter table t1 engine=bdb; +alter table t1 engine=innodb; --enable_warnings select * from t1 where b like 'foob%'; drop table t1; diff --git a/mysql-test/t/index_merge_bdb.test b/mysql-test/t/index_merge_bdb.test deleted file mode 100644 index c49e6ab3175..00000000000 --- a/mysql-test/t/index_merge_bdb.test +++ /dev/null @@ -1,52 +0,0 @@ -# -# 2-sweeps read Index_merge test -# --- source include/have_bdb.inc - ---disable_warnings -drop table if exists t1; ---enable_warnings - -create table t1 ( - pk int primary key, - key1 int, - key2 int, - filler char(200), - filler2 char(200), - index(key1), - index(key2) -) engine=bdb; - - ---disable_query_log -let $1=1000; -while ($1) -{ - eval insert into t1 values($1, $1, $1, 'filler-data','filler-data-2'); - dec $1; -} ---enable_query_log - -select * from t1 where (key1 >= 2 and key1 <= 10) or (pk >= 4 and pk <=8 ); - -set @maxv=1000; - -select * from t1 where - (pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10) - or key1=18 or key1=60; - -select * from t1 where - (pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10) - or key1 < 3 or key1 > @maxv-11; - -select * from t1 where - (pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10) - or - (key1 < 5) or (key1 > 10 and key1 < 15) or (key1 >= 50 and key1 < 55 ) or (key1 > @maxv-10); - -select * from t1 where - (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) - or - (key1 < 5) or (key1 > @maxv-10); - -drop table t1; diff --git a/mysql-test/t/ps_6bdb.test b/mysql-test/t/ps_6bdb.test deleted file mode 100644 index 49dd7aa924b..00000000000 --- a/mysql-test/t/ps_6bdb.test +++ /dev/null @@ -1,25 +0,0 @@ -############################################### -# # -# Prepared Statements test on BDB tables # -# # -############################################### - -# -# NOTE: PLEASE SEE ps_1general.test (bottom) -# BEFORE ADDING NEW TEST CASES HERE !!! - -use test; - --- source include/have_bdb.inc -let $type= 'BDB' ; --- source include/ps_create.inc --- source include/ps_renew.inc - --- source include/ps_query.inc --- source include/ps_modify.inc --- source include/ps_modify1.inc --- source include/ps_conv.inc - -drop table t1, t9; - -# End of 4.1 tests diff --git a/mysql-test/t/rowid_order_bdb.test b/mysql-test/t/rowid_order_bdb.test deleted file mode 100644 index ef133054c35..00000000000 --- a/mysql-test/t/rowid_order_bdb.test +++ /dev/null @@ -1,108 +0,0 @@ -# -# Test for rowid ordering (and comparison) functions. -# do index_merge select for tables with PK of various types. -# ---disable_warnings -drop table if exists t1, t2, t3,t4; ---enable_warnings - --- source include/have_bdb.inc - -# Signed number as rowid -create table t1 ( - pk1 int not NULL, - key1 int(11), - key2 int(11), - PRIMARY KEY (pk1), - KEY key1 (key1), - KEY key2 (key2) -) engine=bdb; -insert into t1 values (-5, 1, 1), - (-100, 1, 1), - (3, 1, 1), - (0, 1, 1), - (10, 1, 1); -explain select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3; -select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3; -drop table t1; - -# Unsigned numbers as rowids -create table t1 ( - pk1 int unsigned not NULL, - key1 int(11), - key2 int(11), - PRIMARY KEY (pk1), - KEY key1 (key1), - KEY key2 (key2) -) engine=bdb; -insert into t1 values (0, 1, 1), - (0xFFFFFFFF, 1, 1), - (0xFFFFFFFE, 1, 1), - (1, 1, 1), - (2, 1, 1); -select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3; -drop table t1; - -# Case-insensitive char(N) -create table t1 ( - pk1 char(4) not NULL, - key1 int(11), - key2 int(11), - PRIMARY KEY (pk1), - KEY key1 (key1), - KEY key2 (key2) -) engine=bdb collate latin2_general_ci; -insert into t1 values ('a1', 1, 1), - ('b2', 1, 1), - ('A3', 1, 1), - ('B4', 1, 1); -select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3; -drop table t1; - -# Multi-part PK -create table t1 ( - pk1 int not NULL, - pk2 char(4) not NULL collate latin1_german1_ci, - pk3 char(4) not NULL collate latin1_bin, - key1 int(11), - key2 int(11), - PRIMARY KEY (pk1,pk2,pk3), - KEY key1 (key1), - KEY key2 (key2) -) engine=bdb; -insert into t1 values - (1, 'u', 'u', 1, 1), - (1, 'u', char(0xEC), 1, 1), - (1, 'u', 'x', 1, 1); -insert ignore into t1 select pk1, char(0xEC), pk3, key1, key2 from t1; -insert ignore into t1 select pk1, 'x', pk3, key1, key2 from t1 where pk2='u'; -insert ignore into t1 select 2, pk2, pk3, key1, key2 from t1; -select * from t1; -select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3; - -# Hidden PK -alter table t1 drop primary key; -select * from t1; -select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3; -drop table t1; - -# Variable-length PK -# this is also test for Bug#2688 -create table t1 ( - pk1 varchar(8) NOT NULL default '', - pk2 varchar(4) NOT NULL default '', - key1 int(11), - key2 int(11), - primary key(pk1, pk2), - KEY key1 (key1), - KEY key2 (key2) -) engine=bdb; -insert into t1 values ('','empt',2,2), - ('a','a--a',2,2), - ('bb','b--b',2,2), - ('ccc','c--c',2,2), - ('dddd','d--d',2,2); -select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3; - -drop table t1; - diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 95073b95ad6..d53da01bcff 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -29,7 +29,7 @@ ADD_DEFINITIONS(-DHAVE_ROW_BASED_REPLICATION -DMYSQL_SERVER ADD_EXECUTABLE(mysqld ../sql-common/client.c derror.cc des_key_file.cc discover.cc ../libmysql/errmsg.c field.cc field_conv.cc filesort.cc gstream.cc ha_heap.cc ha_myisam.cc ha_myisammrg.cc - ha_innodb.cc ha_partition.cc ha_federated.cc ha_berkeley.cc + ha_innodb.cc ha_partition.cc ha_federated.cc handler.cc hash_filo.cc hash_filo.h hostname.cc init.cc item.cc item_buff.cc item_cmpfunc.cc item_create.cc item_func.cc item_geofunc.cc item_row.cc diff --git a/sql/Makefile.am b/sql/Makefile.am index c9cfaf9f158..5c509707f51 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -47,7 +47,7 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ item_create.h item_subselect.h item_row.h \ mysql_priv.h item_geofunc.h sql_bitmap.h \ procedure.h sql_class.h sql_lex.h sql_list.h \ - sql_manager.h sql_map.h sql_string.h unireg.h \ + sql_map.h sql_string.h unireg.h \ sql_error.h field.h handler.h mysqld_suffix.h \ ha_heap.h ha_myisam.h ha_myisammrg.h ha_partition.h \ ha_innodb.h ha_federated.h \ diff --git a/sql/sql_manager.cc b/sql/sql_manager.cc index f580bcb16d9..b3c67ab5db7 100644 --- a/sql/sql_manager.cc +++ b/sql/sql_manager.cc @@ -23,7 +23,6 @@ */ #include "mysql_priv.h" -#include "sql_manager.h" ulong volatile manager_status; bool volatile manager_thread_in_use; diff --git a/sql/sql_manager.h b/sql/sql_manager.h deleted file mode 100644 index d42deb8ff81..00000000000 --- a/sql/sql_manager.h +++ /dev/null @@ -1,19 +0,0 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - 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; either version 2 of the License, or - (at your option) any later version. - - 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#ifdef WITH_BERKELEY_STORAGE_ENGINE -void berkeley_cleanup_log_files(void); -#endif /* WITH_BERKELEY_STORAGE_ENGINE */ |