Re: [sqlite] SQLITE_OPEN_WAL

2019-06-06 Thread Wout Mertens
On Thu, Jun 6, 2019 at 10:17 AM Simon Slavin  wrote:

> On 6 Jun 2019, at 9:11am, Wout Mertens  wrote:
>
> > I'd like to create a database in WAL mode if it doesn't exist
>
> Create it without the flag then execute
>
> PRAGMA journal_mode=WAL
>

Ah no, you see, the problem is that I can have multiple processes creating
the file at the same time, and then it gets ugly with SQLITE_CANTOPEN and
SQLITE_BUSY. I'd like to avoid that.

 Thinking about it, I have to handle these cases anyway when opening an
existing DB that's not in WAL mode, but still, it's cleaner to start it in
WAL mode from the get-go.

Wout.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLITE_OPEN_WAL

2019-06-06 Thread Simon Slavin
On 6 Jun 2019, at 9:11am, Wout Mertens  wrote:

> I'd like to create a database in WAL mode if it doesn't exist

Create it without the flag then execute

PRAGMA journal_mode=WAL

The PRAGMA is harmless if the database is already in WAL mode.

If you want to get fussy about it execute

PRAGMA journal_mode

once the database is open, and convert to WAL mode only if you get anything but 
WAL back.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users