Re: [sqlite] vfs implementation question

2008-08-19 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Jeffrey Becker wrote:
> Cool.  I'm actually working on extending Robert Simson's ADO.Net
> provider to allow vfs implementations to be written in managed code.

I'm doing the same in my Python wrapper for SQLite (APSW).  One feature
I have implemented is that the VFS can inherit from an existing one.
That makes it easier for the developer to do things like a VFS that is
like an existing one, but with only specified changes.  For example you
could easily make one that obfuscates the file by xoring the data with a
constant by writing about 10 lines of code.  To make testing easier you
can make an xWrite that will do I/O errors on demand to verify your own
code can handle SQLite telling you there was an I/O error.

Roger
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFIq2zZmOOfHg372QQRApzOAJ9W2sGJe7iwk3B9XlzuWEJol/FQXgCg48qu
ExBykKM3fDTqrUtwgBSU7zc=
=zx60
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] vfs implementation question

2008-08-19 Thread Jeffrey Becker
Cool.  I'm actually working on extending Robert Simson's ADO.Net
provider to allow vfs implementations to be written in managed code.
I hope to get at least two custom vfs implementations into his
codebase, a custom memory backed vfs and a true client-server vfs.

On Tue, Aug 19, 2008 at 5:45 PM, Richard Klein
<[EMAIL PROTECTED]> wrote:
> D. Richard Hipp wrote:
>> On Aug 19, 2008, at 9:02 AM, Jeffrey Becker wrote:
>>
>>
>>> Should the xLock member of sqlite3_io_methods object block until the
>>> lock can be acquired?
>>
>> xLock does not block on any of the built-in VFSes.  But if you want to
>> make your own custom VFS that blocks on locks, I don't  know of any
>> reason why that wouldn't work.
> I wrote a custom VFS that blocks on locks, and it works just fine.
>
> I also implemented a subset of the five locking levels of SQLite:
> just UNLOCKED and EXCLUSIVE.  This means that as soon as a transaction
> asks for a SHARED lock, it actually gets an EXCLUSIVE lock, which
> locks out all other transactions until the first one commits.
>
> This works fine in an embedded application where there are only a
> few threads, whose transactions execute quickly.
>
> - Richard Klein
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] vfs implementation question

2008-08-19 Thread Richard Klein
D. Richard Hipp wrote:
> On Aug 19, 2008, at 9:02 AM, Jeffrey Becker wrote:
>
>   
>> Should the xLock member of sqlite3_io_methods object block until the
>> lock can be acquired?
>
> xLock does not block on any of the built-in VFSes.  But if you want to  
> make your own custom VFS that blocks on locks, I don't  know of any  
> reason why that wouldn't work.
I wrote a custom VFS that blocks on locks, and it works just fine.

I also implemented a subset of the five locking levels of SQLite:
just UNLOCKED and EXCLUSIVE.  This means that as soon as a transaction
asks for a SHARED lock, it actually gets an EXCLUSIVE lock, which
locks out all other transactions until the first one commits.

This works fine in an embedded application where there are only a
few threads, whose transactions execute quickly.

- Richard Klein

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] vfs implementation question

2008-08-19 Thread D. Richard Hipp

On Aug 19, 2008, at 9:37 AM, Jeffrey Becker wrote:

> So in the cases where the lock cant be acquired, the built in vfs
> implementations return SQLITE_BUSY?
>

Yes

D. Richard Hipp
[EMAIL PROTECTED]



___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] vfs implementation question

2008-08-19 Thread Jeffrey Becker
So in the cases where the lock cant be acquired, the built in vfs
implementations return SQLITE_BUSY?

On Tue, Aug 19, 2008 at 9:16 AM, D. Richard Hipp <[EMAIL PROTECTED]> wrote:
>
> On Aug 19, 2008, at 9:02 AM, Jeffrey Becker wrote:
>
>> Should the xLock member of sqlite3_io_methods object block until the
>> lock can be acquired?
>
> xLock does not block on any of the built-in VFSes.  But if you want to
> make your own custom VFS that blocks on locks, I don't  know of any
> reason why that wouldn't work.
>
> D. Richard Hipp
> [EMAIL PROTECTED]
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] vfs implementation question

2008-08-19 Thread D. Richard Hipp

On Aug 19, 2008, at 9:02 AM, Jeffrey Becker wrote:

> Should the xLock member of sqlite3_io_methods object block until the
> lock can be acquired?

xLock does not block on any of the built-in VFSes.  But if you want to  
make your own custom VFS that blocks on locks, I don't  know of any  
reason why that wouldn't work.

D. Richard Hipp
[EMAIL PROTECTED]



___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] vfs implementation question

2008-08-19 Thread Jeffrey Becker
Should the xLock member of sqlite3_io_methods object block until the
lock can be acquired?
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users