}
}
+/*
+** This routine is a copy of the sqlite3FileSuffix3() routine from the core.
+** It is a no-op unless SQLITE_ENABLE_8_3_NAMES is defined.
+**
+** If SQLITE_ENABLE_8_3_NAMES is set at compile-time and if the database
+** filename in zBaseFilename is a URI with the "8_3_names=1" parameter and
+** if filename in z[] has a suffix (a.k.a. "extension") that is longer than
+** three characters, then shorten the suffix on z[] to be the last three
+** characters of the original suffix.
+**
+** If SQLITE_ENABLE_8_3_NAMES is set to 2 at compile-time, then always
+** do the suffix shortening regardless of URI parameter.
+**
+** Examples:
+**
+** test.db-journal => test.nal
+** test.db-wal => test.wal
+** test.db-shm => test.shm
+** test.db-mj7f3319fa => test.9fa
+*/
+static void otaFileSuffix3(const char *zBase, char *z){
+#ifdef SQLITE_ENABLE_8_3_NAMES
+#if SQLITE_ENABLE_8_3_NAMES<2
+ if( sqlite3_uri_boolean(zBase, "8_3_names", 0) )
+#endif
+ {
+ int i, sz;
+ sz = sqlite3Strlen30(z);
+ for(i=sz-1; i>0 && z[i]!='/' && z[i]!='.'; i--){}
+ if( z[i]=='.' && ALWAYS(sz>i+4) ) memmove(&z[i+1], &z[sz-3], 4);
+ }
+#endif
+}
+
/*
** Move the "*-oal" file corresponding to the target database to the
** "*-wal" location. If an error occurs, leave an error code and error
** message in the ota handle.
*/
-static void otaMoveOalFile(sqlite3ota *p){
+static void otaMoveOalFile(const char *zBase, sqlite3ota *p){
char *zWal = sqlite3_mprintf("%s-wal", p->zTarget);
char *zOal = sqlite3_mprintf("%s-oal", p->zTarget);
if( zWal==0 || zOal==0 ){
p->rc = SQLITE_NOMEM;
}else{
+ otaFileSuffix3(zBase, zWal);
+ otaFileSuffix3(zBase, zOal);
rename(zOal, zWal);
}
int sqlite3ota_close(sqlite3ota *p, char **pzErrmsg){
int rc;
if( p ){
+ const char *zBase = sqlite3_db_filename(p->db, "main");
/* If the update has not been fully applied, save the state in
** the ota db. If successful, this call also commits the open
/* If the OTA has been completely applied and no error occurred, move
** the *-oal file to *-wal. */
if( p->rc==SQLITE_DONE ){
- otaMoveOalFile(p);
+ otaMoveOalFile(zBase, p);
}
rc = p->rc;
-C Use\squotes\sinstead\sof\sangle-brackets\sto\sinclude\ssqlite3.h\sfrom\ssqlite3ota.h.
-D 2014-09-18T16:38:10.149
+C Update\sthe\sota\sextension\sto\ssupport\sSQLITE_ENABLE_8_3_NAMES\sbuilds.
+D 2014-09-18T17:57:46.895
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in cf57f673d77606ab0f2d9627ca52a9ba1464146a
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F ext/ota/ota2.test 716f9c66e8bf8b0ad2fe3a5d8323e6cf460a2e27
F ext/ota/ota3.test 1c48b7476af1c5920db9a43e7b1476d421a463b5
F ext/ota/ota4.test baf23b47748a5056c713871959cc70fc623c90e9
-F ext/ota/sqlite3ota.c 4b7f15662e725bd79c92242293336d74ebeff854
+F ext/ota/sqlite3ota.c b22002105b3b7f3baf63bda2b4e6a00c4973418c
F ext/ota/sqlite3ota.h 7b20abe9247d292429d00f0a5c237ff6e0dc0196
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
F ext/rtree/rtree.c 57bec53e1a677ab74217fe1f20a58c3a47261d6b
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 0da1862b1b68f15c7c14286a982dda886d1e3b4a
-R e1133f29a6887c2dcc50626f2201457f
+P fce9c6ccf101d28492a84b85463433f32ef569fb
+R feab70887c117c061b61fe713ccedbe4
U dan
-Z d4fc012b67241f1149bf53ab8b647500
+Z 86cf672a01ea748dc788d9b12ee5fdc1