I would start with an existing VFS implementation and modify it to use 
the primitives available to you.  I started with the OS_WIN and modified 
it.  That will probably be easier than starting from scratch.

You can switch VFSs with each open.  You can use a different one for 
each DB open if you like.  (I do that now.)  I don't think you can 
switch the VFS for a given DB handle once it is opened.  You will 
probably have to close it and reopen.

Note that you can also, via #define values, exclude the pre-defined VFS 
implementations and just use your own.

Brown, Daniel wrote:
> Thanks for the pointers Roger and the example tests.  
>
> Is it possible to change the VFS SQLite is using while SQLite is
> running?  I'm looking at creating two different VFS implementations and
> it would be great to be able to switch between implementations as
> required, I'd be looking to switch VFS during program start-up and
> before any databases are loaded or used.
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Roger Binns
> Sent: Tuesday, November 04, 2008 12:39 PM
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] VFS implementation guidance
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Brown, Daniel wrote:
>   
>> Are there any guides to implementing a VFS (sqlite3_vfs) for SQLite?
>>     
> A
>   
>> good practices guide would be as useful.   I already have an existing
>> file system API/library for the target system so I guess it is mostly
>> just matching up the API with the VFS implementation via some wrapper
>> functions?
>>     
>
> Pretty much just implement the functions as documented.  One gotcha is
> that xRandomness is only called once and is only called on the default
> VFS which makes testing it fun.
>
> Another is that xGetLastError is never called so you don't need to
> implement it.  http://www.sqlite.org/cvstrac/tktview?tn=3337
>
> You then need to run queries that exercise all parts of the VFS.  If you
> want some guidance, this is what I use:
>
> http://code.google.com/p/apsw/source/browse/apsw/trunk/tests.py#4759
>
> Roger
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAkkQssUACgkQmOOfHg372QTuLwCgygTWzPSW3CCHnQONXiEcKXf7
> 5XEAnR7DYzMf+hvXCORi/I/hpWgWF/t3
> =3tEY
> -----END PGP SIGNATURE-----
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>   
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to