mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
2901c3b8fa
Use server character set if --default-character-set is not used Added convert_string() for more efficient alloc+character-set convert of strings BitKeeper/deleted/.del-convert.result~a3b56e1db6f498e9: Delete: mysql-test/r/convert.result BitKeeper/deleted/.del-convert.test~f4ceb743194dfe72: Delete: mysql-test/t/convert.test BitKeeper/deleted/.del-make_win_src_distribution.old~5c9ebdc4a852b43b: Delete: scripts/make_win_src_distribution.old client/mysql.cc: Use server character set if --default-character-set is not used client/mysqltest.c: Code cleanup (merge identical code) More debug messages heap/hp_create.c: After merge fix include/m_ctype.h: After merge fix include/my_global.h: Remove size_str (we already have size_s) include/mysql_com.h: After merge fix libmysql/libmysql.c: After merge fix libmysqld/Makefile.am: After merge fix mysql-test/r/auto_increment.result: After merge fix mysql-test/r/create.result: After merge fix mysql-test/r/ctype_latin1_de.result: After merge fix mysql-test/r/distinct.result: After merge fix mysql-test/r/drop.result: After merge fix mysql-test/r/fulltext.result: After merge fix mysql-test/r/func_gconcat.result: After merge fix mysql-test/r/func_str.result: After merge fix mysql-test/r/func_test.result: After merge fix mysql-test/r/grant.result: After merge fix mysql-test/r/group_by.result: After merge fix mysql-test/r/handler.result: After merge fix mysql-test/r/heap.result: After merge fix mysql-test/r/heap_btree.result: After merge fix mysql-test/r/heap_hash.result: After merge fix mysql-test/r/innodb.result: After merge fix mysql-test/r/insert.result: After merge fix mysql-test/r/insert_select.result: After merge fix mysql-test/r/join_outer.result: After merge fix mysql-test/r/key.result: After merge fix mysql-test/r/key_cache.result: After merge fix mysql-test/r/loaddata.result: After merge fix mysql-test/r/myisam.result: After merge fix mysql-test/r/null.result: After merge fix mysql-test/r/null_key.result: After merge fix mysql-test/r/order_by.result: After merge fix mysql-test/r/rpl_do_grant.result: After merge fix mysql-test/r/rpl_error_ignored_table.result: After merge fix mysql-test/r/rpl_ignore_grant.result: After merge fix mysql-test/r/rpl_loaddata.result: After merge fix mysql-test/r/rpl_log.result: After merge fix mysql-test/r/rpl_log_pos.result: After merge fix mysql-test/r/rpl_max_relay_size.result: After merge fix mysql-test/r/rpl_replicate_do.result: After merge fix mysql-test/r/rpl_reset_slave.result: After merge fix mysql-test/r/rpl_rotate_logs.result: After merge fix mysql-test/r/rpl_user_variables.result: After merge fix mysql-test/r/select.result: After merge fix mysql-test/r/select_safe.result: After merge fix mysql-test/r/subselect.result: After merge fix mysql-test/r/type_blob.result: After merge fix mysql-test/r/type_decimal.result: After merge fix mysql-test/r/type_float.result: After merge fix mysql-test/r/type_ranges.result: After merge fix mysql-test/r/type_time.result: After merge fix mysql-test/r/type_uint.result: After merge fix mysql-test/r/union.result: After merge fix mysql-test/r/warnings.result: After merge fix mysql-test/t/auto_increment.test: After merge fix mysql-test/t/case.test: After merge fix mysql-test/t/ctype_collate.test: After merge fix mysql-test/t/ctype_latin1_de.test: After merge fix mysql-test/t/drop.test: After merge fix mysql-test/t/func_in.test: After merge fix mysql-test/t/func_set.test: After merge fix mysql-test/t/func_str.test: After merge fix mysql-test/t/func_test.test: After merge fix mysql-test/t/grant.test: After merge fix mysql-test/t/group_by.test: After merge fix mysql-test/t/handler.test: After merge fix mysql-test/t/heap.test: After merge fix mysql-test/t/heap_btree.test: After merge fix mysql-test/t/heap_hash.test: After merge fix mysql-test/t/innodb.test: After merge fix mysql-test/t/insert_select.test: After merge fix mysql-test/t/key.test: After merge fix mysql-test/t/key_cache.test: After merge fix mysql-test/t/lock_tables_lost_commit-master.opt: After merge fix mysql-test/t/lock_tables_lost_commit.test: After merge fix mysql-test/t/myisam.test: After merge fix mysql-test/t/row.test: After merge fix mysql-test/t/subselect.test: After merge fix mysql-test/t/type_decimal.test: After merge fix mysql-test/t/type_ranges.test: After merge fix mysql-test/t/type_uint.test: After merge fix mysql-test/t/variables.test: After merge fix mysql-test/t/warnings.test: After merge fix scripts/make_win_src_distribution.sh: after merge fixes sql-common/client.c: After merge fix Change my_connect() to use poll() If character set is not given, use servers character set. sql/field.cc: After merge fix Don't give warnings when storing data in fields in optimizer. sql/ha_myisammrg.h: After merge fix sql/log.cc: After merge fix sql/log_event.cc: After merge fix sql/mysqld.cc: After merge fix sql/opt_range.cc: After merge fix sql/set_var.cc: Code cleanup Fixed wrong usage of base_names (like medium.key_buffer) that caused core dumps sql/set_var.h: Fixed wrong usage of base_names (like medium.key_buffer) that caused core dumps sql/slave.cc: After merge fix sql/sql_acl.cc: After merge fix Code cleanup sql/sql_class.cc: Added convert_string() for more efficient alloc+character-set convert of strings Add cached flags to avoid calling mysql_charset_same() during parsing. sql/sql_class.h: Added convert_string() for more efficient alloc+character-set convert of strings Add cached flags to avoid calling mysql_charset_same() during parsing. sql/sql_handler.cc: After merge fix sql/sql_lex.h: After merge fix sql/sql_parse.cc: Optimize and fix memory reference errors reported by valgrind sql/sql_repl.cc: After merge fix sql/sql_yacc.yy: After merge fix Avoid calling mysql_charset_same() when parsing identifiers strings/ctype-latin1.c: Port latin_de conversion code from 4.0
142 lines
4.1 KiB
Text
142 lines
4.1 KiB
Text
#
|
|
# Test of auto_increment; The test for BDB tables is in bdb.test
|
|
#
|
|
--disable_warnings
|
|
drop table if exists t1;
|
|
--enable_warnings
|
|
SET SQL_WARNINGS=1;
|
|
|
|
create table t1 (a int not null auto_increment,b int, primary key (a)) type=myisam auto_increment=3;
|
|
insert into t1 values (1,1),(NULL,3),(NULL,4);
|
|
delete from t1 where a=4;
|
|
insert into t1 values (NULL,5),(NULL,6);
|
|
select * from t1;
|
|
delete from t1 where a=6;
|
|
#show table status like "t1";
|
|
replace t1 values (3,1);
|
|
ALTER TABLE t1 add c int;
|
|
replace t1 values (3,3,3);
|
|
insert into t1 values (NULL,7,7);
|
|
update t1 set a=8,b=b+1,c=c+1 where a=7;
|
|
insert into t1 values (NULL,9,9);
|
|
select * from t1;
|
|
drop table t1;
|
|
|
|
create table t1 (
|
|
skey tinyint unsigned NOT NULL auto_increment PRIMARY KEY,
|
|
sval char(20)
|
|
);
|
|
insert into t1 values (NULL, "hello");
|
|
insert into t1 values (NULL, "hey");
|
|
select * from t1;
|
|
select _rowid,t1._rowid,skey,sval from t1;
|
|
drop table t1;
|
|
|
|
#
|
|
# Test auto_increment on sub key
|
|
#
|
|
create table t1 (a char(10) not null, b int not null auto_increment, primary key(a,b));
|
|
insert into t1 values ("a",1),("b",2),("a",2),("c",1);
|
|
insert into t1 values ("a",NULL),("b",NULL),("c",NULL),("e",NULL);
|
|
insert into t1 (a) values ("a"),("b"),("c"),("d");
|
|
insert into t1 (a) values ('k'),('d');
|
|
insert into t1 (a) values ("a");
|
|
insert into t1 values ("d",last_insert_id());
|
|
select * from t1;
|
|
drop table t1;
|
|
|
|
create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ordid), index(ord,ordid));
|
|
insert into t1 (ordid,ord) values (NULL,'sdj'),(NULL,'sdj');
|
|
select * from t1;
|
|
drop table t1;
|
|
|
|
create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid));
|
|
insert into t1 values (NULL,'sdj'),(NULL,'sdj'),(NULL,"abc"),(NULL,'abc'),(NULL,'zzz'),(NULL,'sdj'),(NULL,'abc');
|
|
select * from t1;
|
|
drop table t1;
|
|
|
|
create table t1 (sid char(5), id int(2) NOT NULL auto_increment, key(sid, id));
|
|
create table t2 (sid char(20), id int(2));
|
|
insert into t2 values ('skr',NULL),('skr',NULL),('test',NULL);
|
|
insert into t1 select * from t2;
|
|
select * from t1;
|
|
drop table t1,t2;
|
|
|
|
#
|
|
# Test of auto_increment columns when they are set to 0
|
|
#
|
|
|
|
create table t1 (a int not null primary key auto_increment);
|
|
insert into t1 values (0);
|
|
update t1 set a=0;
|
|
select * from t1;
|
|
check table t1;
|
|
drop table t1;
|
|
|
|
#
|
|
# last_insert_id() madness
|
|
#
|
|
create table t1 (i tinyint unsigned not null auto_increment primary key);
|
|
insert into t1 set i = 254;
|
|
insert into t1 set i = null;
|
|
select last_insert_id();
|
|
--error 1062
|
|
insert into t1 set i = 254;
|
|
select last_insert_id();
|
|
--error 1062
|
|
insert into t1 set i = null;
|
|
select last_insert_id();
|
|
drop table t1;
|
|
|
|
create table t1 (i tinyint unsigned not null auto_increment, key (i));
|
|
insert into t1 set i = 254;
|
|
insert into t1 set i = null;
|
|
select last_insert_id();
|
|
insert into t1 set i = null;
|
|
select last_insert_id();
|
|
drop table t1;
|
|
|
|
create table t1 (i tinyint unsigned not null auto_increment primary key, b int, unique (b));
|
|
insert into t1 values (NULL, 10);
|
|
select last_insert_id();
|
|
insert into t1 values (NULL, 15);
|
|
select last_insert_id();
|
|
--error 1062
|
|
insert into t1 values (NULL, 10);
|
|
select last_insert_id();
|
|
|
|
drop table t1;
|
|
|
|
create table t1(a int auto_increment,b int null,primary key(a));
|
|
SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
|
|
insert into t1(a,b)values(NULL,1);
|
|
insert into t1(a,b)values(200,2);
|
|
insert into t1(a,b)values(0,3);
|
|
insert into t1(b)values(4);
|
|
insert into t1(b)values(5);
|
|
insert into t1(b)values(6);
|
|
insert into t1(b)values(7);
|
|
select * from t1 order by b;
|
|
delete from t1 where a=0;
|
|
update t1 set a=0 where b=5;
|
|
select * from t1 order by b;
|
|
delete from t1 where a=0;
|
|
update t1 set a=NULL where b=6;
|
|
update t1 set a=300 where b=7;
|
|
SET SQL_MODE='';
|
|
insert into t1(a,b)values(NULL,8);
|
|
insert into t1(a,b)values(400,9);
|
|
insert into t1(a,b)values(0,10);
|
|
insert into t1(b)values(11);
|
|
insert into t1(b)values(12);
|
|
insert into t1(b)values(13);
|
|
insert into t1(b)values(14);
|
|
select * from t1 order by b;
|
|
delete from t1 where a=0;
|
|
update t1 set a=0 where b=12;
|
|
select * from t1 order by b;
|
|
delete from t1 where a=0;
|
|
update t1 set a=NULL where b=13;
|
|
update t1 set a=500 where b=14;
|
|
select * from t1 order by b;
|
|
drop table t1;
|