** error occurs, leave an error code and message in the OTA handle.
*/
static void otaOpenDatabase(sqlite3ota *p){
+ int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE;
assert( p->rc==SQLITE_OK );
- sqlite3_close(p->db);
- p->db = 0;
+ assert( p->db==0 );
- p->rc = sqlite3_open(p->zTarget, &p->db);
+ p->rc = sqlite3_open_v2(p->zTarget, &p->db, flags, p->zVfsName);
if( p->rc ){
p->zErrmsg = sqlite3_mprintf("%s", sqlite3_errmsg(p->db));
- /* sqlite3_trace(p->db, otaSqlTrace, 0); */
+ }else{
+ otaMPrintfExec(p, "ATTACH %Q AS ota", p->zOta);
+
+ /* Mark the database file just opened as an OTA target database. If
+ ** this call returns SQLITE_NOTFOUND, then the OTA vfs is not in use.
+ ** This is an error. */
+ if( p->rc==SQLITE_OK ){
+ p->rc = sqlite3_file_control(p->db, "main", SQLITE_FCNTL_OTA, (void*)p);
+ if( p->rc==SQLITE_NOTFOUND ){
+ p->rc = SQLITE_ERROR;
+ p->zErrmsg = sqlite3_mprintf("ota vfs not found");
+ }
+ }
}
- otaMPrintfExec(p, "ATTACH %Q AS ota", p->zOta);
}
/*
- C Merge\sthe\scommand-line\sshell\senhancements\sfrom\strunk.
- D 2015-02-06T15:03:45.342
-C Merge\slatest\strunk\schanges\swith\sthis\sbranch.
-D 2015-02-11T16:54:48.127
++C Merge\sthe\sota-update-no-pager_ota_mode\sbranch\sinto\sthis\sone.
++D 2015-02-11T17:05:17.871
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 6b9e7677829aa94b9f30949656e27312aefb9a46
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F ext/ota/ota7.test 1fe2c5761705374530e29f70c39693076028221a
F ext/ota/ota8.test cd70e63a0c29c45c0906692827deafa34638feda
F ext/ota/ota9.test d3eee95dd836824d07a22e5efcdb7bf6e869358b
+ F ext/ota/otaA.test 95566a8d193113867b960eadf85b310937f2fe03
F ext/ota/otafault.test 508ba87c83d632670ac0f94371a465d4bb4d49dd
- F ext/ota/sqlite3ota.c bf417242a191617841cc1ab0815071b49444c9c8
- F ext/ota/sqlite3ota.h b4c54c7df5d223f2ee40efa5ba363188daa3ad37
-F ext/ota/sqlite3ota.c 0ef0f189344b169c9c166bd9fb85793ae2c5968b
++F ext/ota/sqlite3ota.c 466546d41d9b09136216349db98647d0afd77816
+ F ext/ota/sqlite3ota.h 1cc7201086fe65a36957740381485a24738c4077
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
F ext/rtree/rtree.c 14e6239434d4e3f65d3e90320713f26aa24e167f
F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
- P 7f10a0eaf1fedfa020cbd7019ec9342ffdc3b9b0 0f65a7e2e09f801b66897479d501607caeae4abf
- R 1ef390b8e8775fda79ba88277a4a2044
- U drh
- Z f716caa3559c7f56ae8a7035846f96fb
-P 6fc5d4d26a603b3906f02ceea0f507780d0c35eb 24e78b8d65734a6a8ae21a20542cd1839e756fb1
-R fb939d4eb119b38004785cfc38a020ff
++P c3931db560ab4a2601c7f7318fb02c8d5e6862b1 0b63e8dcbaec5043e353734e684c2a46552a3409
++R f20bdc7a7c21af7b4cb60f763acf418a
+ U dan
-Z ef20780a933decd4d3a7bbad742f919b
++Z 0a34d9bc8960589f0668f7402b31b0ce