That approach isn't race-safe, though.

Why does SQLite not allow open via O_EXCL?

-FG

Sent from my android device.

-----Original Message-----
From: Simon Slavin <slav...@bigfraud.org>
To: General Discussion of SQLite Database <sqlite-users at 
mailinglists.sqlite.org>
Sent: Sun, 15 Mar 2015 7:44 AM
Subject: Re: [sqlite] SQLITE_OPEN_EXCLUSIVE


On 15 Mar 2015, at 6:06am, Felipe Gasper <felipe at felipegasper.com> wrote:

> is this how I can say, ?open a database, but only if it?s a new database??

There is no mode in SQLite which does that.  You can tell it to do the opposite 
(only open an existing file, return an error if no file exists) but not the way 
you asked about.

You will have to use file operations to find out whether the file already 
exists.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users at mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to