~jlukas79/+junk/mysql-server

« back to all changes in this revision

Viewing changes to mysql-test/t/identity_func.test

manual merge 6.0-main --> 6.0-bka-review

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#################### mysql-test\t\identity_func.test ##########################
 
2
#                                                                             #
 
3
# Variable Name: identity                                                     #
 
4
# Scope: SESSION                                                              #
 
5
# Access Type: Dynamic                                                        #
 
6
# Data Type: numeric                                                          #
 
7
# Default Value: -                                                            #
 
8
# Range: -                                                                    #
 
9
#                                                                             #
 
10
#                                                                             #
 
11
# Creation Date: 2008-03-07                                                   #
 
12
# Author:  Salman Rawala                                                      #
 
13
#                                                                             #
 
14
# Description: Test Cases of Dynamic System Variable identity                 #
 
15
#              that checks the functionality of this variable                 #
 
16
#                                                                             #
 
17
# Reference: http://dev.mysql.com/doc/refman/5.1/en/                          #
 
18
#  server-system-variables.html                                               #
 
19
#                                                                             #
 
20
###############################################################################
 
21
 
 
22
--source include/have_innodb.inc
 
23
 
 
24
--disable_warnings
 
25
drop table if exists t1;
 
26
drop table if exists t2;
 
27
--enable_warnings
 
28
 
 
29
#########################
 
30
#   Creating new table  #
 
31
#########################
 
32
 
 
33
--echo ## Creating new table t1 ##
 
34
CREATE TABLE t1
 
35
(
 
36
id INT NOT NULL auto_increment,
 
37
PRIMARY KEY (id),
 
38
name VARCHAR(30)
 
39
) ENGINE = INNODB;
 
40
 
 
41
--echo ## Creating another new table t2 ##
 
42
CREATE TABLE t2
 
43
(
 
44
id INT NOT NULL auto_increment,
 
45
PRIMARY KEY (id),
 
46
name VARCHAR(30)
 
47
) ENGINE = INNODB;
 
48
 
 
49
--echo '#--------------------FN_DYNVARS_035_01-------------------------#'
 
50
###############################################
 
51
#    Verifying initial value of identity.     #     
 
52
###############################################
 
53
 
 
54
--echo ## It should be zero ## 
 
55
SELECT @@identity = 0;
 
56
 
 
57
--echo ## Creating and connecting with new connection test_con1 ##
 
58
connect (test_con1, localhost, root,,);
 
59
connection test_con1;
 
60
SET @@autocommit = 0;
 
61
 
 
62
--echo ## Inserting rows in table t1 ## 
 
63
INSERT into t1(name) values('Record_1');
 
64
INSERT into t1(name) values('Record_2');        
 
65
INSERT into t1(name) values('Record_3');
 
66
 
 
67
--echo ## Verifying total values in t1 ## 
 
68
SELECT @@identity from t1;
 
69
 
 
70
 
 
71
--echo ## Now inserting some data in table t2 ## 
 
72
INSERT into t2(name) values('Record_1');
 
73
 
 
74
--echo ## Verifying total values in t2 ## 
 
75
SELECT @@identity from t2;
 
76
 
 
77
 
 
78
--echo '#--------------------FN_DYNVARS_035_02-------------------------#'
 
79
##########################################################
 
80
#    Verifying value of identity with new connection     #     
 
81
##########################################################
 
82
 
 
83
--echo ## Creating and connecting with new connection test_con2 ##
 
84
connect (test_con2, localhost, root,,);
 
85
connection test_con2;
 
86
SELECT * from t1;
 
87
 
 
88
--echo ## Verifying total values in t1 ## 
 
89
SELECT @@identity from t1;
 
90
 
 
91
--echo ## Verifying total values in t2 ## 
 
92
SELECT @@identity from t2;
 
93
 
 
94
--echo ## Inserting some more records in table t1 ##
 
95
INSERT into t1(name) values('Record_1_1');
 
96
INSERT into t1(name) values('Record_1_2');
 
97
 
 
98
--echo ## Verifying total values in t1 ## 
 
99
SELECT @@identity from t1;
 
100
 
 
101
--echo ## Inserting row in table t2 ##
 
102
INSERT into t2(name) values('Record_1_3');
 
103
 
 
104
--echo ## Verifying total values in t2 ## 
 
105
SELECT @@identity from t2;
 
106
 
 
107
 
 
108
--echo '#--------------------FN_DYNVARS_035_03-------------------------#'
 
109
###################################################################
 
110
#    Verifying identity value by using commit in connectio # 01   #     
 
111
###################################################################
 
112
 
 
113
--echo ## Switching to connection test_con1 ##
 
114
connection test_con1;
 
115
 
 
116
--echo ## Commiting rows added in test_con1 ##
 
117
COMMIT;
 
118
 
 
119
--echo ## Verifying records in both tables ##
 
120
SELECT * from t1;
 
121
SELECT * from t2;
 
122
 
 
123
--echo ## Verifying total values in t1 after commiting data ## 
 
124
SELECT @@identity from t1;
 
125
 
 
126
--echo ## Verifying total values in t2 after commiting data ## 
 
127
SELECT @@identity from t2;
 
128
 
 
129
INSERT into t1(name) values('Record_4');
 
130
 
 
131
--echo ## Now verifying value of variable after inserting 1 row in this connection ## 
 
132
SELECT @@identity from t1;
 
133
 
 
134
--echo ## Dropping tables t1 & t2 ##
 
135
drop table t1, t2;
 
136
 
 
137
--echo ## Disconnecting both the connections ##
 
138
disconnect test_con1;
 
139
disconnect test_con2;
 
140
 
 
141
 
 
142
 
 
143
 
 
144