Debian Codegraph @

mysql-test/suite/ndbcluster/truncate.test

raw
1 --source include/have_ndb.inc
2
3 #
4 # Test TRUNCATE TABLE
5 # - the table should have no rows after the truncate
6 #
7 CREATE TABLE t1 (
8 a int PRIMARY KEY,
9 b varchar(255)
10 ) ENGINE = NDB;
11
12 INSERT INTO t1 (a, b) VALUES
13 (1, "Row 1"),
14 (11, "Row 2"),
15 (12, "The third row"),
16 (37, "And of course number 37");
17 SELECT COUNT(*) FROM t1;
18
19 TRUNCATE TABLE t1;
20
21 # Check that truncated table contains no rows
22 if (`SELECT count(*) from t1`)
23 {
24 die The truncated table contained rows;
25 }
26 SELECT COUNT(*) FROM t1;
27 DROP TABLE t1;
28
29 #
30 # NOTE! Don't add any more tests here, this is the basic test
31 #