summaryrefslogtreecommitdiff
path: root/mysql-test/main/compound.result
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/main/compound.result')
-rw-r--r--mysql-test/main/compound.result172
1 files changed, 172 insertions, 0 deletions
diff --git a/mysql-test/main/compound.result b/mysql-test/main/compound.result
new file mode 100644
index 00000000000..a54faff4562
--- /dev/null
+++ b/mysql-test/main/compound.result
@@ -0,0 +1,172 @@
+CREATE TABLE t1 (a INT PRIMARY KEY)|
+BEGIN NOT ATOMIC
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+END|
+SELECT * FROM t1|
+a
+1
+2
+3
+PREPARE stmt FROM "BEGIN NOT ATOMIC
+ INSERT INTO t1 VALUES (4);
+ INSERT INTO t1 VALUES (5);
+ INSERT INTO t1 VALUES (?);
+END";
+SET @val = 6|
+reset master|
+EXECUTE stmt USING @val|
+SELECT * FROM t1|
+a
+1
+2
+3
+4
+5
+6
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (6)
+master-bin.000001 # Query # # COMMIT
+DROP TABLE t1|
+CREATE DATABASE mysqltest1|
+CREATE PROCEDURE mysqltest1.sp1()
+BEGIN
+PREPARE stmt FROM "BEGIN NOT ATOMIC CREATE TABLE t1 AS SELECT DATABASE(); END";
+EXECUTE stmt;
+END|
+CALL mysqltest1.sp1()|
+SELECT * FROM mysqltest1.t1|
+DATABASE()
+mysqltest1
+USE mysqltest1|
+DROP DATABASE mysqltest1|
+BEGIN NOT ATOMIC CREATE TABLE t1(a int); END|
+ERROR 3D000: No database selected
+BEGIN NOT ATOMIC SET @a=1; CREATE TABLE test.t1(a int); END|
+USE test|
+show tables|
+Tables_in_test
+t1
+drop table t1|
+/**/ if (select count(*) from information_schema.tables
+where table_schema='test' and table_name='t1') = 0
+then
+create table t1 (a int);
+end if|
+show tables|
+Tables_in_test
+t1
+/**/ if (select count(*) from information_schema.tables
+where table_schema='test' and table_name='t1') = 0
+then
+create table t1 (a int);
+end if|
+show tables|
+Tables_in_test
+t1
+case (select table_name from information_schema.tables where table_schema='test')
+when 't1' then create table t2 (b int);
+when 't2' then create table t3 (b int);
+else signal sqlstate '42S02';
+end case|
+show tables|
+Tables_in_test
+t1
+t2
+case
+when database() = 'test' then create table t3 (test text);
+when now() < date'2001-02-03' then create table oops (machine time);
+end case|
+show tables|
+Tables_in_test
+t1
+t2
+t3
+loop
+create table t4 (a int);
+end loop|
+ERROR 42S01: Table 't4' already exists
+show tables|
+Tables_in_test
+t1
+t2
+t3
+t4
+set @a=0;
+repeat
+set @a = @a + 1;
+until @a > 5
+end repeat|
+select @a|
+@a
+6
+/**/ while (select count(*) from information_schema.tables where table_schema='test')
+do
+select concat('drop table ', table_name) into @a
+from information_schema.tables where table_schema='test'
+ order by table_name limit 1;
+select @a as 'executing:';
+prepare dt from @a;
+execute dt;
+end while|
+executing: drop table t1
+executing: drop table t2
+executing: drop table t3
+executing: drop table t4
+create table t1 (x int)|
+create function fn(a int) returns int
+begin
+insert t1 values (a+7);
+return a+8;
+end|
+reset master|
+/**/ if fn(9) > 5 then
+select 1;
+end if|
+1
+1
+prepare stmt from "if fn(?) > 6 then
+ begin
+ declare a int;
+ set a=?*2;
+ insert t1 values(a+?);
+ end;
+end if"|
+set @a=1, @b=2, @c=3|
+execute stmt using @a, @b, @c|
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; SELECT `test`.`fn`(9)
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; SELECT `test`.`fn`(1)
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; insert t1 values( NAME_CONST('a',4)+3)
+master-bin.000001 # Query # # COMMIT
+drop function fn|
+drop table t1|
+begin not atomic select @@sql_mode; end|
+@@sql_mode
+STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
+create table t1 (a int)|
+select a from t1 having a > 1|
+a
+begin not atomic select a from t1 having a > 1; end|
+a
+drop table t1|
+#
+# MDEV-8615: Assertion `m_cpp_buf <= begin_ptr &&
+# begin_ptr <= m_cpp_buf + m_buf_length' failed in
+# Lex_input_stream::body_utf8_start
+#
+b'|
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'b'' at line 1