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 '#--------------------FN_DYNVARS_035_01-------------------------#'
18 ## It should be zero ##
19 SELECT @@identity = 0;
20 @@identity = 0
21 1
22 ## Creating and connecting with new connection test_con1 ##
23 SET @@autocommit = 0;
24 ## Inserting rows in table t1 ##
25 INSERT into t1(name) values('Record_1');
26 INSERT into t1(name) values('Record_2');
27 INSERT into t1(name) values('Record_3');
28 ## Verifying total values in t1 ##
29 SELECT @@identity from t1;
30 @@identity
31 3
32 3
33 3
34 ## Now inserting some data in table t2 ##
35 INSERT into t2(name) values('Record_1');
36 ## Verifying total values in t2 ##
37 SELECT @@identity from t2;
38 @@identity
39 1
40 '#--------------------FN_DYNVARS_035_02-------------------------#'
41 ## Creating and connecting with new connection test_con2 ##
42 SELECT * from t1;
43 id name
44 ## Verifying total values in t1 ##
45 SELECT @@identity from t1;
46 @@identity
47 ## Verifying total values in t2 ##
48 SELECT @@identity from t2;
49 @@identity
50 ## Inserting some more records in table t1 ##
51 INSERT into t1(name) values('Record_1_1');
52 INSERT into t1(name) values('Record_1_2');
53 ## Verifying total values in t1 ##
54 SELECT @@identity from t1;
55 @@identity
56 5
57 5
58 ## Inserting row in table t2 ##
59 INSERT into t2(name) values('Record_1_3');
60 ## Verifying total values in t2 ##
61 SELECT @@identity from t2;
62 @@identity
63 2
64 '#--------------------FN_DYNVARS_035_03-------------------------#'
65 ## Switching to connection test_con1 ##
66 ## Commiting rows added in test_con1 ##
67 COMMIT;
68 ## Verifying records in both tables ##
69 SELECT * from t1;
70 id name
71 1 Record_1
72 2 Record_2
73 3 Record_3
74 4 Record_1_1
75 5 Record_1_2
76 SELECT * from t2;
77 id name
78 1 Record_1
79 2 Record_1_3
80 ## Verifying total values in t1 after commiting data ##
81 SELECT @@identity from t1;
82 @@identity
83 1
84 1
85 1
86 1
87 1
88 ## Verifying total values in t2 after commiting data ##
89 SELECT @@identity from t2;
90 @@identity
91 1
92 1
93 INSERT into t1(name) values('Record_4');
94 ## Now verifying value of variable after inserting 1 row in this connection ##
95 SELECT @@identity from t1;
96 @@identity
97 6
98 6
99 6
100 6
101 6
102 6
103 ## Dropping tables t1 & t2 ##
104 drop table t1, t2;
105 ## Disconnecting both the connections ##