On 09/19/2014 02:53 PM, Paul wrote:
Paul wrote:
My goal is to make structure initialization of an *abstract* database atomic.
[...] if database file is missing it must be created and initialized.
<http://www.sqlite.org/transactional.html>
Just do the check for the database structure and the initialization inside
a transaction.
Yeah, but you didn't read my statements carefully. I was talking about an
abstract database.
It's wrappers responsibility to call *on_create* so it's wrappers
responsibility to check.
How do you check if structure is initializad in an abstract databse?
SQLITE_OPEN_EXCLUSIVE
This flag does not mean what you think it means, and is used only
internally; you are not allowed to use it.
Anyway, transactions are automatically exclusive.
I think I know what it means:
**The SQLITE_OPEN_EXCLUSIVE flag is always used in conjunction with the
SQLITE_OPEN_CREATE flag, which are both directly analogous to the O_EXCL and
O_CREAT flags of the POSIX open() API. The SQLITE_OPEN_EXCLUSIVE flag, when
paired with the SQLITE_OPEN_CREATE, is used to indicate that file should always
be created, and that it is an error if it already exists. It is not used to
indicate the file should be opened for exclusive access.**
This is from <http://www.sqlite.org/capi3ref.html>
Please explain, why am I not allowed to use it in sqlite3_open_v2()?
Because the docs for open_v2() state, somewhat ominously, that the
results will be undefined:
http://www.sqlite.org/c3ref/mark/open.html?The%20sqlite3_open_v2&If+the+3rd*undefined#mark
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users