1
by brian
clean slate |
1 |
drop table if exists t1; |
2 |
CREATE TABLE t1 ( |
|
520.1.16
by Brian Aker
More test updates (one ulong fix) |
3 |
id int NOT NULL auto_increment, |
1217
by Brian Aker
Removed bits of charset support from the parser. |
4 |
ggid varchar(32) DEFAULT '' NOT NULL, |
1
by brian
clean slate |
5 |
email varchar(64) DEFAULT '' NOT NULL, |
1217
by Brian Aker
Removed bits of charset support from the parser. |
6 |
passwd varchar(32) DEFAULT '' NOT NULL, |
1
by brian
clean slate |
7 |
PRIMARY KEY (id), |
8 |
UNIQUE ggid (ggid) |
|
9 |
) ENGINE=innodb; |
|
10 |
insert into t1 (ggid,passwd) values ('test1','xxx'); |
|
11 |
insert into t1 (ggid,passwd) values ('test2','yyy'); |
|
12 |
insert into t1 (ggid,passwd) values ('test2','this will fail'); |
|
13 |
ERROR 23000: Duplicate entry 'test2' for key 'ggid' |
|
14 |
insert into t1 (ggid,id) values ('this will fail',1); |
|
15 |
ERROR 23000: Duplicate entry '1' for key 'PRIMARY' |
|
16 |
select * from t1 where ggid='test1'; |
|
17 |
id ggid email passwd |
|
18 |
1 test1 xxx |
|
19 |
select * from t1 where passwd='xxx'; |
|
20 |
id ggid email passwd |
|
21 |
1 test1 xxx |
|
22 |
select * from t1 where id=2; |
|
23 |
id ggid email passwd |
|
24 |
2 test2 yyy |
|
25 |
replace into t1 (ggid,id) values ('this will work',1); |
|
26 |
replace into t1 (ggid,passwd) values ('test2','this will work'); |
|
27 |
update t1 set id=100,ggid='test2' where id=1; |
|
28 |
ERROR 23000: Duplicate entry 'test2' for key 'ggid' |
|
29 |
select * from t1; |
|
30 |
id ggid email passwd |
|
31 |
1 this will work |
|
32 |
3 test2 this will work |
|
33 |
select * from t1 where id=1; |
|
34 |
id ggid email passwd |
|
35 |
1 this will work |
|
36 |
select * from t1 where id=999; |
|
37 |
id ggid email passwd |
|
38 |
drop table t1; |
|
39 |
End of tests |