mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
merge with 4.1
BitKeeper/etc/ignore: auto-union BitKeeper/etc/logging_ok: auto-union BitKeeper/triggers/post-commit: Auto merged Docs/Support/texi2html: Auto merged Makefile.am: Auto merged client/Makefile.am: Auto merged client/mysql.cc: Auto merged client/mysqldump.c: Auto merged include/my_base.h: Auto merged include/my_global.h: Auto merged include/my_pthread.h: Auto merged include/my_sys.h: Auto merged include/my_time.h: Auto merged include/mysql.h: Auto merged include/mysql_com.h: Auto merged innobase/buf/buf0buf.c: Auto merged innobase/include/row0mysql.h: Auto merged innobase/row/row0sel.c: Auto merged libmysql/libmysql.c: Auto merged libmysqld/examples/Makefile.am: Auto merged myisam/mi_check.c: Auto merged mysql-test/include/ps_modify.inc: Auto merged mysql-test/install_test_db.sh: Auto merged mysql-test/r/alter_table.result: Auto merged mysql-test/r/auto_increment.result: Auto merged mysql-test/r/bdb.result: Auto merged mysql-test/r/ctype_latin1_de.result: Auto merged mysql-test/r/ctype_recoding.result: Auto merged mysql-test/r/fulltext.result: Auto merged mysql-test/r/func_gconcat.result: Auto merged mysql-test/r/func_group.result: Auto merged mysql-test/r/func_if.result: Auto merged mysql-test/t/derived.test: Auto merged mysql-test/t/insert.test: merge with 4.1 Fixed test case to not use 'if exists' when it shouldn't mysql-test/t/range.test: merge with 4.1 Added missing drop table sql/ha_ndbcluster.cc: merge with 4.1 Simple optimization: use max() instead of ? : sql/item_func.cc: merge with 4.1 (Added back old variable names for easier merges) sql/opt_range.cc: merge with 4.1 Removed argument 'parent_alloc' from QUICK_RANGE_SELECT as this was not used Added assert if using QUICK_GROUP_MIN_MAX_SELECT with parent_alloc as the init() function can't handle this Changed back get_quick_select_for_ref() to use it's own alloc root becasue this function may be called several times for one query sql/sql_handler.cc: merge with 4.1 change variable 'err' to 'error' as same function had a label named 'err' sql/sql_update.cc: Use multi-update code from 5.0 instead of 4.1 We will fix the locking code shortly in 5.0 to be faster than in 4.1
This commit is contained in:
@@ -14,12 +14,12 @@
|
||||
# several test cases.
|
||||
#
|
||||
# Please do not modify the structure (DROP/ALTER..) of the tables
|
||||
# 't1' and 't_many_col_types'.
|
||||
# 't1' and 't9'.
|
||||
#
|
||||
# But you are encouraged to use these two tables within your statements
|
||||
# whenever possible.
|
||||
# t1 - very simple table
|
||||
# t_many_col_types - table with nearly all available column types
|
||||
# (DELETE/UPDATE/...) whenever possible.
|
||||
# t1 - very simple table
|
||||
# t9 - table with nearly all available column types
|
||||
#
|
||||
# The structure and the content of these tables can be found in
|
||||
# include/ps_create.inc CREATE TABLE ...
|
||||
@@ -109,10 +109,10 @@ select a,b from t1 where a=@arg00;
|
||||
set @arg00=NULL;
|
||||
set @arg01=2;
|
||||
execute stmt1 using @arg00, @arg01;
|
||||
select a,b from t1;
|
||||
select a,b from t1 order by a;
|
||||
set @arg00=0;
|
||||
execute stmt1 using @arg01, @arg00;
|
||||
select a,b from t1;
|
||||
select a,b from t1 order by a;
|
||||
|
||||
## update with subquery and several parameters
|
||||
set @arg00=23;
|
||||
@@ -123,17 +123,48 @@ set @arg04=2;
|
||||
--disable_warnings
|
||||
drop table if exists t2;
|
||||
--enable_warnings
|
||||
# t2 will be of table type 'MYISAM'
|
||||
create table t2 as select a,b from t1 ;
|
||||
prepare stmt1 from 'update t1 set a=? where b=?
|
||||
and a in (select ? from t2
|
||||
where b = ? or a = ?)';
|
||||
--enable_info
|
||||
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
|
||||
--disable_info
|
||||
select a,b from t1 where a = @arg00 ;
|
||||
prepare stmt1 from 'update t1 set a=? where b=?
|
||||
and a not in (select ? from t2
|
||||
where b = ? or a = ?)';
|
||||
--enable_info
|
||||
execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
|
||||
select a,b from t1 ;
|
||||
--disable_info
|
||||
select a,b from t1 order by a ;
|
||||
drop table t2 ;
|
||||
# t2 is now of table type '$type'
|
||||
# The test battery for table type 'MERGE' gets here only a 'MYISAM' table
|
||||
#
|
||||
# Test UPDATE with SUBQUERY in prepared mode
|
||||
#
|
||||
eval create table t2
|
||||
(
|
||||
a int, b varchar(30),
|
||||
primary key(a)
|
||||
) engine = $type ;
|
||||
insert into t2(a,b) select a, b from t1 ;
|
||||
prepare stmt1 from 'update t1 set a=? where b=?
|
||||
and a in (select ? from t2
|
||||
where b = ? or a = ?)';
|
||||
--enable_info
|
||||
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
|
||||
--disable_info
|
||||
select a,b from t1 where a = @arg00 ;
|
||||
prepare stmt1 from 'update t1 set a=? where b=?
|
||||
and a not in (select ? from t2
|
||||
where b = ? or a = ?)';
|
||||
--enable_info
|
||||
execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
|
||||
--disable_info
|
||||
select a,b from t1 order by a ;
|
||||
drop table t2 ;
|
||||
|
||||
## update with parameters in limit
|
||||
@@ -178,6 +209,46 @@ set @arg01='eight' ;
|
||||
prepare stmt1 from 'insert into t1 values(?, ? )';
|
||||
execute stmt1 using @arg00, @arg01 ;
|
||||
select a,b from t1 where b = @arg01;
|
||||
# cases derived from client_test.c: test_null()
|
||||
set @NULL= null ;
|
||||
set @arg00= 'abc' ;
|
||||
# execute must fail, because first column is primary key (-> not null)
|
||||
--error 1048
|
||||
execute stmt1 using @NULL, @NULL ;
|
||||
--error 1048
|
||||
execute stmt1 using @NULL, @NULL ;
|
||||
--error 1048
|
||||
execute stmt1 using @NULL, @arg00 ;
|
||||
--error 1048
|
||||
execute stmt1 using @NULL, @arg00 ;
|
||||
let $1 = 2;
|
||||
while ($1)
|
||||
{
|
||||
eval set @arg01= 10000 + $1 ;
|
||||
execute stmt1 using @arg01, @arg00 ;
|
||||
dec $1;
|
||||
}
|
||||
select * from t1 where a > 10000 order by a ;
|
||||
delete from t1 where a > 10000 ;
|
||||
let $1 = 2;
|
||||
while ($1)
|
||||
{
|
||||
eval set @arg01= 10000 + $1 ;
|
||||
execute stmt1 using @arg01, @NULL ;
|
||||
dec $1;
|
||||
}
|
||||
select * from t1 where a > 10000 order by a ;
|
||||
delete from t1 where a > 10000 ;
|
||||
let $1 = 10;
|
||||
while ($1)
|
||||
{
|
||||
eval set @arg01= 10000 + $1 ;
|
||||
execute stmt1 using @arg01, @arg01 ;
|
||||
dec $1;
|
||||
}
|
||||
select * from t1 where a > 10000 order by a ;
|
||||
delete from t1 where a > 10000 ;
|
||||
|
||||
|
||||
## insert with two rows in values part
|
||||
set @arg00=81 ;
|
||||
@@ -201,12 +272,28 @@ set @arg01=1 ;
|
||||
prepare stmt1 from 'insert into t1 set a=?, b=''sechs''
|
||||
on duplicate key update a=a + ?, b=concat(b,''modified'') ';
|
||||
execute stmt1 using @arg00, @arg01;
|
||||
select * from t1;
|
||||
select * from t1 order by a;
|
||||
set @arg00=81 ;
|
||||
set @arg01=1 ;
|
||||
--error 1062
|
||||
execute stmt1 using @arg00, @arg01;
|
||||
|
||||
## insert, autoincrement column and ' SELECT LAST_INSERT_ID() '
|
||||
# cases derived from client_test.c: test_bug3117()
|
||||
--disable_warnings
|
||||
drop table if exists t2 ;
|
||||
--enable_warnings
|
||||
# The test battery for table type 'MERGE' gets here only a 'MYISAM' table
|
||||
eval create table t2 (id int auto_increment primary key)
|
||||
ENGINE= $type ;
|
||||
prepare stmt1 from ' select last_insert_id() ' ;
|
||||
insert into t2 values (NULL) ;
|
||||
execute stmt1 ;
|
||||
insert into t2 values (NULL) ;
|
||||
# bug#3117
|
||||
execute stmt1 ;
|
||||
drop table t2 ;
|
||||
|
||||
## many parameters
|
||||
set @1000=1000 ;
|
||||
set @x1000_2="x1000_2" ;
|
||||
@@ -220,19 +307,50 @@ set @updated="updated" ;
|
||||
insert into t1 values(1000,'x1000_1') ;
|
||||
insert into t1 values(@1000,@x1000_2),(@1000,@x1000_3)
|
||||
on duplicate key update a = a + @100, b = concat(b,@updated) ;
|
||||
select a,b from t1 where a >= 1000 ;
|
||||
select a,b from t1 where a >= 1000 order by a ;
|
||||
delete from t1 where a >= 1000 ;
|
||||
insert into t1 values(1000,'x1000_1') ;
|
||||
prepare stmt1 from ' insert into t1 values(?,?),(?,?)
|
||||
on duplicate key update a = a + ?, b = concat(b,?) ';
|
||||
execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ;
|
||||
select a,b from t1 where a >= 1000 ;
|
||||
select a,b from t1 where a >= 1000 order by a ;
|
||||
delete from t1 where a >= 1000 ;
|
||||
insert into t1 values(1000,'x1000_1') ;
|
||||
execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ;
|
||||
select a,b from t1 where a >= 1000 ;
|
||||
select a,b from t1 where a >= 1000 order by a ;
|
||||
delete from t1 where a >= 1000 ;
|
||||
|
||||
## replace
|
||||
--error 1295
|
||||
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
|
||||
|
||||
|
||||
## multi table statements
|
||||
--disable_query_log
|
||||
select '------ multi table tests ------' as test_sequence ;
|
||||
--enable_query_log
|
||||
# cases derived from client_test.c: test_multi
|
||||
delete from t1 ;
|
||||
delete from t9 ;
|
||||
insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
|
||||
insert into t9 (c1,c21)
|
||||
values (1, 'one'), (2, 'two'), (3, 'three') ;
|
||||
prepare stmt_delete from " delete t1, t9
|
||||
from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
|
||||
prepare stmt_update from " update t1, t9
|
||||
set t1.b='updated', t9.c21='updated'
|
||||
where t1.a=t9.c1 and t1.a=? ";
|
||||
prepare stmt_select1 from " select a, b from t1 order by a" ;
|
||||
prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
|
||||
set @arg00= 1 ;
|
||||
let $1= 3 ;
|
||||
while ($1)
|
||||
{
|
||||
execute stmt_update using @arg00 ;
|
||||
execute stmt_delete ;
|
||||
execute stmt_select1 ;
|
||||
execute stmt_select2 ;
|
||||
set @arg00= @arg00 + 1 ;
|
||||
dec $1 ;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user