On 8 Aug 2014, at 8:11am, Paolo Combi <paolo.co...@ipratico.it> wrote:
> thank you so much for your reply , i'm very interesting about close this > connection under iOS because i work together with the guys that do this app. > our problem is do this : > > APP working --> call backup function ->close sqlite-> download sqite -> > reopen sqlite -> APP working To close a connection to a SQLite database file you should Make sure all prepared statements for that connection have had sqlite3_finalize() run on them and returned SQLITE_OK . Then make sure your connection has had sqlite3_close_v2() (or perhaps just sqlite3_close()) run on it and returned SQLITE_OK . Don't just execute the functions, check to see the values they return. If they're not SQLITE_OK produce an error message and don't run the backup function. Once you have closed all connections to a database, SQLite itself will delete the .wal and .shm files. If those files still exist, there is something wrong. If it is simple, check to see whether the -wal file still exists, and if it does, produce an error message and don't run the backup function. The most frequent problem with this under iOS is that the database file was in a folder where the application does not have enough privileges to delete a file. If this happens, read the documentation for iOS working folders again. Once you have found the correct folder to keep the database file in this will work correctly without further problems. When you have finished copying the database file you can, of course, use SQLite to open it again. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users