[sqlite] SQLITE_OPEN_EXCLUSIVE
On 15 March 2015 at 12:54, Felipe Gasper wrote: > This seems to support the idea that O_EXCL is SQLITE_OPEN_EXCLUSIVE..? "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." I think that is pretty explicit. Regards, Simon
[sqlite] SQLITE_OPEN_EXCLUSIVE
On 15 Mar 2015, at 6:06am, Felipe Gasper 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] SQLITE_OPEN_EXCLUSIVE
"Violent agreement". :-) Sent from my android device. -Original Message- From: Simon Davies <simon.james.dav...@gmail.com> To: General Discussion of SQLite Database Sent: Sun, 15 Mar 2015 9:08 AM Subject: Re: [sqlite] SQLITE_OPEN_EXCLUSIVE On 15 March 2015 at 12:54, Felipe Gasper wrote: > This seems to support the idea that O_EXCL is SQLITE_OPEN_EXCLUSIVE..? "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." I think that is pretty explicit. Regards, Simon ___ sqlite-users mailing list sqlite-users at mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] SQLITE_OPEN_EXCLUSIVE
On 15 March 2015 at 06:06, Felipe Gasper wrote: > Hi all, > > Does the SQLITE_OPEN_EXCLUSIVE flag exist as analogous to O_EXCL in > C open()? i.e., is this how I can say, ?open a database, but only if it?s a > new database?? https://www.sqlite.org/capi3ref.html#sqlite3vfsxopen > Thank you! > > -Felipe Gasper > Houston, TX Regards, Simon
[sqlite] SQLITE_OPEN_EXCLUSIVE
This seems to support the idea that O_EXCL is SQLITE_OPEN_EXCLUSIVE..? Sent from my android device. -Original Message- From: Simon Davies <simon.james.dav...@gmail.com> To: General Discussion of SQLite Database Sent: Sun, 15 Mar 2015 4:16 AM Subject: Re: [sqlite] SQLITE_OPEN_EXCLUSIVE On 15 March 2015 at 06:06, Felipe Gasper wrote: > Hi all, > > Does the SQLITE_OPEN_EXCLUSIVE flag exist as analogous to O_EXCL in > C open()? i.e., is this how I can say, ?open a database, but only if it?s a > new database?? https://www.sqlite.org/capi3ref.html#sqlite3vfsxopen > Thank you! > > -Felipe Gasper > Houston, TX Regards, Simon ___ sqlite-users mailing list sqlite-users at mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] SQLITE_OPEN_EXCLUSIVE
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 Sent: Sun, 15 Mar 2015 7:44 AM Subject: Re: [sqlite] SQLITE_OPEN_EXCLUSIVE On 15 Mar 2015, at 6:06am, Felipe Gasper 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
[sqlite] SQLITE_OPEN_EXCLUSIVE
Hi all, Does the SQLITE_OPEN_EXCLUSIVE flag exist as analogous to O_EXCL in C open()? i.e., is this how I can say, ?open a database, but only if it?s a new database?? Thank you! -Felipe Gasper Houston, TX