Debian Codegraph @

mysql-test/suite/sys_vars/r/autocommit_func.result

raw
1 drop table if exists t1;
2 ## Creating new table ##
3 CREATE TABLE t1
4 (
5 id INT NOT NULL auto_increment,
6 PRIMARY KEY (id),
7 name varchar(30)
8 ) ENGINE = INNODB;
9 '#--------------------FN_DYNVARS_003_01-------------------------#'
10 ## Setting variable's value to 0 i.e false ##
11 SET @@autocommit = 0;
12 '#--------------------FN_DYNVARS_003_02-------------------------#'
13 ## Creating new connection ##
14 ## Checking value of variable after opening new connection ##
15 SELECT @@autocommit;
16 @@autocommit
17 1
18 ## Setting value of variable to zero and inserting some rows ##
19 SET @@autocommit = 0;
20 INSERT into t1(name) values('Record_1');
21 INSERT into t1(name) values('Record_2');
22 SELECT * from t1;
23 id name
24 1 Record_1
25 2 Record_2
26 ## Creating another connection and verifying records in table ##
27 ## New Connection test_con2 ##
28 SELECT * from t1;
29 id name
30 '#--------------------FN_DYNVARS_003_03-------------------------#'
31 ## Verifying behavior of variable by commiting rows in test_con1 ##
32 ## Connecting with connection # 01 ##
33 SELECT * from t1;
34 id name
35 1 Record_1
36 2 Record_2
37 COMMIT;
38 ## New Connection test_con2 ##
39 ## Now verifying records in table from connection # 02 ##
40 SELECT * from t1;
41 id name
42 1 Record_1
43 2 Record_2
44 '#--------------------FN_DYNVARS_003_04-------------------------#'
45 ## Connecting to connection # 01 ##
46 SELECT * from t1;
47 id name
48 1 Record_1
49 2 Record_2
50 ## Updating value of first row ##
51 UPDATE t1 set name = 'Record_12' where name = 'Record_1';
52 SELECT * from t1;
53 id name
54 1 Record_12
55 2 Record_2
56 ## Connecting to connecting # 02 and verifying effect of update query ##
57 SELECT * from t1;
58 id name
59 1 Record_1
60 2 Record_2
61 ## Now connecting with connection # 01 and using ROLLBACK after it ##
62 ROLLBACK;
63 SELECT * from t1;
64 id name
65 1 Record_1
66 2 Record_2
67 '#--------------------FN_DYNVARS_003_05-------------------------#'
68 ## Connecting with connection # 01 ##
69 INSERT into t1(name) values('Record_3');
70 ## Connection test_con2 ##
71 ## Now verifying records in table from connection # 02 and changing value ##
72 ## of autocommit to true ##
73 SELECT * from t1;
74 id name
75 1 Record_1
76 2 Record_2
77 SET @@autocommit = 1;
78 INSERT into t1(name) values('Record_4');
79 INSERT into t1(name) values('Record_5');
80 SELECT * from t1;
81 id name
82 1 Record_1
83 2 Record_2
84 4 Record_4
85 5 Record_5
86 ## Connecting with connection # 01 and inserting few records ##
87 SELECT * from t1;
88 id name
89 1 Record_1
90 2 Record_2
91 3 Record_3
92 INSERT into t1(name) values('Record_6');
93 SELECT * from t1;
94 id name
95 1 Record_1
96 2 Record_2
97 3 Record_3
98 6 Record_6
99 ## Now verifying the effect of these new records in second connection ##
100 SELECT * from t1;
101 id name
102 1 Record_1
103 2 Record_2
104 4 Record_4
105 5 Record_5
106 ## Commit changes
107 COMMIT;
108 ## Dropping table t1 ##
109 DROP table t1;
110 ## Disconnecting both connections ##