Add experimental support for resolving relative database file paths using a fixed user-defined directory.

FossilOrigin-Name: 7354ae8fd3eccee2cf9f6501da5b1a014c31556f
This commit is contained in:
mistachkin
2012-03-14 00:44:01 +00:00
parent 5ff72401c9
commit a112d140ae
8 changed files with 222 additions and 18 deletions
+40
View File
@@ -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,44 @@ do_test pragma-19.5 {
file tail [lindex [execsql {PRAGMA filename}] 0]
} {test.db}
# 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
finish_test