0
0
mirror of https://github.com/tursodatabase/libsql.git synced 2025-06-16 20:19:42 +00:00

Have OTA always specify SQLITE_CONFIG_URI when opening databases. Fix a test issue causing otacrash.test to fail.

FossilOrigin-Name: 0d0e5ec064eaecb200b9b601b7a54a1700cd176e
This commit is contained in:
dan
2015-04-17 08:36:05 +00:00
parent 5c06dd831f
commit ec16d98489
6 changed files with 30 additions and 17 deletions

@ -16,6 +16,12 @@ if {![info exists testdir]} {
source $testdir/tester.tcl
set ::testprefix otacrash
db close
forcedelete test.db-oal ota.db
sqlite3_shutdown
sqlite3_config_uri 1
reset_db
# Set up a target database and an ota update database. The target
# db is the usual "test.db", the ota db is "test.db2".
#
@ -109,7 +115,9 @@ proc do_ota_crash_test {tn nPre nStep} {
ota close
}
set res [crashsql -file test.db2 -delay $iDelay -tclbody $script {}]
set res [
crashsql -file test.db2 -delay $iDelay -tclbody $script -opendb {} {}
]
set bDone 1
if {$res == "1 {child process exited abnormally}"} {

@ -1768,7 +1768,7 @@ static int otaGetUpdateStmt(
static sqlite3 *otaOpenDbhandle(sqlite3ota *p, const char *zName){
sqlite3 *db = 0;
if( p->rc==SQLITE_OK ){
const int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE;
const int flags = SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|SQLITE_OPEN_URI;
p->rc = sqlite3_open_v2(zName, &db, flags, p->zVfsName);
if( p->rc ){
p->zErrmsg = sqlite3_mprintf("%s", sqlite3_errmsg(db));

@ -237,7 +237,10 @@ typedef struct sqlite3ota sqlite3ota;
**
** Argument zTarget is the path to the target database. Argument zOta is
** the path to the OTA database. Each call to this function must be matched
** by a call to sqlite3ota_close().
** by a call to sqlite3ota_close(). When opening the databases, OTA passes
** the SQLITE_CONFIG_URI flag to sqlite3_open_v2(). So if either zTarget
** or zOta begin with "file:", it will be interpreted as an SQLite
** database URI, not a regular file name.
**
** By default, OTA uses the default VFS to access the files on disk. To
** use a VFS other than the default, an SQLite "file:" URI containing a

@ -1,5 +1,5 @@
C Be\ssure\sto\srelease\sany\sxShmLock\slocks\sheld\swhen\sclosing\san\sOTA\shandle.
D 2015-04-16T18:49:53.533
C Have\sOTA\salways\sspecify\sSQLITE_CONFIG_URI\swhen\sopening\sdatabases.\sFix\sa\stest\sissue\scausing\sotacrash.test\sto\sfail.
D 2015-04-17T08:36:05.998
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 79b306896135a2305cfb7e6d88990fc4820fb917
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -135,11 +135,11 @@ F ext/ota/ota7.test 1fe2c5761705374530e29f70c39693076028221a
F ext/ota/ota8.test cd70e63a0c29c45c0906692827deafa34638feda
F ext/ota/ota9.test d3eee95dd836824d07a22e5efcdb7bf6e869358b
F ext/ota/otaA.test ab67f7f53670b81c750dcc946c5b704f51c429a4
F ext/ota/otacrash.test a078d34e2edbcedac5f894e3e7d08d452a327007
F ext/ota/otacrash.test 8346192b2d46cbe7787d5d65904d81d3262a3cbf
F ext/ota/otafault.test 8c43586c2b96ca16bbce00b5d7e7d67316126db8
F ext/ota/otafault2.test fa202a98ca221faec318f3e5c5f39485b1256561
F ext/ota/sqlite3ota.c 424d4b9a010a836003e3eab6d84d37774cb620ed
F ext/ota/sqlite3ota.h f1a9dd98b00fa622c7e2eb68e580ee02e194c4d6
F ext/ota/sqlite3ota.c 725e87f0f5f97b6521cfe15e53a420af2974dbeb
F ext/ota/sqlite3ota.h 5b1453917e955701b0232c0dfb0884b3d598feb1
F ext/ota/test_ota.c e34c801c665d64b4b9e00b71f1acf8c652404b2b
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
F ext/rtree/rtree.c 14e6239434d4e3f65d3e90320713f26aa24e167f
@ -934,7 +934,7 @@ F test/tclsqlite.test 7fb866443c7deceed22b63948ccd6f76b52ad054
F test/tempdb.test 19d0f66e2e3eeffd68661a11c83ba5e6ace9128c
F test/temptable.test d2c9b87a54147161bcd1822e30c1d1cd891e5b30
F test/temptrigger.test 8ec228b0db5d7ebc4ee9b458fc28cb9e7873f5e1
F test/tester.tcl ed77454e6c7b40eb501db7e79d1c6fbfd3eebbff
F test/tester.tcl fd6771cc46ab13313ec6c9b602ffcd6876c8413f
F test/thread001.test 9f22fd3525a307ff42a326b6bc7b0465be1745a5
F test/thread002.test e630504f8a06c00bf8bbe68528774dd96aeb2e58
F test/thread003.test ee4c9efc3b86a6a2767516a37bd64251272560a7
@ -1269,7 +1269,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P 5db810a88dac5cbf1f6b321345d01cc0d9d05d31
R c5895a3241a2de3944e668930a0eb998
P d0fba72a47f73082ade40a732aab114bc8f6d83e
R 5df3a54f3cd4535cbda82e7ad6f8185e
U dan
Z dc29da0591555b6f4d89a9eb4ca47d9d
Z 78b848ba36b0ed64cc210670080470ec

@ -1 +1 @@
d0fba72a47f73082ade40a732aab114bc8f6d83e
0d0e5ec064eaecb200b9b601b7a54a1700cd176e

@ -1309,14 +1309,16 @@ proc crashsql {args} {
puts $f "sqlite3_crash_enable 1"
puts $f "sqlite3_crashparams $blocksize $dc $crashdelay $cfile"
puts $f "sqlite3_test_control_pending_byte $::sqlite_pending_byte"
puts $f $opendb
# This block sets the cache size of the main database to 10
# pages. This is done in case the build is configured to omit
# "PRAGMA cache_size".
puts $f {db eval {SELECT * FROM sqlite_master;}}
puts $f {set bt [btree_from_db db]}
puts $f {btree_set_cache_size $bt 10}
if {$opendb!=""} {
puts $f $opendb
puts $f {db eval {SELECT * FROM sqlite_master;}}
puts $f {set bt [btree_from_db db]}
puts $f {btree_set_cache_size $bt 10}
}
if {$prngseed} {
set seed [expr {$prngseed%10007+1}]