mirror of
https://github.com/MariaDB/server.git
synced 2025-07-07 06:01:31 +03:00
Merge bk@192.168.21.1:mysql-5.1
into mysql.com:/d2/hf/mrg/mysql-5.1-opt
This commit is contained in:
@ -112,6 +112,39 @@ c1
|
||||
Before and after comparison
|
||||
0
|
||||
drop table t1;
|
||||
CREATE TABLE t1(c1 TEXT, UNIQUE (c1(1)), cnt INT DEFAULT 1)
|
||||
ENGINE=INNODB CHARACTER SET UTF8;
|
||||
INSERT INTO t1 (c1) VALUES ('1a');
|
||||
SELECT * FROM t1;
|
||||
c1 cnt
|
||||
1a 1
|
||||
INSERT INTO t1 (c1) VALUES ('1b') ON DUPLICATE KEY UPDATE cnt=cnt+1;
|
||||
SELECT * FROM t1;
|
||||
c1 cnt
|
||||
1a 2
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(c1 VARCHAR(2), UNIQUE (c1(1)), cnt INT DEFAULT 1)
|
||||
ENGINE=INNODB CHARACTER SET UTF8;
|
||||
INSERT INTO t1 (c1) VALUES ('1a');
|
||||
SELECT * FROM t1;
|
||||
c1 cnt
|
||||
1a 1
|
||||
INSERT INTO t1 (c1) VALUES ('1b') ON DUPLICATE KEY UPDATE cnt=cnt+1;
|
||||
SELECT * FROM t1;
|
||||
c1 cnt
|
||||
1a 2
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(c1 CHAR(2), UNIQUE (c1(1)), cnt INT DEFAULT 1)
|
||||
ENGINE=INNODB CHARACTER SET UTF8;
|
||||
INSERT INTO t1 (c1) VALUES ('1a');
|
||||
SELECT * FROM t1;
|
||||
c1 cnt
|
||||
1a 1
|
||||
INSERT INTO t1 (c1) VALUES ('1b') ON DUPLICATE KEY UPDATE cnt=cnt+1;
|
||||
SELECT * FROM t1;
|
||||
c1 cnt
|
||||
1a 2
|
||||
DROP TABLE t1;
|
||||
End of 4.1 tests
|
||||
create table t1m (a int) engine = MEMORY;
|
||||
create table t1i (a int);
|
||||
@ -413,6 +446,45 @@ tes 1234
|
||||
drop table test;
|
||||
set global query_cache_type=@save_qcache_type;
|
||||
set global query_cache_size=@save_qcache_size;
|
||||
create table t1(
|
||||
id int auto_increment,
|
||||
c char(1) not null,
|
||||
counter int not null default 1,
|
||||
primary key (id),
|
||||
unique key (c)
|
||||
) engine=innodb;
|
||||
insert into t1 (id, c) values
|
||||
(NULL, 'a'),
|
||||
(NULL, 'a')
|
||||
on duplicate key update id = values(id), counter = counter + 1;
|
||||
select * from t1;
|
||||
id c counter
|
||||
2 a 2
|
||||
insert into t1 (id, c) values
|
||||
(NULL, 'b')
|
||||
on duplicate key update id = values(id), counter = counter + 1;
|
||||
select * from t1;
|
||||
id c counter
|
||||
2 a 2
|
||||
3 b 1
|
||||
truncate table t1;
|
||||
insert into t1 (id, c) values (NULL, 'a');
|
||||
select * from t1;
|
||||
id c counter
|
||||
1 a 1
|
||||
insert into t1 (id, c) values (NULL, 'b'), (NULL, 'b')
|
||||
on duplicate key update id = values(id), c = values(c), counter = counter + 1;
|
||||
select * from t1;
|
||||
id c counter
|
||||
1 a 1
|
||||
3 b 2
|
||||
insert into t1 (id, c) values (NULL, 'a')
|
||||
on duplicate key update id = values(id), c = values(c), counter = counter + 1;
|
||||
select * from t1;
|
||||
id c counter
|
||||
3 b 2
|
||||
4 a 2
|
||||
drop table t1;
|
||||
End of 5.0 tests
|
||||
CREATE TABLE t1 (a int, b int);
|
||||
insert into t1 values (1,1),(1,2);
|
||||
|
Reference in New Issue
Block a user