~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/limit.test

  • Committer: Mats Kindahl
  • Date: 2008-08-26 07:32:59 UTC
  • mto: (489.1.2 codestyle)
  • mto: This revision was merged to the branch mainline in revision 491.
  • Revision ID: mats@mysql.com-20080826073259-9k4evtajgldgolli
Replaced use of thd_proc_info() macro with calls to
set_proc_info() and get_proc_info() internally.  Introduced
functions set_thd_proc_info() and get_thd_proc_info() for
external users, i.e., plug-ins.

The set_thd_proc_info() accepted callers info that can be used to
print debug output, but the information was not used. The return
value was changed to void and the old value is not fetched any
more. To be able to get the value of proc_info for external
users, the function get_thd_proc_info() was introduced.

The thd_proc_info() macro called set_thd_proc_info() but almost
never used the return value of set_thd_proc_info() so the macro
was replaced with a call of THD::set_proc_info().

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#
2
 
# Test of update and delete with limit
3
 
#
4
 
 
5
 
--disable_warnings
6
 
drop table if exists t1;
7
 
--enable_warnings
8
 
 
9
 
create table t1 (a int not null default 0 primary key, b int not null default 0);
10
 
insert into t1 () values ();            # Testing default values
11
 
insert into t1 values (1,1),(2,1),(3,1);
12
 
update t1 set a=4 where b=1 limit 1;
13
 
select * from t1;
14
 
update t1 set b=2 where b=1 limit 2;
15
 
--sorted_result
16
 
select * from t1;
17
 
update t1 set b=4 where b=1;
18
 
--sorted_result
19
 
select * from t1;
20
 
delete from t1 where b=2 limit 1;
21
 
--sorted_result
22
 
select * from t1;
23
 
delete from t1 limit 1;
24
 
--sorted_result
25
 
select * from t1;
26
 
drop table t1;
27
 
 
28
 
create table t1 (i int);
29
 
insert into t1 (i) values(1),(1),(1);
30
 
delete from t1 limit 1;
31
 
update t1 set i=2 limit 1;
32
 
delete from t1 limit 0;
33
 
update t1 set i=3 limit 0;
34
 
--sorted_result
35
 
select * from t1;
36
 
drop table t1;
37
 
 
38
 
# LIMIT 0
39
 
 
40
 
select 0 limit 0;
41
 
 
42
 
#
43
 
# Test with DELETE, ORDER BY and limit (bug #1024)
44
 
#
45
 
 
46
 
CREATE TABLE t1(id int auto_increment primary key, id2 int, index(id2)); 
47
 
INSERT INTO t1 (id2) values (0),(0),(0);
48
 
DELETE FROM t1 WHERE id=1;
49
 
INSERT INTO t1 SET id2=0;
50
 
SELECT * FROM t1; 
51
 
DELETE FROM t1 WHERE id2 = 0 ORDER BY id LIMIT 1; 
52
 
# should have deleted WHERE id=2 
53
 
SELECT * FROM t1; 
54
 
DELETE FROM t1 WHERE id2 = 0 ORDER BY id desc LIMIT 1; 
55
 
SELECT * FROM t1;
56
 
DROP TABLE t1;
57
 
 
58
 
#
59
 
# Bug #21787: COUNT(*) + ORDER BY + LIMIT returns wrong result
60
 
#
61
 
create table t1 (a int);
62
 
insert into t1 values (1),(2),(3),(4),(5),(6),(7);
63
 
explain select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
64
 
select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
65
 
explain select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
66
 
select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
67
 
drop table t1;
68
 
# End of 4.1 tests
69
 
 
70
 
--echo End of 5.0 tests