1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03: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

View File

@@ -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}"} {

View File

@@ -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));

View File

@@ -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