Added structure which can be cloned for multiple test cases.

This commit is contained in:
VilhoRaatikka
2014-03-25 23:19:24 +02:00
parent a137196de0
commit df02926321
3 changed files with 35 additions and 12 deletions

View File

@ -0,0 +1,21 @@
USE test;
SET autocommit = 0;
SET @a= -1;
SET @b = -2;
START TRANSACTION;
CREATE TABLE IF NOT EXISTS myCity (a int, b char(20));
INSERT INTO myCity VALUES (1, 'Milan');
INSERT INTO myCity VALUES (2, 'London');
COMMIT;
-- Now there are two values
START TRANSACTION;
DELETE FROM myCity;
-- Now there are zero values
SET @a = (SELECT COUNT(1) FROM myCity); -- implicit COMMIT for DELETE operation
ROLLBACK; -- nothing to roll back
START TRANSACTION;
SET @b = (SELECT COUNT(*) FROM myCity); -- implicit COMMIT for empty trx
START TRANSACTION;
DROP TABLE myCity;
SELECT (@a+@b) AS res; -- counts 0+0 ans sets the result to 'res'
COMMIT;