mirror of
https://github.com/status-im/sqlcipher.git
synced 2026-08-30 22:11:14 +00:00
Merge branch 'sqlite-release' into prerelease-integration
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
# $Id: bigfile.test,v 1.12 2009/03/05 04:27:08 shane Exp $
|
||||
#
|
||||
|
||||
if {[file exists skip-big-file]} return
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
# files larger than 4GB.
|
||||
#
|
||||
|
||||
if {[file exists skip-big-file]} return
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
set testprefix bigfile2
|
||||
|
||||
+9
-2
@@ -649,13 +649,18 @@ do_test capi3-6.1 {
|
||||
db cache flush
|
||||
sqlite3_close $DB
|
||||
} {SQLITE_BUSY}
|
||||
|
||||
# 6.2 and 6.3 used to return SQLITE_ERROR and SQLITE_SCHEMA, respectively.
|
||||
# But since attempting to close a connection no longer resets the internal
|
||||
# schema and expires all statements, this is no longer the case.
|
||||
do_test capi3-6.2 {
|
||||
sqlite3_step $STMT
|
||||
} {SQLITE_ERROR}
|
||||
} {SQLITE_ROW}
|
||||
#check_data $STMT capi3-6.3 {INTEGER} {1} {1.0} {1}
|
||||
do_test capi3-6.3 {
|
||||
sqlite3_finalize $STMT
|
||||
} {SQLITE_SCHEMA}
|
||||
} {SQLITE_OK}
|
||||
|
||||
do_test capi3-6.4-misuse {
|
||||
db cache flush
|
||||
sqlite3_close $DB
|
||||
@@ -778,6 +783,7 @@ foreach {code english} $code2english {
|
||||
}
|
||||
|
||||
# Test the error message when a "real" out of memory occurs.
|
||||
if { [permutation] != "nofaultsim" } {
|
||||
ifcapable memdebug {
|
||||
do_test capi3-10-1 {
|
||||
sqlite3 db test.db
|
||||
@@ -816,6 +822,7 @@ ifcapable memdebug {
|
||||
db close
|
||||
sqlite3_memdebug_fail -1
|
||||
}
|
||||
}
|
||||
|
||||
# The following tests - capi3-11.* - test that a COMMIT or ROLLBACK
|
||||
# statement issued while there are still outstanding VMs that are part of
|
||||
|
||||
@@ -751,6 +751,7 @@ foreach {code english} $code2english {
|
||||
}
|
||||
|
||||
# Test the error message when a "real" out of memory occurs.
|
||||
if { [permutation] != "nofaultsim" } {
|
||||
ifcapable memdebug {
|
||||
do_test capi3c-10-1 {
|
||||
sqlite3 db test.db
|
||||
@@ -771,6 +772,7 @@ ifcapable memdebug {
|
||||
db close
|
||||
sqlite3_memdebug_fail -1
|
||||
}
|
||||
}
|
||||
|
||||
# The following tests - capi3c-11.* - test that a COMMIT or ROLLBACK
|
||||
# statement issued while there are still outstanding VMs that are part of
|
||||
|
||||
+16
-15
@@ -131,10 +131,10 @@ sqlite3_config_uri 1
|
||||
if {$tcl_platform(platform) == "unix"} {
|
||||
set flags [list SQLITE_OPEN_READWRITE SQLITE_OPEN_CREATE SQLITE_OPEN_URI]
|
||||
foreach {tn uri error} "
|
||||
1 {file://localhost[get_pwd]/test.db} {not an error}
|
||||
2 {file://[get_pwd]/test.db} {not an error}
|
||||
3 {file://x[get_pwd]/test.db} {invalid uri authority: x}
|
||||
4 {file://invalid[get_pwd]/test.db} {invalid uri authority: invalid}
|
||||
1 {file://localhost[test_pwd /]test.db} {not an error}
|
||||
2 {file://[test_pwd /]test.db} {not an error}
|
||||
3 {file://x[test_pwd /]test.db} {invalid uri authority: x}
|
||||
4 {file://invalid[test_pwd /]test.db} {invalid uri authority: invalid}
|
||||
" {
|
||||
do_test 2.$tn {
|
||||
set DB [sqlite3_open_v2 $uri $flags ""]
|
||||
@@ -153,9 +153,9 @@ if {$tcl_platform(platform) == "unix"} {
|
||||
# parameters passed through to the VFS xOpen() methods.
|
||||
#
|
||||
foreach {tn uri parse} "
|
||||
1 {file:test.db#abc} {[get_pwd]/test.db {}}
|
||||
2 {file:test.db?a=b#abc} {[get_pwd]/test.db {a b}}
|
||||
3 {file:test.db?a=b#?c=d} {[get_pwd]/test.db {a b}}
|
||||
1 {file:test.db#abc} {[test_pwd / {}]test.db {}}
|
||||
2 {file:test.db?a=b#abc} {[test_pwd / {}]test.db {a b}}
|
||||
3 {file:test.db?a=b#?c=d} {[test_pwd / {}]test.db {a b}}
|
||||
" {
|
||||
do_filepath_test 3.$tn { parse_uri $uri } $parse
|
||||
}
|
||||
@@ -171,7 +171,7 @@ foreach {tn uri parse} "
|
||||
# path is interpreted as a relative path.
|
||||
#
|
||||
foreach {tn uri parse} "
|
||||
1 {file:test.db} {[get_pwd]/test.db {}}
|
||||
1 {file:test.db} {[test_pwd / {}]test.db {}}
|
||||
2 {file:/test.db} {/test.db {}}
|
||||
3 {file:///test.db} {/test.db {}}
|
||||
4 {file://localhost/test.db} {/test.db {}}
|
||||
@@ -241,9 +241,9 @@ do_test 6.1 {
|
||||
} {no such vfs: nosuchvfs}
|
||||
|
||||
|
||||
# EVIDENCE-OF: R-60479-64270 The mode parameter may be set to either
|
||||
# "ro", "rw" or "rwc". Attempting to set it to any other value is an
|
||||
# error
|
||||
# EVIDENCE-OF: R-44013-13102 The mode parameter may be set to either
|
||||
# "ro", "rw", "rwc", or "memory". Attempting to set it to any other
|
||||
# value is an error
|
||||
#
|
||||
sqlite3 db test.db
|
||||
db close
|
||||
@@ -254,6 +254,8 @@ foreach {tn uri error} "
|
||||
4 {file:test.db?mode=Ro} {no such access mode: Ro}
|
||||
5 {file:test.db?mode=Rw} {no such access mode: Rw}
|
||||
6 {file:test.db?mode=Rwc} {no such access mode: Rwc}
|
||||
7 {file:test.db?mode=memory} {not an error}
|
||||
8 {file:test.db?mode=MEMORY} {no such access mode: MEMORY}
|
||||
" {
|
||||
do_test 7.$tn { open_uri_error $uri } $error
|
||||
}
|
||||
@@ -306,10 +308,9 @@ foreach {tn uri read write create} {
|
||||
catch {db close}
|
||||
}
|
||||
|
||||
# EVIDENCE-OF: R-56032-32287 If sqlite3_open_v2() is used, it is an
|
||||
# error to specify a value for the mode parameter that is less
|
||||
# restrictive than that specified by the flags passed as the third
|
||||
# parameter.
|
||||
# EVIDENCE-OF: R-20590-08726 It is an error to specify a value for the
|
||||
# mode parameter that is less restrictive than that specified by the
|
||||
# flags passed in the third parameter to sqlite3_open_v2().
|
||||
#
|
||||
forcedelete test.db
|
||||
sqlite3 db test.db
|
||||
|
||||
@@ -131,4 +131,28 @@ do_faultsim_test 4.1 -prep {
|
||||
faultsim_test_result {0 {}}
|
||||
}
|
||||
|
||||
ifcapable fts3_unicode {
|
||||
do_test 5.0 {
|
||||
faultsim_delete_and_reopen
|
||||
execsql {
|
||||
CREATE VIRTUAL TABLE ft USING fts4(a, tokenize=unicode61);
|
||||
}
|
||||
faultsim_save_and_close
|
||||
} {}
|
||||
|
||||
do_faultsim_test 5.1 -faults oom* -prep {
|
||||
faultsim_restore_and_reopen
|
||||
db eval {SELECT * FROM sqlite_master}
|
||||
} -body {
|
||||
execsql { INSERT INTO ft VALUES('the quick brown fox'); }
|
||||
execsql { INSERT INTO ft VALUES(
|
||||
'theunusuallylongtokenthatjustdragsonandonandonandthendragsonsomemoreeof'
|
||||
);
|
||||
}
|
||||
execsql { SELECT docid FROM ft WHERE ft MATCH 'th*' }
|
||||
} -test {
|
||||
faultsim_test_result {0 {1 2}}
|
||||
}
|
||||
}
|
||||
|
||||
finish_test
|
||||
|
||||
@@ -0,0 +1,330 @@
|
||||
# 2012 May 25
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#*************************************************************************
|
||||
#
|
||||
# The tests in this file focus on testing the "unicode" FTS tokenizer.
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
ifcapable !fts3_unicode { finish_test ; return }
|
||||
set ::testprefix fts4unicode
|
||||
|
||||
proc do_unicode_token_test {tn input res} {
|
||||
set input [string map {' ''} $input]
|
||||
uplevel [list do_execsql_test $tn "
|
||||
SELECT fts3_tokenizer_test('unicode61', 'remove_diacritics=0', '$input');
|
||||
" [list [list {*}$res]]]
|
||||
}
|
||||
|
||||
proc do_unicode_token_test2 {tn input res} {
|
||||
set input [string map {' ''} $input]
|
||||
uplevel [list do_execsql_test $tn "
|
||||
SELECT fts3_tokenizer_test('unicode61', '$input');
|
||||
" [list [list {*}$res]]]
|
||||
}
|
||||
|
||||
proc do_unicode_token_test3 {tn args} {
|
||||
set res [lindex $args end]
|
||||
set sql "SELECT fts3_tokenizer_test('unicode61'"
|
||||
foreach a [lrange $args 0 end-1] {
|
||||
append sql ", '"
|
||||
append sql [string map {' ''} $a]
|
||||
append sql "'"
|
||||
}
|
||||
append sql ")"
|
||||
uplevel [list do_execsql_test $tn $sql [list [list {*}$res]]]
|
||||
}
|
||||
|
||||
do_unicode_token_test 1.0 {a B c D} {0 a a 1 b B 2 c c 3 d D}
|
||||
do_unicode_token_test 1.1 {Ä Ö Ü} {0 ä Ä 1 ö Ö 2 ü Ü}
|
||||
do_unicode_token_test 1.2 {xÄx xÖx xÜx} {0 xäx xÄx 1 xöx xÖx 2 xüx xÜx}
|
||||
|
||||
# 0x00DF is a small "sharp s". 0x1E9E is a capital sharp s.
|
||||
do_unicode_token_test 1.3 "\uDF" "0 \uDF \uDF"
|
||||
do_unicode_token_test 1.4 "\u1E9E" "0 ß \u1E9E"
|
||||
do_unicode_token_test 1.5 "\u1E9E" "0 \uDF \u1E9E"
|
||||
|
||||
do_unicode_token_test 1.6 "The quick brown fox" {
|
||||
0 the The 1 quick quick 2 brown brown 3 fox fox
|
||||
}
|
||||
do_unicode_token_test 1.7 "The\u00bfquick\u224ebrown\u2263fox" {
|
||||
0 the The 1 quick quick 2 brown brown 3 fox fox
|
||||
}
|
||||
|
||||
do_unicode_token_test2 1.8 {a B c D} {0 a a 1 b B 2 c c 3 d D}
|
||||
do_unicode_token_test2 1.9 {Ä Ö Ü} {0 a Ä 1 o Ö 2 u Ü}
|
||||
do_unicode_token_test2 1.10 {xÄx xÖx xÜx} {0 xax xÄx 1 xox xÖx 2 xux xÜx}
|
||||
|
||||
# Check that diacritics are removed if remove_diacritics=1 is specified.
|
||||
# And that they do not break tokens.
|
||||
do_unicode_token_test2 1.10 "xx\u0301xx" "0 xxxx xx\u301xx"
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
set docs [list {
|
||||
Enhance the INSERT syntax to allow multiple rows to be inserted via the
|
||||
VALUES clause.
|
||||
} {
|
||||
Enhance the CREATE VIRTUAL TABLE command to support the IF NOT EXISTS clause.
|
||||
} {
|
||||
Added the sqlite3_stricmp() interface as a counterpart to sqlite3_strnicmp().
|
||||
} {
|
||||
Added the sqlite3_db_readonly() interface.
|
||||
} {
|
||||
Added the SQLITE_FCNTL_PRAGMA file control, giving VFS implementations the
|
||||
ability to add new PRAGMA statements or to override built-in PRAGMAs.
|
||||
} {
|
||||
Queries of the form: "SELECT max(x), y FROM table" returns the value of y on
|
||||
the same row that contains the maximum x value.
|
||||
} {
|
||||
Added support for the FTS4 languageid option.
|
||||
} {
|
||||
Documented support for the FTS4 content option. This feature has actually
|
||||
been in the code since version 3.7.9 but is only now considered to be
|
||||
officially supported.
|
||||
} {
|
||||
Pending statements no longer block ROLLBACK. Instead, the pending statement
|
||||
will return SQLITE_ABORT upon next access after the ROLLBACK.
|
||||
} {
|
||||
Improvements to the handling of CSV inputs in the command-line shell
|
||||
} {
|
||||
Fix a bug introduced in version 3.7.10 that might cause a LEFT JOIN to be
|
||||
incorrectly converted into an INNER JOIN if the WHERE clause indexable terms
|
||||
connected by OR.
|
||||
}]
|
||||
|
||||
set map(a) [list "\u00C4" "\u00E4"] ; # LATIN LETTER A WITH DIAERESIS
|
||||
set map(e) [list "\u00CB" "\u00EB"] ; # LATIN LETTER E WITH DIAERESIS
|
||||
set map(i) [list "\u00CF" "\u00EF"] ; # LATIN LETTER I WITH DIAERESIS
|
||||
set map(o) [list "\u00D6" "\u00F6"] ; # LATIN LETTER O WITH DIAERESIS
|
||||
set map(u) [list "\u00DC" "\u00FC"] ; # LATIN LETTER U WITH DIAERESIS
|
||||
set map(y) [list "\u0178" "\u00FF"] ; # LATIN LETTER Y WITH DIAERESIS
|
||||
set map(h) [list "\u1E26" "\u1E27"] ; # LATIN LETTER H WITH DIAERESIS
|
||||
set map(w) [list "\u1E84" "\u1E85"] ; # LATIN LETTER W WITH DIAERESIS
|
||||
set map(x) [list "\u1E8C" "\u1E8D"] ; # LATIN LETTER X WITH DIAERESIS
|
||||
foreach k [array names map] {
|
||||
lappend mappings [string toupper $k] [lindex $map($k) 0]
|
||||
lappend mappings $k [lindex $map($k) 1]
|
||||
}
|
||||
proc mapdoc {doc} {
|
||||
set doc [regsub -all {[[:space:]]+} $doc " "]
|
||||
string map $::mappings [string trim $doc]
|
||||
}
|
||||
|
||||
do_test 2.0 {
|
||||
execsql { CREATE VIRTUAL TABLE t2 USING fts4(tokenize=unicode61, x); }
|
||||
foreach doc $docs {
|
||||
set d [mapdoc $doc]
|
||||
execsql { INSERT INTO t2 VALUES($d) }
|
||||
}
|
||||
} {}
|
||||
|
||||
do_test 2.1 {
|
||||
set q [mapdoc "row"]
|
||||
execsql { SELECT * FROM t2 WHERE t2 MATCH $q }
|
||||
} [list [mapdoc {
|
||||
Queries of the form: "SELECT max(x), y FROM table" returns the value of y on
|
||||
the same row that contains the maximum x value.
|
||||
}]]
|
||||
|
||||
foreach {tn query snippet} {
|
||||
2 "row" {
|
||||
...returns the value of y on the same [row] that contains
|
||||
the maximum x value.
|
||||
}
|
||||
3 "ROW" {
|
||||
...returns the value of y on the same [row] that contains
|
||||
the maximum x value.
|
||||
}
|
||||
4 "rollback" {
|
||||
...[ROLLBACK]. Instead, the pending statement
|
||||
will return SQLITE_ABORT upon next access after the [ROLLBACK].
|
||||
}
|
||||
5 "rOllback" {
|
||||
...[ROLLBACK]. Instead, the pending statement
|
||||
will return SQLITE_ABORT upon next access after the [ROLLBACK].
|
||||
}
|
||||
6 "lang*" {
|
||||
Added support for the FTS4 [languageid] option.
|
||||
}
|
||||
} {
|
||||
do_test 2.$tn {
|
||||
set q [mapdoc $query]
|
||||
execsql { SELECT snippet(t2, '[', ']', '...') FROM t2 WHERE t2 MATCH $q }
|
||||
} [list [mapdoc $snippet]]
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Make sure the unicode61 tokenizer does not crash if it is passed a
|
||||
# NULL pointer.
|
||||
reset_db
|
||||
do_execsql_test 3.1 {
|
||||
CREATE VIRTUAL TABLE t1 USING fts4(tokenize=unicode61, x, y);
|
||||
INSERT INTO t1 VALUES(NULL, 'a b c');
|
||||
}
|
||||
|
||||
do_execsql_test 3.2 {
|
||||
SELECT snippet(t1, '[', ']') FROM t1 WHERE t1 MATCH 'b'
|
||||
} {{a [b] c}}
|
||||
|
||||
do_execsql_test 3.3 {
|
||||
BEGIN;
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES('b b b b b b b b b b b', 'b b b b b b b b b b b b b');
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 VALUES('a b c', NULL);
|
||||
INSERT INTO t1 VALUES('a x c', NULL);
|
||||
COMMIT;
|
||||
}
|
||||
|
||||
do_execsql_test 3.4 {
|
||||
SELECT * FROM t1 WHERE t1 MATCH 'a b';
|
||||
} {{a b c} {}}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
reset_db
|
||||
|
||||
do_test 4.1 {
|
||||
set a "abc\uFFFEdef"
|
||||
set b "abc\uD800def"
|
||||
set c "\uFFFEdef"
|
||||
set d "\uD800def"
|
||||
execsql {
|
||||
CREATE VIRTUAL TABLE t1 USING fts4(tokenize=unicode61, x);
|
||||
INSERT INTO t1 VALUES($a);
|
||||
INSERT INTO t1 VALUES($b);
|
||||
INSERT INTO t1 VALUES($c);
|
||||
INSERT INTO t1 VALUES($d);
|
||||
}
|
||||
} {}
|
||||
|
||||
do_test 4.2 {
|
||||
set a [binary format c* {0x61 0xF7 0xBF 0xBF 0xBF 0x62}]
|
||||
set b [binary format c* {0x61 0xF7 0xBF 0xBF 0xBF 0xBF 0x62}]
|
||||
set c [binary format c* {0x61 0xF7 0xBF 0xBF 0xBF 0xBF 0xBF 0x62}]
|
||||
set d [binary format c* {0x61 0xF7 0xBF 0xBF 0xBF 0xBF 0xBF 0xBF 0x62}]
|
||||
execsql {
|
||||
INSERT INTO t1 VALUES($a);
|
||||
INSERT INTO t1 VALUES($b);
|
||||
INSERT INTO t1 VALUES($c);
|
||||
INSERT INTO t1 VALUES($d);
|
||||
}
|
||||
} {}
|
||||
|
||||
do_test 4.3 {
|
||||
set a [binary format c* {0xF7 0xBF 0xBF 0xBF}]
|
||||
set b [binary format c* {0xF7 0xBF 0xBF 0xBF 0xBF}]
|
||||
set c [binary format c* {0xF7 0xBF 0xBF 0xBF 0xBF 0xBF}]
|
||||
set d [binary format c* {0xF7 0xBF 0xBF 0xBF 0xBF 0xBF 0xBF}]
|
||||
execsql {
|
||||
INSERT INTO t1 VALUES($a);
|
||||
INSERT INTO t1 VALUES($b);
|
||||
INSERT INTO t1 VALUES($c);
|
||||
INSERT INTO t1 VALUES($d);
|
||||
}
|
||||
} {}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
do_unicode_token_test3 5.1 {tokenchars=} {
|
||||
sqlite3_reset sqlite3_column_int
|
||||
} {
|
||||
0 sqlite3 sqlite3
|
||||
1 reset reset
|
||||
2 sqlite3 sqlite3
|
||||
3 column column
|
||||
4 int int
|
||||
}
|
||||
|
||||
do_unicode_token_test3 5.2 {tokenchars=_} {
|
||||
sqlite3_reset sqlite3_column_int
|
||||
} {
|
||||
0 sqlite3_reset sqlite3_reset
|
||||
1 sqlite3_column_int sqlite3_column_int
|
||||
}
|
||||
|
||||
do_unicode_token_test3 5.3 {separators=xyz} {
|
||||
Laotianxhorseyrunszfast
|
||||
} {
|
||||
0 laotian Laotian
|
||||
1 horse horse
|
||||
2 runs runs
|
||||
3 fast fast
|
||||
}
|
||||
|
||||
do_unicode_token_test3 5.4 {tokenchars=xyz} {
|
||||
Laotianxhorseyrunszfast
|
||||
} {
|
||||
0 laotianxhorseyrunszfast Laotianxhorseyrunszfast
|
||||
}
|
||||
|
||||
do_unicode_token_test3 5.5 {tokenchars=_} {separators=zyx} {
|
||||
sqlite3_resetxsqlite3_column_intyhonda_phantom
|
||||
} {
|
||||
0 sqlite3_reset sqlite3_reset
|
||||
1 sqlite3_column_int sqlite3_column_int
|
||||
2 honda_phantom honda_phantom
|
||||
}
|
||||
|
||||
do_unicode_token_test3 5.6 "separators=\u05D1" "abc\u05D1def" {
|
||||
0 abc abc 1 def def
|
||||
}
|
||||
|
||||
do_unicode_token_test3 5.7 \
|
||||
"tokenchars=\u2444\u2445" \
|
||||
"separators=\u05D0\u05D1\u05D2" \
|
||||
"\u2444fre\u2445sh\u05D0water\u05D2fish.\u2445timer" \
|
||||
[list \
|
||||
0 \u2444fre\u2445sh \u2444fre\u2445sh \
|
||||
1 water water \
|
||||
2 fish fish \
|
||||
3 \u2445timer \u2445timer \
|
||||
]
|
||||
|
||||
# Check that it is not possible to add a standalone diacritic codepoint
|
||||
# to either separators or tokenchars.
|
||||
do_unicode_token_test3 5.8 "separators=\u0301" \
|
||||
"hello\u0301world \u0301helloworld" \
|
||||
"0 helloworld hello\u0301world 1 helloworld helloworld"
|
||||
|
||||
do_unicode_token_test3 5.9 "tokenchars=\u0301" \
|
||||
"hello\u0301world \u0301helloworld" \
|
||||
"0 helloworld hello\u0301world 1 helloworld helloworld"
|
||||
|
||||
do_unicode_token_test3 5.10 "separators=\u0301" \
|
||||
"remove_diacritics=0" \
|
||||
"hello\u0301world \u0301helloworld" \
|
||||
"0 hello\u0301world hello\u0301world 1 helloworld helloworld"
|
||||
|
||||
do_unicode_token_test3 5.11 "tokenchars=\u0301" \
|
||||
"remove_diacritics=0" \
|
||||
"hello\u0301world \u0301helloworld" \
|
||||
"0 hello\u0301world hello\u0301world 1 helloworld helloworld"
|
||||
|
||||
|
||||
finish_test
|
||||
|
||||
@@ -472,6 +472,11 @@ ifcapable subquery {
|
||||
} {1 2 3 4 5 6 7 8 9 10 11}
|
||||
}
|
||||
|
||||
#
|
||||
# The following tests can only work if the current SQLite VFS has the concept
|
||||
# of a current directory.
|
||||
#
|
||||
ifcapable curdir {
|
||||
# Make sure a database connection still works after changing the
|
||||
# working directory.
|
||||
#
|
||||
@@ -495,6 +500,7 @@ do_test misc1-14.3 {
|
||||
execsql {COMMIT}
|
||||
file exists ./test.db-journal
|
||||
} {0}
|
||||
}
|
||||
|
||||
# A failed create table should not leave the table in the internal
|
||||
# data structures. Ticket #238.
|
||||
|
||||
+31
-4
@@ -524,18 +524,27 @@ db close
|
||||
# file-system is saved just before the xDelete() call to remove the
|
||||
# master journal file from the file-system.
|
||||
#
|
||||
set pwd [get_pwd]
|
||||
testvfs tv -default 1
|
||||
tv script copy_on_mj_delete
|
||||
set ::mj_filename_length 0
|
||||
proc copy_on_mj_delete {method filename args} {
|
||||
if {[string match *mj* [file tail $filename]]} {
|
||||
set ::mj_filename_length [string length $filename]
|
||||
#
|
||||
# NOTE: Is the file name relative? If so, add the length of the current
|
||||
# directory.
|
||||
#
|
||||
if {[is_relative_file $filename]} {
|
||||
set ::mj_filename_length \
|
||||
[expr {[string length $filename] + [string length $::pwd]}]
|
||||
} else {
|
||||
set ::mj_filename_length [string length $filename]
|
||||
}
|
||||
faultsim_save
|
||||
}
|
||||
return SQLITE_OK
|
||||
}
|
||||
|
||||
set pwd [get_pwd]
|
||||
foreach {tn1 tcl} {
|
||||
1 { set prefix "test.db" }
|
||||
2 {
|
||||
@@ -1019,8 +1028,17 @@ do_test pager1-5.4.1 {
|
||||
# the master-journal name encoded as utf-8 with no nul term.
|
||||
#
|
||||
set mj_pointer [expr {
|
||||
20 + [string length [get_pwd]] + [string length "/test.db-mjXXXXXX9XX"]
|
||||
20 + [string length "test.db-mjXXXXXX9XX"]
|
||||
}]
|
||||
#
|
||||
# NOTE: For item 3 above, if the current SQLite VFS lacks the concept of a
|
||||
# current directory, the length of the current directory name plus 1
|
||||
# character for the directory separator character are NOT counted as
|
||||
# part of the total size; otherwise, they are.
|
||||
#
|
||||
ifcapable curdir {
|
||||
set mj_pointer [expr {$mj_pointer + [string length [get_pwd]] + 1}]
|
||||
}
|
||||
expr {$::max_journal==(512+2*(1024+8)+$mj_pointer)}
|
||||
} 1
|
||||
do_test pager1-5.4.2 {
|
||||
@@ -1038,8 +1056,17 @@ do_test pager1-5.4.2 {
|
||||
# written starting at the next (in this case 512 byte) sector boundary.
|
||||
#
|
||||
set mj_pointer [expr {
|
||||
20 + [string length [get_pwd]] + [string length "/test.db-mjXXXXXX9XX"]
|
||||
20 + [string length "test.db-mjXXXXXX9XX"]
|
||||
}]
|
||||
#
|
||||
# NOTE: If the current SQLite VFS lacks the concept of a current directory,
|
||||
# the length of the current directory name plus 1 character for the
|
||||
# directory separator character are NOT counted as part of the total
|
||||
# size; otherwise, they are.
|
||||
#
|
||||
ifcapable curdir {
|
||||
set mj_pointer [expr {$mj_pointer + [string length [get_pwd]] + 1}]
|
||||
}
|
||||
expr {$::max_journal==(((512+2*(1024+8)+511)/512)*512 + $mj_pointer)}
|
||||
} 1
|
||||
db close
|
||||
|
||||
+16
-1
@@ -185,9 +185,24 @@ test_suite "fts3" -prefix "" -description {
|
||||
fts4aa.test fts4content.test
|
||||
fts3conf.test fts3prefix.test fts3fault2.test fts3corrupt.test
|
||||
fts3corrupt2.test fts3first.test fts4langid.test fts4merge.test
|
||||
fts4check.test
|
||||
fts4check.test fts4unicode.test
|
||||
}
|
||||
|
||||
test_suite "nofaultsim" -prefix "" -description {
|
||||
"Very" quick test suite. Runs in less than 5 minutes on a workstation.
|
||||
This test suite is the same as the "quick" tests, except that some files
|
||||
that test malloc and IO errors are omitted.
|
||||
} -files [
|
||||
test_set $allquicktests -exclude *malloc* *ioerr* *fault*
|
||||
] -initialize {
|
||||
catch {db close}
|
||||
sqlite3_shutdown
|
||||
install_malloc_faultsim 0
|
||||
sqlite3_initialize
|
||||
autoinstall_test_functions
|
||||
} -shutdown {
|
||||
unset -nocomplain ::G(valgrind)
|
||||
}
|
||||
|
||||
lappend ::testsuitelist xxx
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@@ -40,6 +40,7 @@ do_not_use_codec
|
||||
# pragma-15.*: Test that the value set using the cache_size pragma is not
|
||||
# reset when the schema is reloaded.
|
||||
# pragma-16.*: Test proxy locking
|
||||
# pragma-20.*: Test data_store_directory.
|
||||
#
|
||||
|
||||
ifcapable !pragma {
|
||||
@@ -1510,5 +1511,47 @@ do_test pragma-19.5 {
|
||||
file tail [lindex [execsql {PRAGMA filename}] 0]
|
||||
} {test.db}
|
||||
|
||||
if {$tcl_platform(platform)=="windows"} {
|
||||
# Test data_store_directory pragma
|
||||
#
|
||||
db close
|
||||
sqlite3 db test.db
|
||||
file mkdir data_dir
|
||||
do_test pragma-20.1 {
|
||||
catchsql {PRAGMA data_store_directory}
|
||||
} {0 {}}
|
||||
do_test pragma-20.2 {
|
||||
set pwd [string map {' ''} [file nativename [get_pwd]]]
|
||||
catchsql "PRAGMA data_store_directory='$pwd';"
|
||||
} {0 {}}
|
||||
do_test pragma-20.3 {
|
||||
catchsql {PRAGMA data_store_directory}
|
||||
} [list 0 [list [file nativename [get_pwd]]]]
|
||||
do_test pragma-20.4 {
|
||||
set pwd [string map {' ''} [file nativename \
|
||||
[file join [get_pwd] data_dir]]]
|
||||
catchsql "PRAGMA data_store_directory='$pwd';"
|
||||
} {0 {}}
|
||||
do_test pragma-20.5 {
|
||||
sqlite3 db2 test2.db
|
||||
catchsql "PRAGMA database_list;" db2
|
||||
} [list 0 [list 0 main [file nativename \
|
||||
[file join [get_pwd] data_dir test2.db]]]]
|
||||
catch {db2 close}
|
||||
do_test pragma-20.6 {
|
||||
sqlite3 db2 [file join [get_pwd] test2.db]
|
||||
catchsql "PRAGMA database_list;" db2
|
||||
} [list 0 [list 0 main [file nativename \
|
||||
[file join [get_pwd] test2.db]]]]
|
||||
catch {db2 close}
|
||||
do_test pragma-20.7 {
|
||||
catchsql "PRAGMA data_store_directory='';"
|
||||
} {0 {}}
|
||||
do_test pragma-20.8 {
|
||||
catchsql {PRAGMA data_store_directory}
|
||||
} {0 {}}
|
||||
|
||||
forcedelete data_dir
|
||||
} ;# endif windows
|
||||
|
||||
finish_test
|
||||
|
||||
@@ -12,6 +12,13 @@
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
# If SQLITE_CURDIR is not defined, omit this file.
|
||||
ifcapable !curdir {
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
|
||||
source $testdir/malloc_common.tcl
|
||||
|
||||
unset -nocomplain defaultVfs
|
||||
|
||||
+32
-1
@@ -12,6 +12,13 @@
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
# If SQLITE_CURDIR is not defined, omit this file.
|
||||
ifcapable !curdir {
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
|
||||
source $testdir/malloc_common.tcl
|
||||
|
||||
db close
|
||||
@@ -164,11 +171,17 @@ do_test quota2-2.1 {
|
||||
do_test quota2-2.2 {
|
||||
set ::quota
|
||||
} {}
|
||||
do_test quota2-2.3 {
|
||||
do_test quota2-2.3.1 {
|
||||
sqlite3_quota_rewind $::h1
|
||||
sqlite3_quota_file_available $::h1
|
||||
} {7000}
|
||||
do_test quota2-2.3.2 {
|
||||
set ::x [sqlite3_quota_fread $::h1 1001 7]
|
||||
string length $::x
|
||||
} {6006}
|
||||
do_test quota2-2.3.3 {
|
||||
sqlite3_quota_file_available $::h1
|
||||
} {0}
|
||||
do_test quota2-2.4 {
|
||||
string match $::x [string range $::bigtext 0 6005]
|
||||
} {1}
|
||||
@@ -180,22 +193,40 @@ do_test quota2-2.6 {
|
||||
sqlite3_quota_fseek $::h1 -100 SEEK_END
|
||||
sqlite3_quota_ftell $::h1
|
||||
} {6900}
|
||||
do_test quota2-2.6.1 {
|
||||
sqlite3_quota_file_available $::h1
|
||||
} {100}
|
||||
do_test quota2-2.7 {
|
||||
sqlite3_quota_fseek $::h1 -100 SEEK_CUR
|
||||
sqlite3_quota_ftell $::h1
|
||||
} {6800}
|
||||
do_test quota2-2.7.1 {
|
||||
sqlite3_quota_file_available $::h1
|
||||
} {200}
|
||||
do_test quota2-2.8 {
|
||||
sqlite3_quota_fseek $::h1 50 SEEK_CUR
|
||||
sqlite3_quota_ftell $::h1
|
||||
} {6850}
|
||||
do_test quota2-2.8.1 {
|
||||
sqlite3_quota_file_available $::h1
|
||||
} {150}
|
||||
do_test quota2-2.9 {
|
||||
sqlite3_quota_fseek $::h1 50 SEEK_SET
|
||||
sqlite3_quota_ftell $::h1
|
||||
} {50}
|
||||
do_test quota2-2.9.1 {
|
||||
sqlite3_quota_file_available $::h1
|
||||
} {6950}
|
||||
do_test quota2-2.10 {
|
||||
sqlite3_quota_rewind $::h1
|
||||
sqlite3_quota_ftell $::h1
|
||||
} {0}
|
||||
do_test quota2-2.10.1 {
|
||||
sqlite3_quota_file_available $::h1
|
||||
} {7000}
|
||||
do_test quota2-2.10.2 {
|
||||
sqlite3_quota_ferror $::h1
|
||||
} {0}
|
||||
do_test quota2-2.11 {
|
||||
standard_path [sqlite3_quota_dump]
|
||||
} {{*/quota2b/* 5000 0} {*/quota2a/* 4000 0}}
|
||||
|
||||
+126
-4
@@ -904,9 +904,11 @@ do_test shared-$av.11.8 {
|
||||
set res
|
||||
} {1 4 {} 7}
|
||||
if {[llength [info command sqlite3_shared_cache_report]]==1} {
|
||||
do_test shared-$av.11.9 {
|
||||
string tolower [sqlite3_shared_cache_report]
|
||||
} [string tolower [list [file nativename [file normalize test.db]] 2]]
|
||||
ifcapable curdir {
|
||||
do_test shared-$av.11.9 {
|
||||
string tolower [sqlite3_shared_cache_report]
|
||||
} [string tolower [list [file nativename [file normalize test.db]] 2]]
|
||||
}
|
||||
}
|
||||
|
||||
do_test shared-$av.11.11 {
|
||||
@@ -1056,7 +1058,127 @@ do_test shared-$av-15.2 {
|
||||
db close
|
||||
db2 close
|
||||
|
||||
}
|
||||
# Shared cache on a :memory: database. This only works for URI filenames.
|
||||
#
|
||||
do_test shared-$av-16.1 {
|
||||
sqlite3 db1 file::memory: -uri 1
|
||||
sqlite3 db2 file::memory: -uri 1
|
||||
db1 eval {
|
||||
CREATE TABLE t1(x); INSERT INTO t1 VALUES(1),(2),(3);
|
||||
}
|
||||
db2 eval {
|
||||
SELECT x FROM t1 ORDER BY x;
|
||||
}
|
||||
} {1 2 3}
|
||||
do_test shared-$av-16.2 {
|
||||
db2 eval {
|
||||
INSERT INTO t1 VALUES(99);
|
||||
DELETE FROM t1 WHERE x=2;
|
||||
}
|
||||
db1 eval {
|
||||
SELECT x FROM t1 ORDER BY x;
|
||||
}
|
||||
} {1 3 99}
|
||||
|
||||
# Verify that there is no cache sharing ordinary (non-URI) filenames are
|
||||
# used.
|
||||
#
|
||||
do_test shared-$av-16.3 {
|
||||
db1 close
|
||||
db2 close
|
||||
sqlite3 db1 :memory:
|
||||
sqlite3 db2 :memory:
|
||||
db1 eval {
|
||||
CREATE TABLE t1(x); INSERT INTO t1 VALUES(4),(5),(6);
|
||||
}
|
||||
catchsql {
|
||||
SELECT * FROM t1;
|
||||
} db2
|
||||
} {1 {no such table: t1}}
|
||||
|
||||
# Shared cache on named memory databases.
|
||||
#
|
||||
do_test shared-$av-16.4 {
|
||||
db1 close
|
||||
db2 close
|
||||
forcedelete test.db test.db-wal test.db-journal
|
||||
sqlite3 db1 file:test.db?mode=memory -uri 1
|
||||
sqlite3 db2 file:test.db?mode=memory -uri 1
|
||||
db1 eval {
|
||||
CREATE TABLE t1(x); INSERT INTO t1 VALUES(1),(2),(3);
|
||||
}
|
||||
db2 eval {
|
||||
SELECT x FROM t1 ORDER BY x;
|
||||
}
|
||||
} {1 2 3}
|
||||
do_test shared-$av-16.5 {
|
||||
db2 eval {
|
||||
INSERT INTO t1 VALUES(99);
|
||||
DELETE FROM t1 WHERE x=2;
|
||||
}
|
||||
db1 eval {
|
||||
SELECT x FROM t1 ORDER BY x;
|
||||
}
|
||||
} {1 3 99}
|
||||
do_test shared-$av-16.6 {
|
||||
file exists test.db
|
||||
} {0} ;# Verify that the database is in-memory
|
||||
|
||||
# Shared cache on named memory databases with different names.
|
||||
#
|
||||
do_test shared-$av-16.7 {
|
||||
db1 close
|
||||
db2 close
|
||||
forcedelete test1.db test2.db
|
||||
sqlite3 db1 file:test1.db?mode=memory -uri 1
|
||||
sqlite3 db2 file:test2.db?mode=memory -uri 1
|
||||
db1 eval {
|
||||
CREATE TABLE t1(x); INSERT INTO t1 VALUES(1),(2),(3);
|
||||
}
|
||||
catchsql {
|
||||
SELECT x FROM t1 ORDER BY x;
|
||||
} db2
|
||||
} {1 {no such table: t1}}
|
||||
do_test shared-$av-16.8 {
|
||||
file exists test1.db
|
||||
} {0} ;# Verify that the database is in-memory
|
||||
|
||||
# Shared cache on named memory databases attached to readonly connections.
|
||||
#
|
||||
do_test shared-$av-16.8.1 {
|
||||
db1 close
|
||||
db2 close
|
||||
|
||||
sqlite3 db test1.db
|
||||
db eval {
|
||||
CREATE TABLE yy(a, b);
|
||||
INSERT INTO yy VALUES(77, 88);
|
||||
}
|
||||
db close
|
||||
|
||||
sqlite3 db1 test1.db -uri 1 -readonly 1
|
||||
sqlite3 db2 test2.db -uri 1
|
||||
|
||||
db1 eval {
|
||||
ATTACH 'file:mem?mode=memory&cache=shared' AS shared;
|
||||
CREATE TABLE shared.xx(a, b);
|
||||
INSERT INTO xx VALUES(55, 66);
|
||||
}
|
||||
db2 eval {
|
||||
ATTACH 'file:mem?mode=memory&cache=shared' AS shared;
|
||||
SELECT * FROM xx;
|
||||
}
|
||||
} {55 66}
|
||||
|
||||
do_test shared-$av-16.8.2 { db1 eval { SELECT * FROM yy } } {77 88}
|
||||
do_test shared-$av-16.8.3 {
|
||||
list [catch {db1 eval { INSERT INTO yy VALUES(1, 2) }} msg] $msg
|
||||
} {1 {attempt to write a readonly database}}
|
||||
|
||||
db1 close
|
||||
db2 close
|
||||
|
||||
} ;# end of autovacuum on/off loop
|
||||
|
||||
sqlite3_enable_shared_cache $::enable_shared_cache
|
||||
finish_test
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
# 2012 May 15
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
#
|
||||
# The tests in this file are intended to show that closing one database
|
||||
# connection to a shared-cache while there exist other connections (a)
|
||||
# does not cause the schema to be reloaded and (b) does not cause any
|
||||
# other problems.
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
ifcapable !shared_cache { finish_test ; return }
|
||||
set testprefix shared8
|
||||
|
||||
db close
|
||||
set ::enable_shared_cache [sqlite3_enable_shared_cache 1]
|
||||
do_test 0.0 { sqlite3_enable_shared_cache } {1}
|
||||
|
||||
proc roman {n} {
|
||||
array set R {1 i 2 ii 3 iii 4 iv 5 v 6 vi 7 vii 8 viii 9 ix 10 x}
|
||||
set R($n)
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# The following tests work as follows:
|
||||
#
|
||||
# 1.0: Open connection [db1] and populate the database.
|
||||
#
|
||||
# 1.1: Using "PRAGMA writable_schema", destroy the database schema on
|
||||
# disk. The schema is still in memory, so it is possible to keep
|
||||
# using it, but any attempt to reload it from disk will fail.
|
||||
#
|
||||
# 1.3-4: Open connection db2. Check that it can see the db schema. Then
|
||||
# close db1 and check that db2 still works. This shows that closing
|
||||
# db1 did not reset the in-memory schema.
|
||||
#
|
||||
# 1.5-7: Similar to 1.3-4.
|
||||
#
|
||||
# 1.8: Close all database connections (deleting the in-memory schema).
|
||||
# Then open a new connection and check that it cannot read the db.
|
||||
#
|
||||
do_test 1.0 {
|
||||
sqlite3 db1 test.db
|
||||
db1 func roman roman
|
||||
execsql {
|
||||
CREATE TABLE t1(a, b);
|
||||
INSERT INTO t1 VALUES(1, 1);
|
||||
INSERT INTO t1 VALUES(2, 2);
|
||||
INSERT INTO t1 VALUES(3, 3);
|
||||
INSERT INTO t1 VALUES(4, 4);
|
||||
CREATE VIEW v1 AS SELECT a, roman(b) FROM t1;
|
||||
SELECT * FROM v1;
|
||||
} db1
|
||||
} {1 i 2 ii 3 iii 4 iv}
|
||||
|
||||
do_test 1.1 {
|
||||
execsql {
|
||||
PRAGMA writable_schema = 1;
|
||||
DELETE FROM sqlite_master WHERE 1;
|
||||
PRAGMA writable_schema = 0;
|
||||
SELECT * FROM sqlite_master;
|
||||
} db1
|
||||
} {}
|
||||
|
||||
do_test 1.2 {
|
||||
execsql { SELECT * FROM v1 } db1
|
||||
} {1 i 2 ii 3 iii 4 iv}
|
||||
|
||||
do_test 1.3 {
|
||||
sqlite3 db2 test.db
|
||||
db2 func roman roman
|
||||
execsql { SELECT * FROM v1 } db2
|
||||
} {1 i 2 ii 3 iii 4 iv}
|
||||
|
||||
do_test 1.4 {
|
||||
db1 close
|
||||
execsql { SELECT * FROM v1 } db2
|
||||
} {1 i 2 ii 3 iii 4 iv}
|
||||
|
||||
do_test 1.5 {
|
||||
sqlite3 db3 test.db
|
||||
db3 func roman roman
|
||||
execsql { SELECT * FROM v1 } db3
|
||||
} {1 i 2 ii 3 iii 4 iv}
|
||||
|
||||
do_test 1.6 {
|
||||
execsql { SELECT * FROM v1 } db2
|
||||
} {1 i 2 ii 3 iii 4 iv}
|
||||
|
||||
do_test 1.7 {
|
||||
db2 close
|
||||
execsql { SELECT * FROM v1 } db3
|
||||
} {1 i 2 ii 3 iii 4 iv}
|
||||
|
||||
do_test 1.8 {
|
||||
db3 close
|
||||
sqlite3 db4 test.db
|
||||
catchsql { SELECT * FROM v1 } db4
|
||||
} {1 {no such table: v1}}
|
||||
|
||||
|
||||
foreach db {db1 db2 db3 db4} { catch { $db close } }
|
||||
sqlite3_enable_shared_cache $::enable_shared_cache
|
||||
finish_test
|
||||
|
||||
+1
-1
@@ -283,7 +283,7 @@ do_test shell1-3.2.4 {
|
||||
# .databases List names and files of attached databases
|
||||
do_test shell1-3.3.1 {
|
||||
catchcmd "-csv test.db" ".databases"
|
||||
} "/0 +.*main +[string map {/ .} [string range [pwd] 0 10]].*/"
|
||||
} "/0 +.*main +[string map {/ .} [string range [get_pwd] 0 10]].*/"
|
||||
do_test shell1-3.3.2 {
|
||||
# too many arguments
|
||||
catchcmd "test.db" ".databases BAD"
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#
|
||||
# Commands to manipulate the db and the file-system at a high level:
|
||||
#
|
||||
# is_relative_file
|
||||
# test_pwd
|
||||
# get_pwd
|
||||
# copy_file FROM TO
|
||||
# delete_file FILENAME
|
||||
@@ -212,6 +214,34 @@ proc do_copy_file {force from to} {
|
||||
}
|
||||
}
|
||||
|
||||
# Check if a file name is relative
|
||||
#
|
||||
proc is_relative_file { file } {
|
||||
return [expr {[file pathtype $file] != "absolute"}]
|
||||
}
|
||||
|
||||
# If the VFS supports using the current directory, returns [pwd];
|
||||
# otherwise, it returns only the provided suffix string (which is
|
||||
# empty by default).
|
||||
#
|
||||
proc test_pwd { args } {
|
||||
if {[llength $args] > 0} {
|
||||
set suffix1 [lindex $args 0]
|
||||
if {[llength $args] > 1} {
|
||||
set suffix2 [lindex $args 1]
|
||||
} else {
|
||||
set suffix2 $suffix1
|
||||
}
|
||||
} else {
|
||||
set suffix1 ""; set suffix2 ""
|
||||
}
|
||||
ifcapable curdir {
|
||||
return "[get_pwd]$suffix1"
|
||||
} else {
|
||||
return $suffix2
|
||||
}
|
||||
}
|
||||
|
||||
# Delete a file or directory
|
||||
#
|
||||
proc delete_file {args} {
|
||||
|
||||
+15
-2
@@ -52,11 +52,24 @@ foreach {tn uri file} {
|
||||
16 file://localhostPWD/test.db%3Fhello test.db?hello
|
||||
} {
|
||||
|
||||
|
||||
ifcapable !curdir { if {$tn==3} break }
|
||||
|
||||
if {$tcl_platform(platform)=="windows"} {
|
||||
#
|
||||
# NOTE: Due to limits on legal characters for file names imposed by
|
||||
# Windows, we must skip the final two tests here (i.e. the
|
||||
# question mark is illegal in a file name on Windows).
|
||||
#
|
||||
if {$tn>14} break
|
||||
set uri [string map [list PWD /[get_pwd]] $uri]
|
||||
|
||||
#
|
||||
# NOTE: On Windows, we need to account for the fact that the current
|
||||
# directory does not start with a forward slash.
|
||||
#
|
||||
set uri [string map [list PWD/ /[test_pwd /]] $uri]
|
||||
} else {
|
||||
set uri [string map [list PWD [get_pwd]] $uri]
|
||||
set uri [string map [list PWD/ [test_pwd /]] $uri]
|
||||
}
|
||||
|
||||
if {[file isdir $file]} {error "$file is a directory"}
|
||||
|
||||
@@ -1222,6 +1222,10 @@ do_test vtab1-17.1 {
|
||||
}
|
||||
} {}
|
||||
|
||||
do_test vtab1-17.2 {
|
||||
execsql { DELETE FROM sqlite_master WHERE sql LIKE 'insert%' }
|
||||
} {}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# The following tests - vtab1-18.* - test that the optimization of LIKE
|
||||
# constraints in where.c plays well with virtual tables.
|
||||
@@ -1275,4 +1279,18 @@ foreach {tn sql res filter} {
|
||||
}
|
||||
do_execsql_test 18.2.x { PRAGMA case_sensitive_like = OFF }
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Test that an existing module may not be overridden.
|
||||
#
|
||||
do_test 19.1 {
|
||||
sqlite3 db2 test.db
|
||||
register_echo_module [sqlite3_connection_pointer db2]
|
||||
} SQLITE_OK
|
||||
do_test 19.2 {
|
||||
register_echo_module [sqlite3_connection_pointer db2]
|
||||
} SQLITE_MISUSE
|
||||
do_test 19.3 {
|
||||
db2 close
|
||||
} {}
|
||||
|
||||
finish_test
|
||||
|
||||
+5
-1
@@ -1478,7 +1478,11 @@ foreach pgsz {512 1024 2048 4096 8192 16384 32768 65536} {
|
||||
# Test that when 1 or more pages are recovered from a WAL file,
|
||||
# sqlite3_log() is invoked to report this to the user.
|
||||
#
|
||||
set walfile [file nativename [file join [get_pwd] test.db-wal]]
|
||||
ifcapable curdir {
|
||||
set walfile [file nativename [file join [get_pwd] test.db-wal]]
|
||||
} else {
|
||||
set walfile test.db-wal
|
||||
}
|
||||
catch {db close}
|
||||
forcedelete test.db
|
||||
do_test wal-23.1 {
|
||||
|
||||
Reference in New Issue
Block a user