Debian Codegraph @

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

raw
1 drop table if exists t1;
2 drop table if exists t2;
3 ## Creating new table t1 ##
4 CREATE TABLE t1
5 (
6 id INT NOT NULL auto_increment,
7 PRIMARY KEY (id),
8 name VARCHAR(30)
9 ) ENGINE = INNODB;
10 ## Creating another new table t2 ##
11 CREATE TABLE t2
12 (
13 id INT NOT NULL auto_increment,
14 PRIMARY KEY (id),
15 name VARCHAR(30)
16 ) ENGINE = INNODB;
17 INSERT INTO t1 VALUES(100, "MDEV-515");
18 INSERT INTO t2 VALUES(100, "MDEV-515");
19 '#--------------------FN_DYNVARS_035_01-------------------------#'
20 ## It should be zero ##
21 SELECT @@identity = 0;
22 @@identity = 0
23 1
24 connect test_con1, localhost, root,,;
25 connection test_con1;
26 SET @@autocommit = 0;
27 ## Inserting rows in table t1 ##
28 INSERT into t1(name) values('Record_1');
29 INSERT into t1(name) values('Record_2');
30 INSERT into t1(name) values('Record_3');
31 ## Verifying total values in t1 ##
32 SELECT @@identity from t1;
33 @@identity
34 103
35 103
36 103
37 103
38 ## Now inserting some data in table t2 ##
39 INSERT into t2(name) values('Record_1');
40 ## Verifying total values in t2 ##
41 SELECT @@identity from t2;
42 @@identity
43 101
44 101
45 '#--------------------FN_DYNVARS_035_02-------------------------#'
46 connect test_con2, localhost, root,,;
47 connection test_con2;
48 SELECT * from t1;
49 id name
50 100 MDEV-515
51 ## Verifying total values in t1 ##
52 SELECT @@identity from t1;
53 @@identity
54 0
55 ## Verifying total values in t2 ##
56 SELECT @@identity from t2;
57 @@identity
58 0
59 ## Inserting some more records in table t1 ##
60 INSERT into t1(name) values('Record_1_1');
61 INSERT into t1(name) values('Record_1_2');
62 ## Verifying total values in t1 ##
63 SELECT @@identity from t1;
64 @@identity
65 105
66 105
67 105
68 ## Inserting row in table t2 ##
69 INSERT into t2(name) values('Record_1_3');
70 ## Verifying total values in t2 ##
71 SELECT @@identity from t2;
72 @@identity
73 102
74 102
75 '#--------------------FN_DYNVARS_035_03-------------------------#'
76 connection test_con1;
77 ## Commiting rows added in test_con1 ##
78 COMMIT;
79 ## Verifying records in both tables ##
80 SELECT * from t1;
81 id name
82 100 MDEV-515
83 101 Record_1
84 102 Record_2
85 103 Record_3
86 104 Record_1_1
87 105 Record_1_2
88 SELECT * from t2;
89 id name
90 100 MDEV-515
91 101 Record_1
92 102 Record_1_3
93 ## Verifying total values in t1 after commiting data ##
94 SELECT @@identity from t1;
95 @@identity
96 101
97 101
98 101
99 101
100 101
101 101
102 ## Verifying total values in t2 after commiting data ##
103 SELECT @@identity from t2;
104 @@identity
105 101
106 101
107 101
108 INSERT into t1(name) values('Record_4');
109 ## Now verifying value of variable after inserting 1 row in this connection ##
110 SELECT @@identity from t1;
111 @@identity
112 106
113 106
114 106
115 106
116 106
117 106
118 106
119 ## Dropping tables t1 & t2 ##
120 drop table t1, t2;
121 disconnect test_con1;
122 disconnect test_con2;