1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Have tests pass when SQLITE_OMIT_SCHEMA_PRAGMAS is defined. (CVS 2144)

FossilOrigin-Name: 6ccb589bd94fc7d33e07caa39e011c3628563e9b
This commit is contained in:
danielk1977
2004-11-23 10:13:03 +00:00
parent ae82558bd0
commit 27188fb5f0
7 changed files with 45 additions and 20 deletions

View File

@ -12,7 +12,7 @@
# focus of this script is testing the ATTACH and DETACH commands
# and related functionality.
#
# $Id: attach.test,v 1.31 2004/11/22 13:35:42 danielk1977 Exp $
# $Id: attach.test,v 1.32 2004/11/23 10:13:03 danielk1977 Exp $
#
set testdir [file dirname $argv0]
@ -102,9 +102,11 @@ proc db_list {db} {
}
return $list
}
ifcapable schema_pragmas {
do_test attach-1.11b {
db_list db
} {0 main 2 db2 3 db3 4 db4 5 db5 6 db6 7 db7 8 db8 9 db9}
} ;# ifcapable schema_pragmas
do_test attach-1.12 {
catchsql {
ATTACH 'test.db' as db2;
@ -150,8 +152,12 @@ do_test attach-1.20.1 {
execsql {
DETACH db5;
}
} {}
ifcapable schema_pragmas {
do_test attach-1.20.2 {
db_list db
} {0 main 2 db2 3 db3 4 db4 5 db6 6 db7 7 db8 8 db9 9 db10 10 db11}
} ;# ifcapable schema_pragmas
integrity_check attach-1.20.2
execsql {select * from sqlite_temp_master}
do_test attach-1.21 {
@ -202,9 +208,11 @@ do_test attach-1.28 {
DETACH db2;
}
} {0 {}}
ifcapable schema_pragmas {
do_test attach-1.29 {
db_list db
} {0 main 1 temp}
} ;# ifcapable schema_pragmas
ifcapable {trigger} { # Only do the following tests if triggers are enabled
do_test attach-2.1 {
@ -249,9 +257,11 @@ do_test attach-2.7 {
SELECT type, name, tbl_name FROM db2.sqlite_master;
}
} {table t2 t2 table tx tx trigger r1 t2}
ifcapable schema_pragmas {
do_test attach-2.8 {
db_list db
} {0 main 1 temp 2 db2}
} ;# ifcapable schema_pragmas
do_test attach-2.9 {
execsql {
CREATE INDEX i2 ON t2(x);
@ -268,9 +278,11 @@ do_test attach-2.10 {
# SELECT * FROM t2 WHERE x>5;
# }
#} {1 {database schema has changed}}
ifcapable schema_pragmas {
do_test attach-2.12 {
db_list db
} {0 main 1 temp 2 db2}
} ;# ifcapable schema_pragmas
do_test attach-2.13 {
catchsql {
SELECT * FROM t2 WHERE x>5;

View File

@ -12,7 +12,7 @@
# focus of this script is testing the ATTACH and DETACH commands
# and related functionality.
#
# $Id: attach2.test,v 1.29 2004/11/05 05:10:29 drh Exp $
# $Id: attach2.test,v 1.30 2004/11/23 10:13:03 danielk1977 Exp $
#
set testdir [file dirname $argv0]
@ -61,10 +61,12 @@ do_test attach2-2.1 {
ATTACH 'test2.db' AS t2;
}
} {0 {}}
ifcapable schema_pragmas {
do_test attach2-2.2 {
# make sure test2.db did get attached.
db_list db
} {0 main 2 t2}
} ;# ifcapable schema_pragmas
db2 eval {COMMIT}
do_test attach2-2.5 {

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.23 2004/11/22 11:51:14 danielk1977 Exp $
# $Id: auth.test,v 1.24 2004/11/23 10:13:03 danielk1977 Exp $
#
set testdir [file dirname $argv0]
@ -1654,9 +1654,11 @@ do_test auth-1.259 {
DETACH DATABASE test1;
}
} {0 {}}
ifcapable schema_pragmas {
do_test auth-1.260 {
lindex [execsql {PRAGMA database_list}] 7
} {test1}
} ;# ifcapable schema_pragmas
do_test auth-1.261 {
proc auth {code arg1 arg2 arg3 arg4} {
if {$code=="SQLITE_DETACH"} {
@ -1669,9 +1671,11 @@ do_test auth-1.261 {
DETACH DATABASE test1;
}
} {1 {not authorized}}
ifcapable schema_pragmas {
do_test auth-1.262 {
lindex [execsql {PRAGMA database_list}] 7
} {test1}
} ;# ifcapable schema_pragmas
db authorizer {}
execsql {DETACH DATABASE test1}
db authorizer ::auth

View File

@ -12,7 +12,7 @@
#
# This file implements tests for the PRAGMA command.
#
# $Id: pragma.test,v 1.24 2004/11/14 21:56:31 drh Exp $
# $Id: pragma.test,v 1.25 2004/11/23 10:13:03 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -305,6 +305,7 @@ catchsql {COMMIT;}
# Test schema-query pragmas
#
ifcapable schema_pragmas {
do_test pragma-6.1 {
set res {}
execsql {SELECT * FROM sqlite_temp_master}
@ -340,9 +341,10 @@ do_test pragma-6.5 {
pragma index_info(t3i1);
}
} {0 0 a 1 1 b}
} ;# ifcapable schema_pragmas
# Miscellaneous tests
#
ifcapable schema_pragmas {
do_test pragma-7.1 {
# Make sure a pragma knows to read the schema if it needs to
db close
@ -351,6 +353,7 @@ do_test pragma-7.1 {
pragma index_list(t3);
}
} {0 t3i1 0 1 sqlite_autoindex_t3_1 1}
} ;# ifcapable schema_pragmas
ifcapable {utf16} {
do_test pragma-7.2 {
db close

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.33 2004/11/03 16:27:02 drh Exp $
# $Id: tclsqlite.test,v 1.34 2004/11/23 10:13:03 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -138,9 +138,13 @@ if {[sqlite3 -tcl-uses-utf]} {
catch {unset ::result}
do_test tcl-2.1 {
execsql "CREATE TABLE t\u0123x(a int, b\u1235 float)"
execsql "PRAGMA table_info(t\u0123x)"
} "0 a int 0 {} 0 1 b\u1235 float 0 {} 0"
do_test tcl-2.2 {
} {}
ifcapable schema_pragmas {
do_test tcl-2.2 {
execsql "PRAGMA table_info(t\u0123x)"
} "0 a int 0 {} 0 1 b\u1235 float 0 {} 0"
}
do_test tcl-2.3 {
execsql "INSERT INTO t\u0123x VALUES(1,2.3)"
db eval "SELECT * FROM t\u0123x" result break
set result(*)