X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:content-type
	:content-transfer-encoding; q=dns; s=default; b=C9wuwfVEub9oiquO
	JTvob4eQ9rSxePb7nv6w4xx1O/Tn9BF9hXuoQxdzCODq7d4e19szx5Ii9/IUcZfI
	GHc2f1TI0/rHEbz4xgM3uuMe0EvT4yEtKkBIKdMFjjGFipYfriJXj7gHvN7l+qj7
	uS/N3oXs/q8HrGmtsKWOASwJYTs=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:content-type
	:content-transfer-encoding; s=default; bh=rNIZ1rc+Q7hLnXnrhR/BIS
	fMqtU=; b=WiZ2snHVD04R0nCRPt/jNLetnaro50oB62Tp8shsnWj8p2g1PJLwgJ
	nKJmVzPCvdpZstPR2oLRZE0Pneh8s839uKhCfgWPp7V77BHhmIZYJrBZDAbLFI1Q
	AYsX4BCRSaAtrX7SOpF5zK7RHoTdF8Y9mUA2DM7UQbSRDqy3htpOY=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2
X-HELO: mail-la0-f41.google.com
MIME-Version: 1.0
X-Received: by 10.152.6.8 with SMTP id w8mr36068990law.41.1421058510430; Mon, 12 Jan 2015 02:28:30 -0800 (PST)
In-Reply-To: <3949B731-0E84-464F-A5D7-837D31ABF25E@etr-usa.com>
References: <CAO1jNws2XKcySKD0Lzi-C2hWS=pcdHQ7sCSNJADU4qEtgej28A@mail.gmail.com>	<3949B731-0E84-464F-A5D7-837D31ABF25E@etr-usa.com>
Date: Mon, 12 Jan 2015 11:28:30 +0100
Message-ID: <CAO1jNwto=M6YZ_Q-zY-qcBVvWLNkTnyrPSPticUywSg3pWjW4Q@mail.gmail.com>
Subject: Re: Updated: sqlite3-3.8.7.2-1 for Cygwin/Cygwin64
From: Jan Nijtmans <jan.nijtmans@gmail.com>
To: cygwin@cygwin.com
Content-Type: text/plain; charset=UTF-8
X-IsSubscribed: yes
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id t0CASqMO023830

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


