Add tests from develop
Added tests from develop. The test results need to be modified for 2.0.
This commit is contained in:
@ -0,0 +1,6 @@
|
||||
BEGIN;
|
||||
SELECT (@@server_id) INTO @a;
|
||||
SELECT @a;
|
||||
@a
|
||||
####server_id####
|
||||
COMMIT;
|
@ -0,0 +1,8 @@
|
||||
USE test;
|
||||
drop table if exists t1;
|
||||
create table t1 (id integer);
|
||||
set autocommit=0;
|
||||
begin;
|
||||
insert into t1 values(1);
|
||||
commit;
|
||||
drop table t1;
|
@ -0,0 +1,4 @@
|
||||
USE test;
|
||||
SELECT IF(@@server_id <> @TMASTER_ID,'OK (slave)','FAIL (master)') AS result;
|
||||
result
|
||||
OK (slave)
|
@ -0,0 +1,9 @@
|
||||
USE test;
|
||||
drop table if exists t1;
|
||||
create table t1 (id integer);
|
||||
set autocommit=0;
|
||||
insert into t1 values(1);
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
1
|
||||
drop table t1;
|
@ -0,0 +1,9 @@
|
||||
USE test;
|
||||
drop table if exists t1;
|
||||
create table t1 (id integer);
|
||||
set autocommit=OFF;
|
||||
insert into t1 values(1);
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
1
|
||||
drop table t1;
|
@ -0,0 +1,11 @@
|
||||
USE test;
|
||||
drop table if exists t1;
|
||||
create table t1 (id integer);
|
||||
set autocommit=0;
|
||||
begin;
|
||||
insert into t1 values(1);
|
||||
commit;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
1
|
||||
drop table t1;
|
@ -0,0 +1,11 @@
|
||||
USE test;
|
||||
drop table if exists t1;
|
||||
create table t1 (id integer);
|
||||
set autocommit=0;
|
||||
begin;
|
||||
insert into t1 values(1);
|
||||
commit;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
1
|
||||
drop table t1;
|
@ -0,0 +1,11 @@
|
||||
USE test;
|
||||
DROP DATABASE If EXISTS FOO;
|
||||
SET autocommit=1;
|
||||
BEGIN;
|
||||
CREATE DATABASE FOO;
|
||||
SELECT (@@server_id) INTO @a;
|
||||
SELECT IF(@a <> @TMASTER_ID,'OK (slave)','FAIL (master)') AS result;
|
||||
result
|
||||
OK (slave)
|
||||
DROP DATABASE FOO;
|
||||
COMMIT;
|
@ -0,0 +1,17 @@
|
||||
USE test;
|
||||
DROP TABLE IF EXISTS T1;
|
||||
DROP EVENT IF EXISTS myevent;
|
||||
SET autocommit=1;
|
||||
BEGIN;
|
||||
CREATE TABLE T1 (id integer);
|
||||
CREATE EVENT myevent
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR
|
||||
DO
|
||||
UPDATE t1 SET id = id + 1;
|
||||
SELECT (@@server_id) INTO @a;
|
||||
SELECT IF(@a <> @TMASTER_ID,'OK (slave)','FAIL (master)') AS result;
|
||||
result
|
||||
OK (slave)
|
||||
DROP TABLE T1;
|
||||
DROP EVENT myevent;
|
||||
COMMIT;
|
@ -0,0 +1,11 @@
|
||||
USE test;
|
||||
DROP TABLE IF EXISTS T1;
|
||||
SET autocommit=1;
|
||||
BEGIN;
|
||||
CREATE TABLE T1 (id integer);
|
||||
SELECT (@@server_id) INTO @a;
|
||||
SELECT IF(@a <> @TMASTER_ID,'OK (slave)','FAIL (master)') AS result;
|
||||
result
|
||||
OK (slave)
|
||||
DROP TABLE T1;
|
||||
COMMIT;
|
@ -0,0 +1,14 @@
|
||||
USE test;
|
||||
DROP PROCEDURE IF EXISTS simpleproc;
|
||||
SET autocommit=1;
|
||||
BEGIN;
|
||||
CREATE PROCEDURE simpleproc (OUT param1 INT)
|
||||
BEGIN
|
||||
SELECT COUNT(*) INTO param1 FROM t;
|
||||
END //
|
||||
SELECT (@@server_id) INTO @a;
|
||||
SELECT IF(@a <> @TMASTER_ID,'OK (slave)','FAIL (master)') AS result;
|
||||
result
|
||||
OK (slave)
|
||||
DROP PROCEDURE simpleproc;
|
||||
COMMIT;
|
@ -0,0 +1,13 @@
|
||||
USE test;
|
||||
DROP FUNCTION IF EXISTS hello;
|
||||
SET autocommit=1;
|
||||
BEGIN;
|
||||
CREATE FUNCTION hello (s CHAR(20))
|
||||
RETURNS CHAR(50) DETERMINISTIC
|
||||
RETURN CONCAT('Hello, ',s,'!');
|
||||
SELECT (@@server_id) INTO @a;
|
||||
SELECT IF(@a <> @TMASTER_ID,'OK (slave)','FAIL (master)') AS result;
|
||||
result
|
||||
OK (slave)
|
||||
DROP FUNCTION hello;
|
||||
COMMIT;
|
@ -0,0 +1,12 @@
|
||||
USE test;
|
||||
DROP TABLE IF EXISTS T1;
|
||||
CREATE TABLE T1 (id integer);
|
||||
SET autocommit=1;
|
||||
BEGIN;
|
||||
CREATE INDEX foo_t1 on T1 (id);
|
||||
SELECT (@@server_id) INTO @a;
|
||||
SELECT IF(@a <> @TMASTER_ID,'OK (slave)','FAIL (master)') AS result;
|
||||
result
|
||||
OK (slave)
|
||||
DROP TABLE T1;
|
||||
COMMIT;
|
@ -0,0 +1,6 @@
|
||||
use test;
|
||||
set autocommit=1;
|
||||
use mysql;
|
||||
select count(*) from user where user='skysql';
|
||||
count(*)
|
||||
2
|
@ -0,0 +1,15 @@
|
||||
USE test;
|
||||
DROP TABLE IF EXISTS myCity;
|
||||
SET autocommit = 0;
|
||||
START TRANSACTION;
|
||||
CREATE TABLE myCity (a int, b char(20));
|
||||
INSERT INTO myCity VALUES (1, 'Milan');
|
||||
INSERT INTO myCity VALUES (2, 'London');
|
||||
COMMIT;
|
||||
START TRANSACTION;
|
||||
DELETE FROM myCity;
|
||||
SELECT COUNT(*) FROM myCity;
|
||||
COUNT(*)
|
||||
0
|
||||
COMMIT;
|
||||
DROP TABLE myCity;
|
@ -0,0 +1,15 @@
|
||||
USE test;
|
||||
DROP TABLE IF EXISTS myCity;
|
||||
SET autocommit = Off;
|
||||
START TRANSACTION;
|
||||
CREATE TABLE myCity (a int, b char(20));
|
||||
INSERT INTO myCity VALUES (1, 'Milan');
|
||||
INSERT INTO myCity VALUES (2, 'London');
|
||||
COMMIT;
|
||||
START TRANSACTION;
|
||||
DELETE FROM myCity;
|
||||
SELECT COUNT(*) FROM myCity;
|
||||
COUNT(*)
|
||||
0
|
||||
COMMIT;
|
||||
DROP TABLE myCity;
|
@ -0,0 +1,13 @@
|
||||
USE test;
|
||||
DROP TABLE IF EXISTS myCity;
|
||||
SET autocommit = 0;
|
||||
CREATE TABLE myCity (a int, b char(20));
|
||||
INSERT INTO myCity VALUES (1, 'Milan');
|
||||
INSERT INTO myCity VALUES (2, 'London');
|
||||
COMMIT;
|
||||
DELETE FROM myCity;
|
||||
SELECT COUNT(*) FROM myCity;
|
||||
COUNT(*)
|
||||
0
|
||||
COMMIT;
|
||||
DROP TABLE myCity;
|
@ -0,0 +1,13 @@
|
||||
USE test;
|
||||
DROP TABLE IF EXISTS myCity;
|
||||
SET autocommit = oFf;
|
||||
CREATE TABLE myCity (a int, b char(20));
|
||||
INSERT INTO myCity VALUES (1, 'Milan');
|
||||
INSERT INTO myCity VALUES (2, 'London');
|
||||
COMMIT;
|
||||
DELETE FROM myCity;
|
||||
SELECT COUNT(*) FROM myCity;
|
||||
COUNT(*)
|
||||
0
|
||||
COMMIT;
|
||||
DROP TABLE myCity;
|
@ -0,0 +1,5 @@
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
SELECT SLEEP(5);
|
||||
--enable_result_log
|
||||
--enable_query_log
|
@ -0,0 +1,11 @@
|
||||
--source testconf.inc
|
||||
USE test;
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1 (id integer);
|
||||
set autocommit=0; # open transaction
|
||||
begin;
|
||||
insert into t1 values(1); # write to master
|
||||
commit;
|
||||
drop table t1;
|
@ -0,0 +1,3 @@
|
||||
--source testconf.inc
|
||||
USE test;
|
||||
SELECT IF(@@server_id <> @TMASTER_ID,'OK (slave)','FAIL (master)') AS result;
|
@ -0,0 +1,11 @@
|
||||
--source testconf.inc
|
||||
USE test;
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (id integer);
|
||||
set autocommit=0; # open transaction
|
||||
insert into t1 values(1); # write to master
|
||||
select count(*) from t1; # read from master
|
||||
drop table t1;
|
@ -0,0 +1,11 @@
|
||||
--source testconf.inc
|
||||
USE test;
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (id integer);
|
||||
set autocommit=OFF; # open transaction
|
||||
insert into t1 values(1); # write to master
|
||||
select count(*) from t1; # read from master
|
||||
drop table t1;
|
@ -0,0 +1,13 @@
|
||||
--source testconf.inc
|
||||
USE test;
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (id integer);
|
||||
set autocommit=0; # open transaction
|
||||
begin;
|
||||
insert into t1 values(1); # write to master
|
||||
commit;
|
||||
select count(*) from t1; # read from master since autocommit is disabled
|
||||
drop table t1;
|
@ -0,0 +1,13 @@
|
||||
--source testconf.inc
|
||||
USE test;
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (id integer);
|
||||
set autocommit=0; # open transaction
|
||||
begin;
|
||||
insert into t1 values(1); # write to master
|
||||
commit;
|
||||
select count(*) from t1; # read from master since autocommit is disabled
|
||||
drop table t1;
|
@ -0,0 +1,4 @@
|
||||
use test;
|
||||
set autocommit=1;
|
||||
use mysql;
|
||||
select count(*) from user where user='skysql';
|
@ -0,0 +1,16 @@
|
||||
--source testconf.inc
|
||||
USE test;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS myCity;
|
||||
--enable_warnings
|
||||
SET autocommit = 0;
|
||||
START TRANSACTION;
|
||||
CREATE TABLE myCity (a int, b char(20));
|
||||
INSERT INTO myCity VALUES (1, 'Milan');
|
||||
INSERT INTO myCity VALUES (2, 'London');
|
||||
COMMIT;
|
||||
START TRANSACTION;
|
||||
DELETE FROM myCity;
|
||||
SELECT COUNT(*) FROM myCity; # read transaction's modifications from master
|
||||
COMMIT;
|
||||
DROP TABLE myCity;
|
@ -0,0 +1,16 @@
|
||||
--source testconf.inc
|
||||
USE test;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS myCity;
|
||||
--enable_warnings
|
||||
SET autocommit = Off;
|
||||
START TRANSACTION;
|
||||
CREATE TABLE myCity (a int, b char(20));
|
||||
INSERT INTO myCity VALUES (1, 'Milan');
|
||||
INSERT INTO myCity VALUES (2, 'London');
|
||||
COMMIT;
|
||||
START TRANSACTION;
|
||||
DELETE FROM myCity;
|
||||
SELECT COUNT(*) FROM myCity; # read transaction's modifications from master
|
||||
COMMIT;
|
||||
DROP TABLE myCity;
|
@ -0,0 +1,16 @@
|
||||
--source testconf.inc
|
||||
USE test;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS myCity;
|
||||
--enable_warnings
|
||||
|
||||
SET autocommit = 0;
|
||||
CREATE TABLE myCity (a int, b char(20));
|
||||
INSERT INTO myCity VALUES (1, 'Milan');
|
||||
INSERT INTO myCity VALUES (2, 'London');
|
||||
COMMIT;
|
||||
DELETE FROM myCity; # implicit transaction started
|
||||
SELECT COUNT(*) FROM myCity; # read transaction's modifications from master
|
||||
COMMIT;
|
||||
|
||||
DROP TABLE myCity;
|
@ -0,0 +1,16 @@
|
||||
--source testconf.inc
|
||||
USE test;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS myCity;
|
||||
--enable_warnings
|
||||
|
||||
SET autocommit = oFf;
|
||||
CREATE TABLE myCity (a int, b char(20));
|
||||
INSERT INTO myCity VALUES (1, 'Milan');
|
||||
INSERT INTO myCity VALUES (2, 'London');
|
||||
COMMIT;
|
||||
DELETE FROM myCity; # implicit transaction started
|
||||
SELECT COUNT(*) FROM myCity; # read transaction's modifications from master
|
||||
COMMIT;
|
||||
|
||||
DROP TABLE myCity;
|
Reference in New Issue
Block a user