forked from stoneatom/stonedb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tianmu):develop some auto_increment function for tianmu(stoneato…
- Loading branch information
Showing
13 changed files
with
291 additions
and
15 deletions.
There are no files selected for viewing
144 changes: 144 additions & 0 deletions
144
mysql-test/suite/tianmu/r/init_auto_increment_value.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
DROP DATABASE IF EXISTS auto_increment_value_db; | ||
CREATE DATABASE auto_increment_value_db; | ||
USE auto_increment_value_db; | ||
CREATE TABLE t_auto_increment_value ( | ||
id int NOT NULL AUTO_INCREMENT, | ||
data VARCHAR(64) DEFAULT NULL, | ||
PRIMARY KEY (id) | ||
) engine=tianmu AUTO_INCREMENT=100; | ||
show create table t_auto_increment_value; | ||
Table Create Table | ||
t_auto_increment_value CREATE TABLE `t_auto_increment_value` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT, | ||
`data` varchar(64) DEFAULT NULL, | ||
PRIMARY KEY (`id`) | ||
) ENGINE=TIANMU AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 | ||
insert into t_auto_increment_value (data) values("first"),("middle"),("last"); | ||
select * from t_auto_increment_value; | ||
id data | ||
100 first | ||
101 middle | ||
102 last | ||
show create table t_auto_increment_value; | ||
Table Create Table | ||
t_auto_increment_value CREATE TABLE `t_auto_increment_value` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT, | ||
`data` varchar(64) DEFAULT NULL, | ||
PRIMARY KEY (`id`) | ||
) ENGINE=TIANMU AUTO_INCREMENT=103 DEFAULT CHARSET=latin1 | ||
update t_auto_increment_value set id=80 where id=100; | ||
select * from t_auto_increment_value; | ||
id data | ||
80 first | ||
101 middle | ||
102 last | ||
show create table t_auto_increment_value; | ||
Table Create Table | ||
t_auto_increment_value CREATE TABLE `t_auto_increment_value` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT, | ||
`data` varchar(64) DEFAULT NULL, | ||
PRIMARY KEY (`id`) | ||
) ENGINE=TIANMU AUTO_INCREMENT=103 DEFAULT CHARSET=latin1 | ||
insert into t_auto_increment_value (id, data) values(0,"update_lt_max_id"); | ||
select * from t_auto_increment_value; | ||
id data | ||
80 first | ||
101 middle | ||
102 last | ||
103 update_lt_max_id | ||
update t_auto_increment_value set id=200 where id=101; | ||
select * from t_auto_increment_value; | ||
id data | ||
80 first | ||
200 middle | ||
102 last | ||
103 update_lt_max_id | ||
show create table t_auto_increment_value; | ||
Table Create Table | ||
t_auto_increment_value CREATE TABLE `t_auto_increment_value` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT, | ||
`data` varchar(64) DEFAULT NULL, | ||
PRIMARY KEY (`id`) | ||
) ENGINE=TIANMU AUTO_INCREMENT=201 DEFAULT CHARSET=latin1 | ||
insert into t_auto_increment_value (id, data) values(0,"update_gt_max_id"); | ||
select * from t_auto_increment_value; | ||
id data | ||
80 first | ||
200 middle | ||
102 last | ||
103 update_lt_max_id | ||
201 update_gt_max_id | ||
alter table t_auto_increment_value AUTO_INCREMENT=300; | ||
select * from t_auto_increment_value; | ||
id data | ||
80 first | ||
200 middle | ||
102 last | ||
103 update_lt_max_id | ||
201 update_gt_max_id | ||
show create table t_auto_increment_value; | ||
Table Create Table | ||
t_auto_increment_value CREATE TABLE `t_auto_increment_value` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT, | ||
`data` varchar(64) DEFAULT NULL, | ||
PRIMARY KEY (`id`) | ||
) ENGINE=TIANMU AUTO_INCREMENT=300 DEFAULT CHARSET=latin1 | ||
insert into t_auto_increment_value (id, data) values(0,"alter_gt_max_id"); | ||
select * from t_auto_increment_value; | ||
id data | ||
80 first | ||
200 middle | ||
102 last | ||
103 update_lt_max_id | ||
201 update_gt_max_id | ||
300 alter_gt_max_id | ||
alter table t_auto_increment_value AUTO_INCREMENT=50; | ||
select * from t_auto_increment_value; | ||
id data | ||
80 first | ||
200 middle | ||
102 last | ||
103 update_lt_max_id | ||
201 update_gt_max_id | ||
300 alter_gt_max_id | ||
show create table t_auto_increment_value; | ||
Table Create Table | ||
t_auto_increment_value CREATE TABLE `t_auto_increment_value` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT, | ||
`data` varchar(64) DEFAULT NULL, | ||
PRIMARY KEY (`id`) | ||
) ENGINE=TIANMU AUTO_INCREMENT=301 DEFAULT CHARSET=latin1 | ||
insert into t_auto_increment_value (id, data) values(0,"alter_lt_max_id"); | ||
select * from t_auto_increment_value; | ||
id data | ||
80 first | ||
200 middle | ||
102 last | ||
103 update_lt_max_id | ||
201 update_gt_max_id | ||
300 alter_gt_max_id | ||
301 alter_lt_max_id | ||
CREATE TABLE load_auto_increment_value ( | ||
id int(11) NOT NULL AUTO_INCREMENT, | ||
company varchar(25), | ||
PRIMARY KEY (id) | ||
) ENGINE=TIANMU AUTO_INCREMENT=100; | ||
LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/suite/tianmu/std_data/load_auto_increment_value.txt' INTO TABLE load_auto_increment_value; | ||
select * from load_auto_increment_value; | ||
id company | ||
100 "syz100" | ||
101 "syz101" | ||
102 "syz102" | ||
103 "syz103" | ||
104 "syz104" | ||
105 "syz105" | ||
106 "syz106" | ||
107 "syz107" | ||
show create table load_auto_increment_value; | ||
Table Create Table | ||
load_auto_increment_value CREATE TABLE `load_auto_increment_value` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT, | ||
`company` varchar(25) DEFAULT NULL, | ||
PRIMARY KEY (`id`) | ||
) ENGINE=TIANMU AUTO_INCREMENT=108 DEFAULT CHARSET=latin1 | ||
DROP DATABASE auto_increment_value_db; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
--source include/have_tianmu.inc | ||
# | ||
# Test auto_increment_value with TIANMU | ||
# | ||
--disable_warnings | ||
DROP DATABASE IF EXISTS auto_increment_value_db; | ||
--enable_warnings | ||
|
||
CREATE DATABASE auto_increment_value_db; | ||
USE auto_increment_value_db; | ||
|
||
# test init value | ||
CREATE TABLE t_auto_increment_value ( | ||
id int NOT NULL AUTO_INCREMENT, | ||
data VARCHAR(64) DEFAULT NULL, | ||
PRIMARY KEY (id) | ||
) engine=tianmu AUTO_INCREMENT=100; | ||
show create table t_auto_increment_value; | ||
insert into t_auto_increment_value (data) values("first"),("middle"),("last"); | ||
select * from t_auto_increment_value; | ||
show create table t_auto_increment_value; | ||
|
||
# test update | ||
update t_auto_increment_value set id=80 where id=100; | ||
select * from t_auto_increment_value; | ||
show create table t_auto_increment_value; | ||
insert into t_auto_increment_value (id, data) values(0,"update_lt_max_id"); | ||
select * from t_auto_increment_value; | ||
|
||
update t_auto_increment_value set id=200 where id=101; | ||
select * from t_auto_increment_value; | ||
show create table t_auto_increment_value; | ||
insert into t_auto_increment_value (id, data) values(0,"update_gt_max_id"); | ||
select * from t_auto_increment_value; | ||
|
||
# test alter | ||
alter table t_auto_increment_value AUTO_INCREMENT=300; | ||
select * from t_auto_increment_value; | ||
show create table t_auto_increment_value; | ||
insert into t_auto_increment_value (id, data) values(0,"alter_gt_max_id"); | ||
select * from t_auto_increment_value; | ||
|
||
# when SET AUTO_INCREMENT < max_id, AUTO_INCREMENT value wouldnot be changed. | ||
alter table t_auto_increment_value AUTO_INCREMENT=50; | ||
select * from t_auto_increment_value; | ||
show create table t_auto_increment_value; | ||
insert into t_auto_increment_value (id, data) values(0,"alter_lt_max_id"); | ||
select * from t_auto_increment_value; | ||
|
||
|
||
#test load data with auto_increment value into auto_increment col | ||
CREATE TABLE load_auto_increment_value ( | ||
id int(11) NOT NULL AUTO_INCREMENT, | ||
company varchar(25), | ||
PRIMARY KEY (id) | ||
) ENGINE=TIANMU AUTO_INCREMENT=100; | ||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR | ||
eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/tianmu/std_data/load_auto_increment_value.txt' INTO TABLE load_auto_increment_value; | ||
select * from load_auto_increment_value; | ||
show create table load_auto_increment_value; | ||
|
||
# Clean UP | ||
DROP DATABASE auto_increment_value_db; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
*/ | ||
|
||
#include "filter.h" | ||
|
||
#include "common/assert.h" | ||
#include "core/tools.h" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.