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 CONNECT test_con1,localhost,root,,;
14 connection test_con1;
15 ## Checking value of variable after opening new connection ##
16 SELECT @@autocommit;
17 @@autocommit
18 1
19 ## Setting value of variable to zero and inserting some rows ##
20 SET @@autocommit = 0;
21 INSERT into t1(name) values('Record_1');
22 INSERT into t1(name) values('Record_2');
23 SELECT * from t1;
24 id name
25 1 Record_1
26 2 Record_2
27 ## Creating another connection and verifying records in table ##
28 CONNECT test_con2,localhost,root,,;
29 connection test_con2;
30 SELECT * from t1;
31 id name
32 '#--------------------FN_DYNVARS_003_03-------------------------#'
33 ## Verifying behavior of variable by commiting rows in test_con1 ##
34 connection test_con1;
35 SELECT * from t1;
36 id name
37 1 Record_1
38 2 Record_2
39 COMMIT;
40 ## Now verifying records in table from connection # 02 ##
41 connection test_con2;
42 SELECT * from t1;
43 id name
44 1 Record_1
45 2 Record_2
46 '#--------------------FN_DYNVARS_003_04-------------------------#'
47 connection test_con1;
48 SELECT * from t1;
49 id name
50 1 Record_1
51 2 Record_2
52 ## Updating value of first row ##
53 UPDATE t1 set name = 'Record_12' where name = 'Record_1';
54 SELECT * from t1;
55 id name
56 1 Record_12
57 2 Record_2
58 ## Connecting to connecting # 02 and verifying effect of update query ##
59 connection test_con2;
60 SELECT * from t1;
61 id name
62 1 Record_1
63 2 Record_2
64 ## Now connecting with connection # 01 and using ROLLBACK after it ##
65 connection test_con1;
66 ROLLBACK;
67 SELECT * from t1;
68 id name
69 1 Record_1
70 2 Record_2
71 '#--------------------FN_DYNVARS_003_05-------------------------#'
72 connection test_con1;
73 INSERT into t1(name) values('Record_3');
74 ## Now verifying records in table from connection # 02 and changing value ##
75 ## of autocommit to true ##
76 connection test_con2;
77 SELECT * from t1;
78 id name
79 1 Record_1
80 2 Record_2
81 SET @@autocommit = 1;
82 INSERT into t1(name) values('Record_4');
83 INSERT into t1(name) values('Record_5');
84 SELECT * from t1;
85 id name
86 1 Record_1
87 2 Record_2
88 4 Record_4
89 5 Record_5
90 ## Connecting with connection # 01 and inserting few records ##
91 connection test_con1;
92 SELECT * from t1;
93 id name
94 1 Record_1
95 2 Record_2
96 3 Record_3
97 INSERT into t1(name) values('Record_6');
98 SELECT * from t1;
99 id name
100 1 Record_1
101 2 Record_2
102 3 Record_3
103 6 Record_6
104 ## Now verifying the effect of these new records in second connection ##
105 connection test_con2;
106 SELECT * from t1;
107 id name
108 1 Record_1
109 2 Record_2
110 4 Record_4
111 5 Record_5
112 ## Commit changes
113 connection test_con1;
114 COMMIT;
115 ## Dropping table t1 ##
116 DROP table t1;
117 disconnect test_con1;
118 disconnect test_con2;