2015-01-10 5:35 GMT+01:00 Warren Young:
> I happened to need to look at the Cygwin/sqlite3.README file today and saw 
> that it talks about changing the locking semantics via the VFS, but it 
> doesn’t describe how to do this.  Do you have to do it via 
> sqlite3_vfs_register() or sqlite3_open_v2()?

Yes, those are the two standard ways, as documented here (section 2.1):
           <http://www.sqlite.org/vfs.html>

> My old environment variable mechanism would let you affect the locking scheme 
> without changing
> any of the calls to SQLite.  Did that get lost with the change to the 
> VFS-based scheme?  I hope not.

If you want to restore the old behavior, just add the following lines somewhere
at the start of your program:
    const char *zVfs = getenv("CYGWIN_SQLITE_LOCKING");
    if (zVfs) {
        sqlite3_vfs *pVfs = sqlite3_vfs_find(zVfs);
        if (pVfs) sqlite3_vfs_register(pVfs, 1);
    }
I will add this hint to the Cygwin/sqlite3.README file. Thanks for the
suggestion!

Some questions, which triggered me to do this:
1) Why is the environment variable named "CYGWIN_SQLITE_LOCKING"? It's not
cygwin-specific (it would work fine on Linux as well) and changing the
default VFS
does more than only change the locking.
2) If there are already 2 ways to switch VFS, why does Cygwin add a 3th one?
3) Why would someone be interested to use a non-defautl VFS anyway? Yes, the
default VFS had bugs in the past, but those are all fixed now.

In the past, sqlite used the "win32" VFS as default, which caused problems. This
was the reason for developing the "unix-cygwin" VFS. Now, Cygwin is in the
convenient position of having two VFS'es which are both fully compliant with
the "unix" VFS except for using the win32 locking in stead. I hope that some day
one of those two solutions will be accepted upstream. Until that
happens, I would
like to keep both of those cygwin-specific VFS's in good shape.

Hope this helps,

Regards,
        Jan Nijtmans

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply via email to