Re: [sqlite] Handling move/rename of an SQLite database file

2013-11-09 Thread Dan Kennedy
On 11/09/2013 06:47 PM, Simon Slavin wrote: On 9 Nov 2013, at 10:07am, Dan Kennedy wrote: On 11/09/2013 04:58 PM, L. Wood wrote: Richard Hipp wrote: Rollback journal files might be closed and reopened. [snip] [snip]* But what about the next open() of a new journal file? Will it use the ne

Re: [sqlite] Handling move/rename of an SQLite database file

2013-11-09 Thread Simon Slavin
On 9 Nov 2013, at 10:07am, Dan Kennedy wrote: > On 11/09/2013 04:58 PM, L. Wood wrote: >>> Richard Hipp wrote: >>> Rollback journal files might be closed and reopened. [snip] >> >> [snip]* But what about the next open() of a new journal file? Will it use >> the new location of the database f

Re: [sqlite] Handling move/rename of an SQLite database file

2013-11-09 Thread Dan Kennedy
On 11/09/2013 04:58 PM, L. Wood wrote: Richard Hipp wrote: Rollback journal files might be closed and reopened. But the main database file is opened once and held open until sqlite3_close() (or DETACH if the file was originally opened using ATTACH). Thanks for this information. But suppose, wh

Re: [sqlite] Handling move/rename of an SQLite database file

2013-11-09 Thread L. Wood
> Richard Hipp wrote: > Rollback journal files might be closed and reopened.  But the main database > file is opened once and held open until sqlite3_close() (or DETACH if the > file was originally opened using ATTACH). Thanks for this information. But suppose, while a journal file is open, it is

Re: [sqlite] Handling move/rename of an SQLite database file

2013-11-07 Thread Simon Slavin
On 7 Nov 2013, at 6:03pm, L. Wood wrote: > I did a simple experiment and got an error from sqlite3_step() after renaming > the file. This is what I did: > > After the call to sqlite3_open(), I halt/sleep my program for 10 seconds to > give me ample time to rename the file. I rename the file.

Re: [sqlite] Handling move/rename of an SQLite database file

2013-11-07 Thread L. Wood
> D. Richard Hipp wrote: > No errors are returned. SQLite never notices that the database file has > been renamed. I did a simple experiment and got an error from sqlite3_step() after renaming the file. This is what I did: After the call to sqlite3_open(), I halt/sleep my program for 10 seconds

Re: [sqlite] Handling move/rename of an SQLite database file

2013-11-07 Thread Simon Slavin
On 7 Nov 2013, at 5:38pm, Richard Hipp wrote: > Rollback journal files might be closed and reopened. Okay. That gives us more of the answer to the original question. Wood, this is the only file that SQLite would care about if moved. And technically you could use NSNotification to tell you i

Re: [sqlite] Handling move/rename of an SQLite database file

2013-11-07 Thread Richard Hipp
On Thu, Nov 7, 2013 at 12:04 PM, Simon Slavin wrote: > > Assuming that the user is using OS X, use of standard VFS, access on a > local disk, no ATTACH, no Jedi mind tricks ... > > Does SQLite ever close and reopen database or journal files between > _open() and _close() ? > Rollback journal fil

Re: [sqlite] Handling move/rename of an SQLite database file

2013-11-07 Thread Simon Slavin
On 7 Nov 2013, at 3:58pm, Richard Hipp wrote: > On Thu, Nov 7, 2013 at 10:31 AM, L. Wood wrote: > >> QUESTION: What error codes can each of the following functions possibly >> return while the database file is renamed/moved during the execution of the >> function? > > No errors are returned.

Re: [sqlite] Handling move/rename of an SQLite database file

2013-11-07 Thread Zsbán Ambrus
On Thu, Nov 7, 2013 at 4:31 PM, L. Wood wrote: > Users could rename/move a database file while my (Mac OS X) program has made > an SQLite connection to the file. I want to handle this properly. One thing you have to be particularly careful about is the extra files sqlite creates next to the data

Re: [sqlite] Handling move/rename of an SQLite database file

2013-11-07 Thread Richard Hipp
On Thu, Nov 7, 2013 at 10:31 AM, L. Wood wrote: > > QUESTION: What error codes can each of the following functions possibly > return while the database file is renamed/moved during the execution of the > function? > No errors are returned. SQLite never notices that the database file has been re

[sqlite] Handling move/rename of an SQLite database file

2013-11-07 Thread L. Wood
Users could rename/move a database file while my (Mac OS X) program has made an SQLite connection to the file. I want to handle this properly. Mac OS X (Unix) has ways to track a file that is renamed/moved, so if I can get enough information about how SQLite works in this regard, handling this