~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/truncate.test

  • Committer: Monty Taylor
  • Date: 2008-09-16 01:37:05 UTC
  • mto: This revision was merged to the branch mainline in revision 391.
  • Revision ID: monty@inaugust.com-20080916013705-772d1t7rh9ah9j1x
Moved more functions into drizzle.c as part of the split of code.
Added accessor function for drizzle_port.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#
2
 
# Test of truncate
3
 
#
4
 
--disable_warnings
5
 
drop table if exists t1;
6
 
--enable_warnings
7
 
 
8
 
create table t1 (a integer, b integer,c1 CHAR(10));
9
 
insert into t1 (a) values (1),(2);
10
 
truncate table t1;
11
 
select count(*) from t1;
12
 
insert into t1 values(1,2,"test");
13
 
select count(*) from t1;
14
 
delete from t1;
15
 
select * from t1;
16
 
drop table t1;
17
 
# The following should fail
18
 
--error 1146
19
 
select count(*) from t1;
20
 
create temporary table t1 (n int);
21
 
insert into t1 values (1),(2),(3);
22
 
truncate table t1;
23
 
select * from t1;
24
 
drop table t1;
25
 
--error 1146
26
 
truncate non_existing_table;
27
 
 
28
 
#
29
 
# test autoincrement with TRUNCATE; verifying difference with DELETE
30
 
#
31
 
 
32
 
create table t1 (a integer auto_increment primary key);
33
 
insert into t1 (a) values (NULL),(NULL);
34
 
truncate table t1;
35
 
insert into t1 (a) values (NULL),(NULL);
36
 
SELECT * from t1;
37
 
delete from t1;
38
 
insert into t1 (a) values (NULL),(NULL);
39
 
SELECT * from t1;
40
 
drop table t1;
41
 
 
42
 
# Verifying that temp tables are handled the same way
43
 
 
44
 
create temporary table t1 (a integer auto_increment primary key);
45
 
insert into t1 (a) values (NULL),(NULL);
46
 
truncate table t1;
47
 
insert into t1 (a) values (NULL),(NULL);
48
 
SELECT * from t1;
49
 
delete from t1;
50
 
insert into t1 (a) values (NULL),(NULL);
51
 
SELECT * from t1;
52
 
drop table t1;
53
 
 
54
 
# End of 4.1 tests