On Fri, Nov 29, 2013 at 5:43 AM, L. Wood <lwoo...@live.com> wrote:

> I have made a few experimental observations and I would appreciate your
> thoughts.
>
> 1.
>
> _open() does indeed actually open the main database file. It is left open
> all the way until _close(), when it is actually closed. Correct?
>

I don't remember if it defers opening the file or defers reading the file.
Either way, we reserve the right to change that behavior at any time and
without notice.  You should not depend on it either way.


>
> I ask because someone mentioned before that _open() doesn't really open
> the file - that it only prepares the file for opening at a later time when
> open is actually needed.
>
>
> 2.
>
> If my SQL statements do nothing but read from the database (no writes), I
> can rename/move the main database file any time I wish after _open()
> without any problems whatsoever. Correct?
>

Incorrect.

If some other process starts writing to the file then crashes, your process
will not be able to recover and will end up corrupting the database.


>
>
> 3.
>
> If my SQL statements write to the database and I rename/move the main
> database file just after _open(), the next call to _step() gives me the
> error SQLITE_IOERR.
>
> This happens NOT because the main database file has been renamed/moved.
> Correct?
>
> Rather, this happens because the old path has been saved by SQLite for use
> by the -journal files. The error happens because SQLite cannot match the
> -journal file name and the main database file name (which has now changed).
> But here I'm just guessing. Is this correct? If not, then why exactly does
> the error occur?
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to