Test suite fixes for builds that define OMIT symbols. (CVS 2962)

FossilOrigin-Name: 3a54a33dcb7e765ee3773397407e8929a8cfe1a9
This commit is contained in:
danielk1977
2006-01-17 09:35:01 +00:00
parent ff890793fc
commit 3bdca9c9a5
40 changed files with 819 additions and 625 deletions
+15 -15
View File
@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script is testing the ALTER TABLE statement.
#
# $Id: alter.test,v 1.15 2006/01/15 14:11:49 danielk1977 Exp $
# $Id: alter.test,v 1.16 2006/01/17 09:35:02 danielk1977 Exp $
#
set testdir [file dirname $argv0]
@@ -567,9 +567,9 @@ do_test alter-6.2 {
CREATE TABLE ${tbl_name}(a, b, c);
"
set ::oid [execsql {SELECT max(oid) FROM sqlite_master}]
execsql {
execsql "
SELECT sql FROM sqlite_master WHERE oid = $::oid;
}
"
} "{CREATE TABLE ${::tbl_name}(a, b, c)}"
execsql "
SELECT * FROM ${::tbl_name}
@@ -579,26 +579,26 @@ do_test alter-6.3 {
execsql "
ALTER TABLE $::tbl_name RENAME TO $::tbl_name2
"
execsql {
SELECT sql FROM sqlite_master WHERE oid = $::oid;
}
execsql "
SELECT sql FROM sqlite_master WHERE oid = $::oid
"
} "{CREATE TABLE '${::tbl_name2}'(a, b, c)}"
do_test alter-6.4 {
execsql "
ALTER TABLE $::tbl_name2 RENAME TO $::tbl_name
"
execsql {
SELECT sql FROM sqlite_master WHERE oid = $::oid;
}
execsql "
SELECT sql FROM sqlite_master WHERE oid = $::oid
"
} "{CREATE TABLE '${::tbl_name}'(a, b, c)}"
set ::col_name ghi\1234\jkl
do_test alter-6.5 {
execsql "
ALTER TABLE $::tbl_name ADD COLUMN $::col_name VARCHAR
"
execsql {
SELECT sql FROM sqlite_master WHERE oid = $::oid;
}
execsql "
SELECT sql FROM sqlite_master WHERE oid = $::oid
"
} "{CREATE TABLE '${::tbl_name}'(a, b, c, $::col_name VARCHAR)}"
set ::col_name2 B\3421\A
do_test alter-6.6 {
@@ -607,9 +607,9 @@ do_test alter-6.6 {
execsql "
ALTER TABLE $::tbl_name ADD COLUMN $::col_name2
"
execsql {
SELECT sql FROM sqlite_master WHERE oid = $::oid;
}
execsql "
SELECT sql FROM sqlite_master WHERE oid = $::oid
"
} "{CREATE TABLE '${::tbl_name}'(a, b, c, $::col_name VARCHAR, $::col_name2)}"
do_test alter-6.7 {
execsql "
+39 -29
View File
@@ -13,7 +13,7 @@
# file format change that may be used in the future to implement
# "ALTER TABLE ... ADD COLUMN".
#
# $Id: alter3.test,v 1.8 2006/01/16 16:24:25 danielk1977 Exp $
# $Id: alter3.test,v 1.9 2006/01/17 09:35:02 danielk1977 Exp $
#
set testdir [file dirname $argv0]
@@ -143,14 +143,16 @@ do_test alter3-2.4 {
ALTER TABLE t1 ADD c NOT NULL DEFAULT 10;
}
} {0 {}}
do_test alter3-2.5 {
execsql {
CREATE VIEW v1 AS SELECT * FROM t1;
}
catchsql {
alter table v1 add column d;
}
} {1 {Cannot add a column to a view}}
ifcapable view {
do_test alter3-2.5 {
execsql {
CREATE VIEW v1 AS SELECT * FROM t1;
}
catchsql {
alter table v1 add column d;
}
} {1 {Cannot add a column to a view}}
}
do_test alter3-2.6 {
catchsql {
alter table t1 add column d DEFAULT CURRENT_TIME;
@@ -186,11 +188,13 @@ if {!$has_codec} {
get_file_format
} {3}
}
do_test alter3-3.4 {
execsql {
PRAGMA schema_version;
}
} {11}
ifcapable schema_version {
do_test alter3-3.4 {
execsql {
PRAGMA schema_version;
}
} {11}
}
do_test alter3-4.1 {
db close
@@ -219,11 +223,13 @@ if {!$has_codec} {
get_file_format
} {3}
}
do_test alter3-4.4 {
execsql {
PRAGMA schema_version;
}
} {21}
ifcapable schema_version {
do_test alter3-4.4 {
execsql {
PRAGMA schema_version;
}
} {21}
}
do_test alter3-4.99 {
execsql {
DROP TABLE t1;
@@ -254,11 +260,13 @@ do_test alter3-5.3 {
SELECT * FROM aux.t1;
}
} {1 one {} 2 two {}}
do_test alter3-5.4 {
execsql {
PRAGMA aux.schema_version;
}
} {31}
ifcapable schema_version {
do_test alter3-5.4 {
execsql {
PRAGMA aux.schema_version;
}
} {31}
}
if {!$has_codec} {
do_test alter3-5.5 {
list [get_file_format test2.db] [get_file_format]
@@ -275,11 +283,13 @@ do_test alter3-5.7 {
SELECT * FROM aux.t1;
}
} {1 one {} 1000 2 two {} 1000}
do_test alter3-5.8 {
execsql {
PRAGMA aux.schema_version;
}
} {32}
ifcapable schema_version {
do_test alter3-5.8 {
execsql {
PRAGMA aux.schema_version;
}
} {32}
}
do_test alter3-5.9 {
execsql {
SELECT * FROM t1;
+38 -28
View File
@@ -12,7 +12,7 @@
# focus of this script is testing the ATTACH and DETACH commands
# and related functionality.
#
# $Id: auth.test,v 1.32 2006/01/16 16:24:25 danielk1977 Exp $
# $Id: auth.test,v 1.33 2006/01/17 09:35:02 danielk1977 Exp $
#
set testdir [file dirname $argv0]
@@ -2092,32 +2092,32 @@ do_test auth-2.11.2 {
# Make sure the OLD and NEW pseudo-tables of a trigger get authorized.
#
ifcapable trigger {
do_test auth-3.1 {
proc auth {code arg1 arg2 arg3 arg4} {
return SQLITE_OK
}
execsql {
CREATE TABLE tx(a1,a2,b1,b2,c1,c2);
CREATE TRIGGER r1 AFTER UPDATE ON t2 FOR EACH ROW BEGIN
INSERT INTO tx VALUES(OLD.a,NEW.a,OLD.b,NEW.b,OLD.c,NEW.c);
END;
UPDATE t2 SET a=a+1;
SELECT * FROM tx;
}
} {11 12 2 2 33 33 7 8 8 8 9 9}
do_test auth-3.2 {
proc auth {code arg1 arg2 arg3 arg4} {
if {$code=="SQLITE_READ" && $arg1=="t2" && $arg2=="c"} {
return SQLITE_IGNORE
do_test auth-3.1 {
proc auth {code arg1 arg2 arg3 arg4} {
return SQLITE_OK
}
return SQLITE_OK
}
execsql {
DELETE FROM tx;
UPDATE t2 SET a=a+100;
SELECT * FROM tx;
}
} {12 112 2 2 {} {} 8 108 8 8 {} {}}
execsql {
CREATE TABLE tx(a1,a2,b1,b2,c1,c2);
CREATE TRIGGER r1 AFTER UPDATE ON t2 FOR EACH ROW BEGIN
INSERT INTO tx VALUES(OLD.a,NEW.a,OLD.b,NEW.b,OLD.c,NEW.c);
END;
UPDATE t2 SET a=a+1;
SELECT * FROM tx;
}
} {11 12 2 2 33 33 7 8 8 8 9 9}
do_test auth-3.2 {
proc auth {code arg1 arg2 arg3 arg4} {
if {$code=="SQLITE_READ" && $arg1=="t2" && $arg2=="c"} {
return SQLITE_IGNORE
}
return SQLITE_OK
}
execsql {
DELETE FROM tx;
UPDATE t2 SET a=a+100;
SELECT * FROM tx;
}
} {12 112 2 2 {} {} 8 108 8 8 {} {}}
} ;# ifcapable trigger
# Make sure the names of views and triggers are passed on on arg4.
@@ -2210,7 +2210,17 @@ do_test auth-5.1 {
# Ticket #1607
#
ifcapable compound {
ifcapable compound&&subquery {
ifcapable trigger {
execsql {
DROP TABLE tx;
}
ifcapable view {
execsql {
DROP TABLE v1chng;
}
}
}
do_test auth-5.2 {
execsql {
SELECT name FROM (
@@ -2218,7 +2228,7 @@ ifcapable compound {
WHERE type='table'
ORDER BY name
}
} {sqlite_stat1 t1 t2 t3 t4 tx v1chng}
} {sqlite_stat1 t1 t2 t3 t4}
}
+10 -4
View File
@@ -12,7 +12,7 @@
# file is a copy of "trans.test" modified to run under autovacuum mode.
# the point is to stress the autovacuum logic and try to get it to fail.
#
# $Id: avtrans.test,v 1.1 2005/12/09 02:35:54 drh Exp $
# $Id: avtrans.test,v 1.2 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
@@ -896,9 +896,15 @@ for {set i 2} {$i<=$limit} {incr i} {
do_test avtrans-9.$i.4-$cnt {
expr {$sqlite_sync_count>0}
} 1
do_test avtrans-9.$i.5-$cnt {
expr {$sqlite_fullsync_count>0}
} [expr {$i%2==0}]
ifcapable pager_pragmas {
do_test avtrans-9.$i.5-$cnt {
expr {$sqlite_fullsync_count>0}
} [expr {$i%2==0}]
} else {
do_test avtrans-9.$i.5-$cnt {
expr {$sqlite_fullsync_count>0}
} {1}
}
}
}
set ::pager_old_format 0
+9 -2
View File
@@ -12,7 +12,7 @@
# focus of this file is testing the use of indices in WHERE clauses
# when the WHERE clause contains the BETWEEN operator.
#
# $Id: between.test,v 1.1 2005/07/28 23:12:08 drh Exp $
# $Id: between.test,v 1.2 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -29,7 +29,14 @@ do_test between-1.0 {
set x [expr {int(log($i)/log(2))}]
set y [expr {$i*$i + 2*$i + 1}]
set z [expr {$x+$y}]
execsql {INSERT INTO t1 VALUES($::w,$::x,$::y,$::z)}
ifcapable tclvar {
# Random unplanned test of the $varname variable syntax.
execsql {INSERT INTO t1 VALUES($::w,$::x,$::y,$::z)}
} else {
# If the $varname syntax is not available, use the regular variable
# declaration syntax.
execsql {INSERT INTO t1 VALUES(:w,:x,:y,:z)}
}
}
execsql {
CREATE UNIQUE INDEX i1w ON t1(w);
+17 -13
View File
@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script testing the callback-free C/C++ API.
#
# $Id: capi3.test,v 1.38 2006/01/13 01:25:06 drh Exp $
# $Id: capi3.test,v 1.39 2006/01/17 09:35:02 danielk1977 Exp $
#
set testdir [file dirname $argv0]
@@ -111,18 +111,22 @@ ifcapable {utf16} {
do_test capi3-2.5 {
sqlite3_errmsg $DB
} {no such column: namex}
do_test capi3-2.6 {
execsql {CREATE TABLE tablename(x)}
set sql16 [utf16 {PRAGMA table_info("TableName")}]
set STMT [sqlite3_prepare16 $DB $sql16 -1 TAIL]
sqlite3_step $STMT
} SQLITE_ROW
do_test capi3-2.7 {
sqlite3_step $STMT
} SQLITE_DONE
do_test capi3-2.8 {
sqlite3_finalize $STMT
} SQLITE_OK
ifcapable schema_pragmas {
do_test capi3-2.6 {
execsql {CREATE TABLE tablename(x)}
set sql16 [utf16 {PRAGMA table_info("TableName")}]
set STMT [sqlite3_prepare16 $DB $sql16 -1 TAIL]
sqlite3_step $STMT
} SQLITE_ROW
do_test capi3-2.7 {
sqlite3_step $STMT
} SQLITE_DONE
do_test capi3-2.8 {
sqlite3_finalize $STMT
} SQLITE_OK
}
} ;# endif utf16
# rename sqlite3_open sqlite3_open_old
+8 -6
View File
@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing CHECK constraints
#
# $Id: check.test,v 1.7 2006/01/14 08:02:28 danielk1977 Exp $
# $Id: check.test,v 1.8 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -272,11 +272,13 @@ do_test check-4.8 {
UPDATE t4 SET x=0, y=2;
}
} {1 {constraint failed}}
do_test check_4.9 {
catchsql {
VACUUM
}
} {0 {}}
ifcapable vacuum {
do_test check_4.9 {
catchsql {
VACUUM
}
} {0 {}}
}
do_test check-5.1 {
catchsql {
+6 -1
View File
@@ -13,11 +13,16 @@
# This file implements tests for the conflict resolution extension
# to SQLite.
#
# $Id: conflict.test,v 1.26 2005/09/25 01:13:09 drh Exp $
# $Id: conflict.test,v 1.27 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
ifcapable !conflict {
finish_test
return
}
# Create tables for the first group of tests.
#
do_test conflict-1.0 {
+40 -28
View File
@@ -17,7 +17,7 @@
# sqlite_update_hook (tests hook-4-*)
# sqlite_rollback_hook (tests hook-5.*)
#
# $Id: hook.test,v 1.10 2006/01/16 16:24:25 danielk1977 Exp $
# $Id: hook.test,v 1.11 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -138,37 +138,44 @@ do_test hook-4.1.2 {
]
set ::update_hook {}
do_test hook-4.2.1 {
catchsql {
DROP TABLE t2;
}
execsql {
CREATE TABLE t2(c INTEGER PRIMARY KEY, d);
CREATE TRIGGER t1_trigger AFTER INSERT ON t1 BEGIN
INSERT INTO t2 VALUES(new.a, new.b);
UPDATE t2 SET d = d || ' via trigger' WHERE new.a = c;
DELETE FROM t2 WHERE new.a = c;
END;
}
} {}
do_test hook-4.2.2 {
ifcapable trigger {
do_test hook-4.2.1 {
catchsql {
DROP TABLE t2;
}
execsql {
CREATE TABLE t2(c INTEGER PRIMARY KEY, d);
CREATE TRIGGER t1_trigger AFTER INSERT ON t1 BEGIN
INSERT INTO t2 VALUES(new.a, new.b);
UPDATE t2 SET d = d || ' via trigger' WHERE new.a = c;
DELETE FROM t2 WHERE new.a = c;
END;
}
} {}
do_test hook-4.2.2 {
execsql {
INSERT INTO t1 VALUES(1, 'one');
INSERT INTO t1 VALUES(2, 'two');
}
set ::update_hook
} [list \
INSERT main t1 1 \
INSERT main t2 1 \
UPDATE main t2 1 \
DELETE main t2 1 \
INSERT main t1 2 \
INSERT main t2 2 \
UPDATE main t2 2 \
DELETE main t2 2 \
]
} else {
execsql {
INSERT INTO t1 VALUES(1, 'one');
INSERT INTO t1 VALUES(2, 'two');
}
set ::update_hook
} [list \
INSERT main t1 1 \
INSERT main t2 1 \
UPDATE main t2 1 \
DELETE main t2 1 \
INSERT main t1 2 \
INSERT main t2 2 \
UPDATE main t2 2 \
DELETE main t2 2 \
]
}
# Triggers + ATTACH
# Update-hook + ATTACH
set ::update_hook {}
do_test hook-4.2.3 {
file delete -force test2.db
@@ -188,12 +195,17 @@ do_test hook-4.2.3 {
DELETE aux t3 2 \
]
ifcapable trigger {
execsql {
DROP TRIGGER t1_trigger;
}
}
# Test that other vdbe operations involving btree structures do not
# incorrectly invoke the update-hook.
set ::update_hook {}
do_test hook-4.3.1 {
execsql {
DROP TRIGGER t1_trigger;
CREATE INDEX t1_i ON t1(b);
INSERT INTO t1 VALUES(3, 'three');
UPDATE t1 SET b = '';
+43 -41
View File
@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing the CREATE INDEX statement.
#
# $Id: index.test,v 1.40 2006/01/04 15:54:37 drh Exp $
# $Id: index.test,v 1.41 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -640,46 +640,48 @@ do_test index-18.5 {
# These tests ensure that if multiple table definition constraints are
# implemented by a single indice, the correct ON CONFLICT policy applies.
do_test index-19.1 {
execsql {
CREATE TABLE t7(a UNIQUE PRIMARY KEY);
CREATE TABLE t8(a UNIQUE PRIMARY KEY ON CONFLICT ROLLBACK);
INSERT INTO t7 VALUES(1);
INSERT INTO t8 VALUES(1);
}
} {}
do_test index-19.2 {
catchsql {
BEGIN;
INSERT INTO t7 VALUES(1);
}
} {1 {column a is not unique}}
do_test index-19.3 {
catchsql {
BEGIN;
}
} {1 {cannot start a transaction within a transaction}}
do_test index-19.4 {
catchsql {
INSERT INTO t8 VALUES(1);
}
} {1 {column a is not unique}}
do_test index-19.5 {
catchsql {
BEGIN;
COMMIT;
}
} {0 {}}
do_test index-19.6 {
catchsql {
DROP TABLE t7;
DROP TABLE t8;
CREATE TABLE t7(
a PRIMARY KEY ON CONFLICT FAIL,
UNIQUE(a) ON CONFLICT IGNORE
);
}
} {1 {conflicting ON CONFLICT clauses specified}}
ifcapable conflict {
do_test index-19.1 {
execsql {
CREATE TABLE t7(a UNIQUE PRIMARY KEY);
CREATE TABLE t8(a UNIQUE PRIMARY KEY ON CONFLICT ROLLBACK);
INSERT INTO t7 VALUES(1);
INSERT INTO t8 VALUES(1);
}
} {}
do_test index-19.2 {
catchsql {
BEGIN;
INSERT INTO t7 VALUES(1);
}
} {1 {column a is not unique}}
do_test index-19.3 {
catchsql {
BEGIN;
}
} {1 {cannot start a transaction within a transaction}}
do_test index-19.4 {
catchsql {
INSERT INTO t8 VALUES(1);
}
} {1 {column a is not unique}}
do_test index-19.5 {
catchsql {
BEGIN;
COMMIT;
}
} {0 {}}
do_test index-19.6 {
catchsql {
DROP TABLE t7;
DROP TABLE t8;
CREATE TABLE t7(
a PRIMARY KEY ON CONFLICT FAIL,
UNIQUE(a) ON CONFLICT IGNORE
);
}
} {1 {conflicting ON CONFLICT clauses specified}}
} ; # end of "ifcapable conflict" block
ifcapable {reindex} {
do_test index-19.7 {
+37 -29
View File
@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing the INSERT statement.
#
# $Id: insert.test,v 1.28 2006/01/16 16:24:25 danielk1977 Exp $
# $Id: insert.test,v 1.29 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -288,34 +288,43 @@ ifcapable tempdb {
# Ticket #334: REPLACE statement corrupting indices.
#
do_test insert-6.1 {
execsql {
CREATE TABLE t1(a INTEGER PRIMARY KEY, b UNIQUE);
INSERT INTO t1 VALUES(1,2);
INSERT INTO t1 VALUES(2,3);
SELECT b FROM t1 WHERE b=2;
ifcapable conflict {
# The REPLACE command is not available if SQLITE_OMIT_CONFLICT is
# defined at compilation time.
do_test insert-6.1 {
execsql {
CREATE TABLE t1(a INTEGER PRIMARY KEY, b UNIQUE);
INSERT INTO t1 VALUES(1,2);
INSERT INTO t1 VALUES(2,3);
SELECT b FROM t1 WHERE b=2;
}
} {2}
do_test insert-6.2 {
execsql {
REPLACE INTO t1 VALUES(1,4);
SELECT b FROM t1 WHERE b=2;
}
} {}
do_test insert-6.3 {
execsql {
UPDATE OR REPLACE t1 SET a=2 WHERE b=4;
SELECT * FROM t1 WHERE b=4;
}
} {2 4}
do_test insert-6.4 {
execsql {
SELECT * FROM t1 WHERE b=3;
}
} {}
ifcapable {reindex} {
do_test insert-6.5 {
execsql REINDEX
} {}
}
} {2}
do_test insert-6.2 {
execsql {
REPLACE INTO t1 VALUES(1,4);
SELECT b FROM t1 WHERE b=2;
}
} {}
do_test insert-6.3 {
execsql {
UPDATE OR REPLACE t1 SET a=2 WHERE b=4;
SELECT * FROM t1 WHERE b=4;
}
} {2 4}
do_test insert-6.4 {
execsql {
SELECT * FROM t1 WHERE b=3;
}
} {}
ifcapable {reindex} {
do_test insert-6.7 {
execsql REINDEX
do_test insert-6.6 {
execsql {
DROP TABLE t1;
}
} {}
}
@@ -324,7 +333,6 @@ ifcapable {reindex} {
# INSERT statments.
do_test insert-7.1 {
execsql {
DROP TABLE t1;
CREATE TABLE t1(a);
INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES(2);
+2 -2
View File
@@ -13,7 +13,7 @@
# in particular the optimizations that occur to help those operators
# run faster.
#
# $Id: like.test,v 1.3 2005/08/28 17:00:26 drh Exp $
# $Id: like.test,v 1.4 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -40,7 +40,7 @@ do_test like-1.0 {
CDE
{ABC abc xyz}
} {
db eval {INSERT INTO t1 VALUES($str)}
db eval {INSERT INTO t1 VALUES(:str)}
}
execsql {
SELECT count(*) FROM t1;
+6 -6
View File
@@ -12,7 +12,7 @@
# focus of this file is testing the LIMIT ... OFFSET ... clause
# of SELECT statements.
#
# $Id: limit.test,v 1.26 2006/01/08 18:10:18 drh Exp $
# $Id: limit.test,v 1.27 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -404,27 +404,27 @@ ifcapable compound {
do_test limit-10.1 {
set limit 10
db eval {
SELECT x FROM t1 LIMIT $limit;
SELECT x FROM t1 LIMIT :limit;
}
} {31 30 29 28 27 26 25 24 23 22}
do_test limit-10.2 {
set limit 5
set offset 5
db eval {
SELECT x FROM t1 LIMIT $limit OFFSET $offset;
SELECT x FROM t1 LIMIT :limit OFFSET :offset;
}
} {26 25 24 23 22}
do_test limit-10.3 {
set limit -1
db eval {
SELECT x FROM t1 WHERE x<10 LIMIT $limit;
SELECT x FROM t1 WHERE x<10 LIMIT :limit;
}
} {9 8 7 6 5 4 3 2 1 0}
do_test limit-10.4 {
set limit 1.5
set rc [catch {
db eval {
SELECT x FROM t1 WHERE x<10 LIMIT $limit;
SELECT x FROM t1 WHERE x<10 LIMIT :limit;
} } msg]
list $rc $msg
} {1 {datatype mismatch}}
@@ -432,7 +432,7 @@ do_test limit-10.5 {
set limit "hello world"
set rc [catch {
db eval {
SELECT x FROM t1 WHERE x<10 LIMIT $limit;
SELECT x FROM t1 WHERE x<10 LIMIT :limit;
} } msg]
list $rc $msg
} {1 {datatype mismatch}}
+36 -21
View File
@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script is in-memory database backend.
#
# $Id: memdb.test,v 1.13 2005/01/21 04:25:47 danielk1977 Exp $
# $Id: memdb.test,v 1.14 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
@@ -169,6 +169,11 @@ foreach {i conf cmd t0 t1 t2} {
6 {} {INSERT OR ABORT} 1 {} 1
7 {} {INSERT OR ROLLBACK} 1 {} {}
} {
# All tests after test 1 depend on conflict resolution. So end the
# loop if that is not available in this build.
ifcapable !conflict {if {$i>1} break}
do_test memdb-4.$i {
if {$conf!=""} {set conf "ON CONFLICT $conf"}
set r0 [catch {execsql [subst {
@@ -229,6 +234,12 @@ foreach {i conf1 conf2 cmd t0 t1 t2} {
15 {} {} {UPDATE OR ABORT} 1 {1 2 3 4} 1
16 {} {} {UPDATE OR ROLLBACK} 1 {1 2 3 4} 0
} {
# All tests after test 1 depend on conflict resolution. So end the
# loop if that is not available in this build.
ifcapable !conflict {
if {$i>1} break
}
if {$t0} {set t1 {column a is not unique}}
do_test memdb-5.$i {
if {$conf1!=""} {set conf1 "ON CONFLICT $conf1"}
@@ -321,26 +332,30 @@ do_test memdb-6.11 {
SELECT * FROM t5 ORDER BY y DESC;
}
} {}
do_test memdb-6.12 {
execsql {
INSERT INTO t5 VALUES(1,2);
INSERT INTO t5 VALUES(3,4);
REPLACE INTO t5 VALUES(1,4);
SELECT rowid,* FROM t5;
}
} {3 1 4}
do_test memdb-6.13 {
execsql {
DELETE FROM t5 WHERE x>5;
SELECT * FROM t5;
}
} {1 4}
do_test memdb-6.14 {
execsql {
DELETE FROM t5 WHERE y<3;
SELECT * FROM t5;
}
} {1 4}
ifcapable conflict {
do_test memdb-6.12 {
execsql {
INSERT INTO t5 VALUES(1,2);
INSERT INTO t5 VALUES(3,4);
REPLACE INTO t5 VALUES(1,4);
SELECT rowid,* FROM t5;
}
} {3 1 4}
do_test memdb-6.13 {
execsql {
DELETE FROM t5 WHERE x>5;
SELECT * FROM t5;
}
} {1 4}
do_test memdb-6.14 {
execsql {
DELETE FROM t5 WHERE y<3;
SELECT * FROM t5;
}
} {1 4}
}
do_test memdb-6.15 {
execsql {
DELETE FROM t5 WHERE x>0;
+15 -13
View File
@@ -13,7 +13,7 @@
# This file implements tests for miscellanous features that were
# left out of other test files.
#
# $Id: misc1.test,v 1.39 2005/11/01 15:48:25 drh Exp $
# $Id: misc1.test,v 1.40 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -364,18 +364,20 @@ do_test misc1-12.4 {
SELECT * FROM t6;
}
} {0 0.0}
do_test misc1-12.5 {
execsql {
INSERT OR IGNORE INTO t6 VALUES(0.0,'x');
SELECT * FROM t6;
}
} {0 0.0}
do_test misc1-12.6 {
execsql {
INSERT OR IGNORE INTO t6 VALUES('y',0);
SELECT * FROM t6;
}
} {0 0.0 y 0}
ifcapable conflict {
do_test misc1-12.5 {
execsql {
INSERT OR IGNORE INTO t6 VALUES(0.0,'x');
SELECT * FROM t6;
}
} {0 0.0}
do_test misc1-12.6 {
execsql {
INSERT OR IGNORE INTO t6 VALUES('y',0);
SELECT * FROM t6;
}
} {0 0.0 y 0}
}
do_test misc1-12.7 {
execsql {
CREATE TABLE t7(x INTEGER, y TEXT, z);
+2 -2
View File
@@ -13,7 +13,7 @@
# This file implements tests for miscellanous features that were
# left out of other test files.
#
# $Id: misc2.test,v 1.23 2006/01/14 08:02:28 danielk1977 Exp $
# $Id: misc2.test,v 1.24 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -257,7 +257,7 @@ ifcapable tempdb {
#
# The SQL code below was causing a segfault.
#
ifcapable subquery {
ifcapable subquery&&trigger {
do_test misc2-10.1 {
execsql {
CREATE TABLE t1229(x);
+41 -17
View File
@@ -13,7 +13,7 @@
# This file implements tests for miscellanous features that were
# left out of other test files.
#
# $Id: misc5.test,v 1.10 2006/01/16 16:24:25 danielk1977 Exp $
# $Id: misc5.test,v 1.11 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -43,22 +43,46 @@ for {set i 120} {$i<140} {incr i} {
# Make sure large integers are stored correctly.
#
do_test misc5-2.1 {
execsql {
create table t2(x unique);
insert into t2 values(1);
insert or ignore into t2 select x*2 from t2;
insert or ignore into t2 select x*4 from t2;
insert or ignore into t2 select x*16 from t2;
insert or ignore into t2 select x*256 from t2;
insert or ignore into t2 select x*65536 from t2;
insert or ignore into t2 select x*2147483648 from t2;
insert or ignore into t2 select x-1 from t2;
insert or ignore into t2 select x+1 from t2;
insert or ignore into t2 select -x from t2;
select count(*) from t2;
}
} 371
ifcapable conflict {
do_test misc5-2.1 {
execsql {
create table t2(x unique);
insert into t2 values(1);
insert or ignore into t2 select x*2 from t2;
insert or ignore into t2 select x*4 from t2;
insert or ignore into t2 select x*16 from t2;
insert or ignore into t2 select x*256 from t2;
insert or ignore into t2 select x*65536 from t2;
insert or ignore into t2 select x*2147483648 from t2;
insert or ignore into t2 select x-1 from t2;
insert or ignore into t2 select x+1 from t2;
insert or ignore into t2 select -x from t2;
select count(*) from t2;
}
} 371
} else {
do_test misc5-2.1 {
execsql {
BEGIN;
create table t2(x unique);
create table t2_temp(x);
insert into t2_temp values(1);
insert into t2_temp select x*2 from t2_temp;
insert into t2_temp select x*4 from t2_temp;
insert into t2_temp select x*16 from t2_temp;
insert into t2_temp select x*256 from t2_temp;
insert into t2_temp select x*65536 from t2_temp;
insert into t2_temp select x*2147483648 from t2_temp;
insert into t2_temp select x-1 from t2_temp;
insert into t2_temp select x+1 from t2_temp;
insert into t2_temp select -x from t2_temp;
INSERT INTO t2 SELECT DISTINCT(x) FROM t2_temp;
DROP TABLE t2_temp;
COMMIT;
select count(*) from t2;
}
} 371
}
do_test misc5-2.2 {
execsql {
select x from t2 order by x;
+6 -1
View File
@@ -12,11 +12,16 @@
#
# This file implements tests for the NOT NULL constraint.
#
# $Id: notnull.test,v 1.3 2003/01/29 18:46:54 drh Exp $
# $Id: notnull.test,v 1.4 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
ifcapable !conflict {
finish_test
return
}
do_test notnull-1.0 {
execsql {
CREATE TABLE t1 (
+21 -19
View File
@@ -162,26 +162,28 @@ do_test null-6.1 {
# The UNIQUE constraint only applies to non-null values
#
ifcapable conflict {
do_test null-7.1 {
execsql {
create table t2(a, b unique on conflict ignore);
insert into t2 values(1,1);
insert into t2 values(2,null);
insert into t2 values(3,null);
insert into t2 values(4,1);
select a from t2;
}
} {1 2 3}
do_test null-7.2 {
execsql {
create table t3(a, b, c, unique(b,c) on conflict ignore);
insert into t3 values(1,1,1);
insert into t3 values(2,null,1);
insert into t3 values(3,null,1);
insert into t3 values(4,1,1);
select a from t3;
}
} {1 2 3}
execsql {
create table t2(a, b unique on conflict ignore);
insert into t2 values(1,1);
insert into t2 values(2,null);
insert into t2 values(3,null);
insert into t2 values(4,1);
select a from t2;
}
} {1 2 3}
do_test null-7.2 {
execsql {
create table t3(a, b, c, unique(b,c) on conflict ignore);
insert into t3 values(1,1,1);
insert into t3 values(2,null,1);
insert into t3 values(3,null,1);
insert into t3 values(4,1,1);
select a from t3;
}
} {1 2 3}
}
# Ticket #461 - Make sure nulls are handled correctly when doing a
# lookup using an index.
+9 -7
View File
@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library.
# This file implements tests for the page_size PRAGMA.
#
# $Id: pagesize.test,v 1.10 2005/05/20 20:01:56 drh Exp $
# $Id: pagesize.test,v 1.11 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
@@ -75,12 +75,14 @@ do_test pagesize-1.8 {
} 8192
foreach PGSZ {512 2048 4096 8192} {
do_test pagesize-2.$PGSZ.0 {
db close
sqlite3 db :memory:
execsql "PRAGMA page_size=$PGSZ;"
execsql {PRAGMA page_size}
} 1024
ifcapable memorydb {
do_test pagesize-2.$PGSZ.0 {
db close
sqlite3 db :memory:
execsql "PRAGMA page_size=$PGSZ;"
execsql {PRAGMA page_size}
} 1024
}
do_test pagesize-2.$PGSZ.1 {
db close
file delete -force test.db
+27 -23
View File
@@ -13,7 +13,7 @@
# caused by an ON CONFLICT ROLLBACK clause aborts any other pending
# statements.
#
# $Id: rollback.test,v 1.3 2006/01/03 00:33:50 drh Exp $
# $Id: rollback.test,v 1.4 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -31,33 +31,37 @@ do_test rollback-1.1 {
}
} {1 2 3 4}
do_test rollback-1.2 {
execsql {
CREATE TABLE t3(a unique on conflict rollback);
INSERT INTO t3 SELECT a FROM t1;
BEGIN;
INSERT INTO t1 SELECT * FROM t1;
}
} {}
ifcapable conflict {
do_test rollback-1.2 {
execsql {
CREATE TABLE t3(a unique on conflict rollback);
INSERT INTO t3 SELECT a FROM t1;
BEGIN;
INSERT INTO t1 SELECT * FROM t1;
}
} {}
}
do_test rollback-1.3 {
set STMT [sqlite3_prepare $DB "SELECT a FROM t1" -1 TAIL]
sqlite3_step $STMT
} {SQLITE_ROW}
# This causes a ROLLBACK, which deletes the table out from underneath the
# SELECT statement.
#
do_test rollback-1.4 {
catchsql {
INSERT INTO t3 SELECT a FROM t1;
}
} {1 {column a is not unique}}
# Try to continue with the SELECT statement
#
do_test rollback-1.5 {
sqlite3_step $STMT
} {SQLITE_ABORT}
ifcapable conflict {
# This causes a ROLLBACK, which deletes the table out from underneath the
# SELECT statement.
#
do_test rollback-1.4 {
catchsql {
INSERT INTO t3 SELECT a FROM t1;
}
} {1 {column a is not unique}}
# Try to continue with the SELECT statement
#
do_test rollback-1.5 {
sqlite3_step $STMT
} {SQLITE_ABORT}
}
# Restart the SELECT statement
#
+91 -59
View File
@@ -9,7 +9,7 @@
#
#***********************************************************************
#
# $Id: shared.test,v 1.16 2006/01/16 16:24:25 danielk1977 Exp $
# $Id: shared.test,v 1.17 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -213,7 +213,7 @@ do_test shared-$av.3.1.1 {
if {$i < 4} {
set max [execsql {SELECT max(i) FROM seq}]
db eval {
INSERT INTO seq SELECT i + $max, x FROM seq;
INSERT INTO seq SELECT i + :max, x FROM seq;
}
}
lappend ret $i
@@ -227,7 +227,7 @@ do_test shared-$av.3.1.2 {
# (test 3.1.3 verifies this).
set ret [list]
db2 eval {SELECT i FROM seq} {
db eval {DELETE FROM seq WHERE i = $i}
db eval {DELETE FROM seq WHERE i = :i}
lappend ret $i
}
set ret
@@ -412,20 +412,50 @@ do_test shared-$av.5.1.2 {
execsql {
CREATE TABLE test1.t1(a, b);
CREATE INDEX test1.i1 ON t1(a, b);
CREATE VIEW test1.v1 AS SELECT * FROM t1;
CREATE TRIGGER test1.trig1 AFTER INSERT ON t1 BEGIN
INSERT INTO t1 VALUES(new.a, new.b);
END;
} db1
} {}
ifcapable view {
do_test shared-$av.5.1.3 {
execsql {
CREATE VIEW test1.v1 AS SELECT * FROM t1;
} db1
} {}
}
ifcapable trigger {
do_test shared-$av.5.1.4 {
execsql {
CREATE TRIGGER test1.trig1 AFTER INSERT ON t1 BEGIN
INSERT INTO t1 VALUES(new.a, new.b);
END;
} db1
} {}
}
do_test shared-$av.5.1.5 {
execsql {
DROP INDEX i1;
DROP VIEW v1;
DROP TRIGGER trig1;
} db2
} {}
ifcapable view {
do_test shared-$av.5.1.6 {
execsql {
DROP VIEW v1;
} db2
} {}
}
ifcapable trigger {
do_test shared-$av.5.1.7 {
execsql {
DROP TRIGGER trig1;
} db2
} {}
}
do_test shared-$av.5.1.8 {
execsql {
DROP TABLE t1;
} db2
} {}
ifcapable compound {
do_test shared-$av.5.1.2 {
do_test shared-$av.5.1.9 {
execsql {
SELECT * FROM sqlite_master UNION ALL SELECT * FROM test1.sqlite_master
} db1
@@ -518,7 +548,7 @@ do_test shared-$av.7.1 {
set a [string repeat "$i " 20]
set b [string repeat "$i " 20]
db eval {
INSERT INTO t1 VALUES($a, $b);
INSERT INTO t1 VALUES(:a, :b);
}
lappend ::contents [list [expr $i+1] $a $b]
}
@@ -580,54 +610,56 @@ unset -nocomplain contents
# the wrong encoding for a database.
#
file delete -force test.db test.db-journal
do_test shared-$av.8.1.1 {
sqlite3 db test.db
execsql {
PRAGMA encoding = 'UTF-16';
SELECT * FROM sqlite_master;
}
} {}
do_test shared-$av.8.1.2 {
string range [execsql {PRAGMA encoding;}] 0 end-2
} {UTF-16}
do_test shared-$av.8.1.3 {
sqlite3 db2 test.db
execsql {
PRAGMA encoding = 'UTF-8';
CREATE TABLE abc(a, b, c);
} db2
} {}
do_test shared-$av.8.1.4 {
execsql {
SELECT * FROM sqlite_master;
}
} "table abc abc [expr $AUTOVACUUM?3:2] {CREATE TABLE abc(a, b, c)}"
do_test shared-$av.8.1.5 {
db2 close
execsql {
PRAGMA encoding;
}
} {UTF-8}
file delete -force test2.db test2.db-journal
do_test shared-$av.8.2.1 {
execsql {
ATTACH 'test2.db' AS aux;
SELECT * FROM aux.sqlite_master;
}
} {}
do_test shared-$av.8.2.2 {
sqlite3 db2 test2.db
execsql {
PRAGMA encoding = 'UTF-16';
CREATE TABLE def(d, e, f);
} db2
string range [execsql {PRAGMA encoding;} db2] 0 end-2
} {UTF-16}
do_test shared-$av.8.2.3 {
catchsql {
SELECT * FROM aux.sqlite_master;
}
} {1 {attached databases must use the same text encoding as main database}}
ifcapable utf16 {
do_test shared-$av.8.1.1 {
sqlite3 db test.db
execsql {
PRAGMA encoding = 'UTF-16';
SELECT * FROM sqlite_master;
}
} {}
do_test shared-$av.8.1.2 {
string range [execsql {PRAGMA encoding;}] 0 end-2
} {UTF-16}
do_test shared-$av.8.1.3 {
sqlite3 db2 test.db
execsql {
PRAGMA encoding = 'UTF-8';
CREATE TABLE abc(a, b, c);
} db2
} {}
do_test shared-$av.8.1.4 {
execsql {
SELECT * FROM sqlite_master;
}
} "table abc abc [expr $AUTOVACUUM?3:2] {CREATE TABLE abc(a, b, c)}"
do_test shared-$av.8.1.5 {
db2 close
execsql {
PRAGMA encoding;
}
} {UTF-8}
file delete -force test2.db test2.db-journal
do_test shared-$av.8.2.1 {
execsql {
ATTACH 'test2.db' AS aux;
SELECT * FROM aux.sqlite_master;
}
} {}
do_test shared-$av.8.2.2 {
sqlite3 db2 test2.db
execsql {
PRAGMA encoding = 'UTF-16';
CREATE TABLE def(d, e, f);
} db2
string range [execsql {PRAGMA encoding;} db2] 0 end-2
} {UTF-16}
do_test shared-$av.8.2.3 {
catchsql {
SELECT * FROM aux.sqlite_master;
}
} {1 {attached databases must use the same text encoding as main database}}
}
catch {db close}
catch {db2 close}
+10 -1
View File
@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script is testing correlated subqueries
#
# $Id: subquery.test,v 1.13 2005/09/08 10:37:01 drh Exp $
# $Id: subquery.test,v 1.14 2006/01/17 09:35:02 danielk1977 Exp $
#
set testdir [file dirname $argv0]
@@ -269,6 +269,15 @@ ifcapable view {
SELECT * FROM v1 WHERE EXISTS(SELECT * FROM t2 WHERE p=v1.b);
}
} {2}
} else {
catchsql { DROP TABLE t1; }
catchsql { DROP TABLE t2; }
execsql {
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES(1,2);
CREATE TABLE t2(p,q);
INSERT INTO t2 VALUES(2,9);
}
}
# Ticket 1084
+32 -28
View File
@@ -13,7 +13,7 @@
# This file implements tests to verify that fsync is disabled when
# pragma synchronous=off even for multi-database commits.
#
# $Id: sync.test,v 1.2 2005/11/25 10:38:22 danielk1977 Exp $
# $Id: sync.test,v 1.3 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -43,21 +43,23 @@ do_test sync-1.1 {
}
set sqlite_sync_count
} 8
do_test sync-1.2 {
set sqlite_sync_count 0
execsql {
PRAGMA main.synchronous=on;
PRAGMA db2.synchronous=on;
BEGIN;
INSERT INTO t1 VALUES(1,2);
INSERT INTO t2 VALUES(3,4);
COMMIT;
}
ifcapable !dirsync {
incr sqlite_sync_count 3
}
set sqlite_sync_count
} 8
ifcapable pager_pragmas {
do_test sync-1.2 {
set sqlite_sync_count 0
execsql {
PRAGMA main.synchronous=on;
PRAGMA db2.synchronous=on;
BEGIN;
INSERT INTO t1 VALUES(1,2);
INSERT INTO t2 VALUES(3,4);
COMMIT;
}
ifcapable !dirsync {
incr sqlite_sync_count 3
}
set sqlite_sync_count
} 8
}
do_test sync-1.3 {
set sqlite_sync_count 0
execsql {
@@ -73,18 +75,20 @@ do_test sync-1.3 {
}
set sqlite_sync_count
} 10
do_test sync-1.4 {
set sqlite_sync_count 0
execsql {
PRAGMA main.synchronous=off;
PRAGMA db2.synchronous=off;
BEGIN;
INSERT INTO t1 VALUES(5,6);
INSERT INTO t2 VALUES(7,8);
COMMIT;
}
set sqlite_sync_count
} 0
ifcapable pager_pragmas {
do_test sync-1.4 {
set sqlite_sync_count 0
execsql {
PRAGMA main.synchronous=off;
PRAGMA db2.synchronous=off;
BEGIN;
INSERT INTO t1 VALUES(5,6);
INSERT INTO t2 VALUES(7,8);
COMMIT;
}
set sqlite_sync_count
} 0
}
finish_test
+15 -13
View File
@@ -15,7 +15,7 @@
# interface is pretty well tested. This file contains some addition
# tests for fringe issues that the main test suite does not cover.
#
# $Id: tclsqlite.test,v 1.49 2006/01/05 15:50:07 drh Exp $
# $Id: tclsqlite.test,v 1.50 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -335,18 +335,20 @@ do_test tcl-9.3 {
# Recursive calls to the same user-defined function
#
do_test tcl-9.10 {
proc userfunc_r1 {n} {
if {$n<=0} {return 0}
set nm1 [expr {$n-1}]
return [expr {[db eval {SELECT r1($nm1)}]+$n}]
}
db function r1 userfunc_r1
execsql {SELECT r1(10)}
} {55}
do_test tcl-9.11 {
execsql {SELECT r1(100)}
} {5050}
ifcapable tclvar {
do_test tcl-9.10 {
proc userfunc_r1 {n} {
if {$n<=0} {return 0}
set nm1 [expr {$n-1}]
return [expr {[db eval {SELECT r1($nm1)}]+$n}]
}
db function r1 userfunc_r1
execsql {SELECT r1(10)}
} {55}
do_test tcl-9.11 {
execsql {SELECT r1(100)}
} {5050}
}
# Tests for the new transaction method
#
+2 -2
View File
@@ -11,7 +11,7 @@
# This file implements some common TCL routines used for regression
# testing the SQLite library
#
# $Id: tester.tcl,v 1.60 2006/01/16 12:46:41 danielk1977 Exp $
# $Id: tester.tcl,v 1.61 2006/01/17 09:35:02 danielk1977 Exp $
# Make sure tclsqlite3 was compiled correctly. Abort now with an
# error message if not.
@@ -178,7 +178,7 @@ proc finalize_testing {} {
#
proc execsql {sql {db db}} {
# puts "SQL = $sql"
return [$db eval $sql]
uplevel [list $db eval $sql]
}
# Execute SQL and catch exceptions.
+5 -1
View File
@@ -14,11 +14,15 @@
# fixed.
#
#
# $Id: tkt1435.test,v 1.1 2005/09/17 13:29:24 drh Exp $
# $Id: tkt1435.test,v 1.2 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
ifcapable !memorydb {
finish_test
return
}
# Construct the sample database.
#
+2 -2
View File
@@ -34,12 +34,12 @@
# name be the time I noticed the error. With CVS it is a really hassle
# to change filenames, so I'll just leave it as is. No harm done.
#
# $Id: tkt1443.test,v 1.3 2006/01/14 08:02:29 danielk1977 Exp $
# $Id: tkt1443.test,v 1.4 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
ifcapable !subquery {
ifcapable !subquery||!memorydb {
finish_test
return
}
+1 -1
View File
@@ -17,7 +17,7 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
ifcapable compound {
ifcapable !compound||!view {
finish_test
return
}
+4 -3
View File
@@ -17,9 +17,10 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# Somewhere in tkt1449-1.1 is a VIEW definition that uses a subquery.
# So we cannot run this file if subqueries are not available.
ifcapable !subquery {
# Somewhere in tkt1449-1.1 is a VIEW definition that uses a subquery and
# a compound SELECT. So we cannot run this file if any of these features
# are not available.
ifcapable !subquery||!compound||!view {
finish_test
return
}
+1 -1
View File
@@ -17,7 +17,7 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
ifcapable compound {
ifcapable !compound {
finish_test
return
}
+5
View File
@@ -17,6 +17,11 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
ifcapable !compound {
finish_test
return
}
do_test tkt1501-1.1 {
execsql {
CREATE TABLE t1(a,b);
+5
View File
@@ -17,6 +17,11 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
ifcapable !vacuum {
finish_test
return
}
do_test tkt1512-1.1 {
execsql {
CREATE TABLE t1(a,b);
+10 -4
View File
@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script is database locks.
#
# $Id: trans.test,v 1.27 2005/12/30 16:28:02 danielk1977 Exp $
# $Id: trans.test,v 1.28 2006/01/17 09:35:03 danielk1977 Exp $
set testdir [file dirname $argv0]
@@ -896,9 +896,15 @@ for {set i 2} {$i<=$limit} {incr i} {
do_test trans-9.$i.4-$cnt {
expr {$sqlite_sync_count>0}
} 1
do_test trans-9.$i.5-$cnt {
expr {$sqlite_fullsync_count>0}
} [expr {$i%2==0}]
ifcapable pager_pragmas {
do_test trans-9.$i.5-$cnt {
expr {$sqlite_fullsync_count>0}
} [expr {$i%2==0}]
} else {
do_test trans-9.$i.5-$cnt {
expr {$sqlite_fullsync_count>0}
} {1}
}
}
}
set ::pager_old_format 0
+43 -43
View File
@@ -442,54 +442,54 @@ do_test trigger1-8.6 {
}
} {}
# Make sure REPLACE works inside of triggers.
#
# There are two versions of trigger-9.1 and trigger-9.2. One that uses
# compound SELECT statements, and another that does not.
ifcapable compound {
do_test trigger1-9.1 {
execsql {
CREATE TABLE t3(a,b);
CREATE TABLE t4(x UNIQUE, b);
CREATE TRIGGER r34 AFTER INSERT ON t3 BEGIN
REPLACE INTO t4 VALUES(new.a,new.b);
END;
INSERT INTO t3 VALUES(1,2);
SELECT * FROM t3 UNION ALL SELECT 99, 99 UNION ALL SELECT * FROM t4;
ifcapable conflict {
# Make sure REPLACE works inside of triggers.
#
# There are two versions of trigger-9.1 and trigger-9.2. One that uses
# compound SELECT statements, and another that does not.
ifcapable compound {
do_test trigger1-9.1 {
execsql {
CREATE TABLE t3(a,b);
CREATE TABLE t4(x UNIQUE, b);
CREATE TRIGGER r34 AFTER INSERT ON t3 BEGIN
REPLACE INTO t4 VALUES(new.a,new.b);
END;
INSERT INTO t3 VALUES(1,2);
SELECT * FROM t3 UNION ALL SELECT 99, 99 UNION ALL SELECT * FROM t4;
}
} {1 2 99 99 1 2}
do_test trigger1-9.2 {
execsql {
INSERT INTO t3 VALUES(1,3);
SELECT * FROM t3 UNION ALL SELECT 99, 99 UNION ALL SELECT * FROM t4;
}
} {1 2 1 3 99 99 1 3}
} else {
do_test trigger1-9.1 {
execsql {
CREATE TABLE t3(a,b);
CREATE TABLE t4(x UNIQUE, b);
CREATE TRIGGER r34 AFTER INSERT ON t3 BEGIN
REPLACE INTO t4 VALUES(new.a,new.b);
END;
INSERT INTO t3 VALUES(1,2);
SELECT * FROM t3; SELECT 99, 99; SELECT * FROM t4;
}
} {1 2 99 99 1 2}
do_test trigger1-9.2 {
execsql {
INSERT INTO t3 VALUES(1,3);
SELECT * FROM t3; SELECT 99, 99; SELECT * FROM t4;
}
} {1 2 1 3 99 99 1 3}
}
} {1 2 99 99 1 2}
do_test trigger1-9.2 {
execsql {
INSERT INTO t3 VALUES(1,3);
SELECT * FROM t3 UNION ALL SELECT 99, 99 UNION ALL SELECT * FROM t4;
DROP TABLE t3;
DROP TABLE t4;
}
} {1 2 1 3 99 99 1 3}
}
ifcapable !compound {
do_test trigger1-9.1 {
execsql {
CREATE TABLE t3(a,b);
CREATE TABLE t4(x UNIQUE, b);
CREATE TRIGGER r34 AFTER INSERT ON t3 BEGIN
REPLACE INTO t4 VALUES(new.a,new.b);
END;
INSERT INTO t3 VALUES(1,2);
SELECT * FROM t3; SELECT 99, 99; SELECT * FROM t4;
}
} {1 2 99 99 1 2}
do_test trigger1-9.2 {
execsql {
INSERT INTO t3 VALUES(1,3);
SELECT * FROM t3; SELECT 99, 99; SELECT * FROM t4;
}
} {1 2 1 3 99 99 1 3}
}
execsql {
DROP TABLE t2;
DROP TABLE t3;
DROP TABLE t4;
}
# Ticket #764. At one stage TEMP triggers would fail to re-install when the
# schema was reloaded. The following tests ensure that TEMP triggers are
+109 -107
View File
@@ -473,119 +473,121 @@ execsql {
DROP TABLE tbl;
}
# Handling of ON CONFLICT by INSERT statements inside triggers
execsql {
CREATE TABLE tbl (a primary key, b, c);
CREATE TRIGGER ai_tbl AFTER INSERT ON tbl BEGIN
INSERT OR IGNORE INTO tbl values (new.a, 0, 0);
END;
}
do_test trigger2-6.1a {
ifcapable conflict {
# Handling of ON CONFLICT by INSERT statements inside triggers
execsql {
BEGIN;
INSERT INTO tbl values (1, 2, 3);
SELECT * from tbl;
CREATE TABLE tbl (a primary key, b, c);
CREATE TRIGGER ai_tbl AFTER INSERT ON tbl BEGIN
INSERT OR IGNORE INTO tbl values (new.a, 0, 0);
END;
}
} {1 2 3}
do_test trigger2-6.1b {
catchsql {
INSERT OR ABORT INTO tbl values (2, 2, 3);
}
} {1 {column a is not unique}}
do_test trigger2-6.1c {
do_test trigger2-6.1a {
execsql {
BEGIN;
INSERT INTO tbl values (1, 2, 3);
SELECT * from tbl;
}
} {1 2 3}
do_test trigger2-6.1b {
catchsql {
INSERT OR ABORT INTO tbl values (2, 2, 3);
}
} {1 {column a is not unique}}
do_test trigger2-6.1c {
execsql {
SELECT * from tbl;
}
} {1 2 3}
do_test trigger2-6.1d {
catchsql {
INSERT OR FAIL INTO tbl values (2, 2, 3);
}
} {1 {column a is not unique}}
do_test trigger2-6.1e {
execsql {
SELECT * from tbl;
}
} {1 2 3 2 2 3}
do_test trigger2-6.1f {
execsql {
INSERT OR REPLACE INTO tbl values (2, 2, 3);
SELECT * from tbl;
}
} {1 2 3 2 0 0}
do_test trigger2-6.1g {
catchsql {
INSERT OR ROLLBACK INTO tbl values (3, 2, 3);
}
} {1 {column a is not unique}}
do_test trigger2-6.1h {
execsql {
SELECT * from tbl;
}
} {}
execsql {DELETE FROM tbl}
# Handling of ON CONFLICT by UPDATE statements inside triggers
execsql {
SELECT * from tbl;
INSERT INTO tbl values (4, 2, 3);
INSERT INTO tbl values (6, 3, 4);
CREATE TRIGGER au_tbl AFTER UPDATE ON tbl BEGIN
UPDATE OR IGNORE tbl SET a = new.a, c = 10;
END;
}
} {1 2 3}
do_test trigger2-6.1d {
catchsql {
INSERT OR FAIL INTO tbl values (2, 2, 3);
}
} {1 {column a is not unique}}
do_test trigger2-6.1e {
do_test trigger2-6.2a {
execsql {
BEGIN;
UPDATE tbl SET a = 1 WHERE a = 4;
SELECT * from tbl;
}
} {1 2 10 6 3 4}
do_test trigger2-6.2b {
catchsql {
UPDATE OR ABORT tbl SET a = 4 WHERE a = 1;
}
} {1 {column a is not unique}}
do_test trigger2-6.2c {
execsql {
SELECT * from tbl;
}
} {1 2 10 6 3 4}
do_test trigger2-6.2d {
catchsql {
UPDATE OR FAIL tbl SET a = 4 WHERE a = 1;
}
} {1 {column a is not unique}}
do_test trigger2-6.2e {
execsql {
SELECT * from tbl;
}
} {4 2 10 6 3 4}
do_test trigger2-6.2f.1 {
execsql {
UPDATE OR REPLACE tbl SET a = 1 WHERE a = 4;
SELECT * from tbl;
}
} {1 3 10}
do_test trigger2-6.2f.2 {
execsql {
INSERT INTO tbl VALUES (2, 3, 4);
SELECT * FROM tbl;
}
} {1 3 10 2 3 4}
do_test trigger2-6.2g {
catchsql {
UPDATE OR ROLLBACK tbl SET a = 4 WHERE a = 1;
}
} {1 {column a is not unique}}
do_test trigger2-6.2h {
execsql {
SELECT * from tbl;
}
} {4 2 3 6 3 4}
execsql {
SELECT * from tbl;
DROP TABLE tbl;
}
} {1 2 3 2 2 3}
do_test trigger2-6.1f {
execsql {
INSERT OR REPLACE INTO tbl values (2, 2, 3);
SELECT * from tbl;
}
} {1 2 3 2 0 0}
do_test trigger2-6.1g {
catchsql {
INSERT OR ROLLBACK INTO tbl values (3, 2, 3);
}
} {1 {column a is not unique}}
do_test trigger2-6.1h {
execsql {
SELECT * from tbl;
}
} {}
execsql {DELETE FROM tbl}
# Handling of ON CONFLICT by UPDATE statements inside triggers
execsql {
INSERT INTO tbl values (4, 2, 3);
INSERT INTO tbl values (6, 3, 4);
CREATE TRIGGER au_tbl AFTER UPDATE ON tbl BEGIN
UPDATE OR IGNORE tbl SET a = new.a, c = 10;
END;
}
do_test trigger2-6.2a {
execsql {
BEGIN;
UPDATE tbl SET a = 1 WHERE a = 4;
SELECT * from tbl;
}
} {1 2 10 6 3 4}
do_test trigger2-6.2b {
catchsql {
UPDATE OR ABORT tbl SET a = 4 WHERE a = 1;
}
} {1 {column a is not unique}}
do_test trigger2-6.2c {
execsql {
SELECT * from tbl;
}
} {1 2 10 6 3 4}
do_test trigger2-6.2d {
catchsql {
UPDATE OR FAIL tbl SET a = 4 WHERE a = 1;
}
} {1 {column a is not unique}}
do_test trigger2-6.2e {
execsql {
SELECT * from tbl;
}
} {4 2 10 6 3 4}
do_test trigger2-6.2f.1 {
execsql {
UPDATE OR REPLACE tbl SET a = 1 WHERE a = 4;
SELECT * from tbl;
}
} {1 3 10}
do_test trigger2-6.2f.2 {
execsql {
INSERT INTO tbl VALUES (2, 3, 4);
SELECT * FROM tbl;
}
} {1 3 10 2 3 4}
do_test trigger2-6.2g {
catchsql {
UPDATE OR ROLLBACK tbl SET a = 4 WHERE a = 1;
}
} {1 {column a is not unique}}
do_test trigger2-6.2h {
execsql {
SELECT * from tbl;
}
} {4 2 3 6 3 4}
execsql {
DROP TABLE tbl;
}
} ; # ifcapable conflict
# 7. Triggers on views
ifcapable view {
+7 -7
View File
@@ -12,7 +12,7 @@
# of this file is testing the interaction of SQLite manifest types
# with Tcl dual-representations.
#
# $Id: types3.test,v 1.4 2006/01/16 16:24:25 danielk1977 Exp $
# $Id: types3.test,v 1.5 2006/01/17 09:35:03 danielk1977 Exp $
#
set testdir [file dirname $argv0]
@@ -22,23 +22,23 @@ source $testdir/tester.tcl
do_test types3-1.1 {
set V {}
append V {}
concat [tcl_variable_type V] [execsql {SELECT typeof($::V)}]
concat [tcl_variable_type V] [execsql {SELECT typeof(:V)}]
} {string text}
# A variable with an integer representation comes in as INTEGER
do_test types3-1.2 {
set V [expr {1+2}]
concat [tcl_variable_type V] [execsql {SELECT typeof($::V)}]
concat [tcl_variable_type V] [execsql {SELECT typeof(:V)}]
} {int integer}
do_test types3-1.3 {
set V [expr {1+123456789012345}]
concat [tcl_variable_type V] [execsql {SELECT typeof($::V)}]
concat [tcl_variable_type V] [execsql {SELECT typeof(:V)}]
} {wideInt integer}
# A double variable comes in as REAL
do_test types3-1.4 {
set V [expr {1.0+1}]
concat [tcl_variable_type V] [execsql {SELECT typeof($::V)}]
concat [tcl_variable_type V] [execsql {SELECT typeof(:V)}]
} {double real}
# A byte-array variable comes in a BLOB if it has no string representation
@@ -46,12 +46,12 @@ do_test types3-1.4 {
#
do_test types3-1.5 {
set V [binary format a3 abc]
concat [tcl_variable_type V] [execsql {SELECT typeof($::V)}]
concat [tcl_variable_type V] [execsql {SELECT typeof(:V)}]
} {bytearray blob}
do_test types3-1.6 {
set V "abc"
binary scan $V a3 x
concat [tcl_variable_type V] [execsql {SELECT typeof($::V)}]
concat [tcl_variable_type V] [execsql {SELECT typeof(:V)}]
} {bytearray text}
# Check to make sure return values are of the right types.
+6 -2
View File
@@ -12,7 +12,7 @@
# focus of this file is testing the use of indices in WHERE clauses
# based on recent changes to the optimizer.
#
# $Id: where2.test,v 1.7 2006/01/16 16:24:25 danielk1977 Exp $
# $Id: where2.test,v 1.8 2006/01/17 09:35:03 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -29,7 +29,11 @@ do_test where2-1.0 {
set x [expr {int(log($i)/log(2))}]
set y [expr {$i*$i + 2*$i + 1}]
set z [expr {$x+$y}]
execsql {INSERT INTO t1 VALUES($::w,$::x,$::y,$::z)}
ifcapable tclvar {
execsql {INSERT INTO t1 VALUES($::w,$::x,$::y,$::z)}
} else {
execsql {INSERT INTO t1 VALUES(:w,:x,:y,:z)}
}
}
execsql {
CREATE UNIQUE INDEX i1w ON t1(w);