-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/03/2010 12:25 AM, Pierre KRIEGER wrote:
> I made my own implementation 

You claim that documentation is missing.  Specifically what was not
documented?  BTW for SQLITE_GET_LOCKPROXYFILE just Google "sqlite
SQLITE_GET_LOCKPROXYFILE".  You should just return SQLITE_ERROR for any
filecontrol you do not handle.

> * when you try to open a file named 'f' for example, what other files are 
> being
>     accessed? I noticed 'f-journal' and 'f-wal', are there others?

f-shm.  But wal and shm are only for WAL mode which requires VFS version 2
and you only implement version 1.  Note that it is possible for another
connection to have opened the database in WAL mode and then your code being
called with the same file so SQLite may sniff around the WAL files but not
use them.

> * it is not possible to truncate a stream, so is there a way to be sure that
>     SQLite won't call the xTruncate function?

Not really.  In general you should be able to get by if you write 1024 bytes
of zero bytes from the truncation point onwards.

Also note that xTruncate may be called to make a file longer.

> * when you close a file other than the main database, it gets virtually 
> deleted
>     (even if it didn't have the temporary flag) does SQLite always accept 
> this?

Zero out the beginning 1024 bytes of the deleted file.

> * do you think my code has a chance to be reliable in a real-world project?

Not even close.

The way you would test this is by using the SQLite test suite telling it to
use your vfs.

The first major reason why there would be a problem is that you do not
support locking so if the stream ever referred to a file it would be
possible to corrupt it should another process access the file using the
SQLite library.

Secondly you need to prevent exceptions from happening in any of your VFS
callbacks as they'll unwind the stack and not let SQLite's error recovery run.

For my Python wrapper I provide an API for VFS and a second one for VFSFile
which can then be implemented as needed by the developer.  I'd recommend a
similar approach rather than trying to glue to io::stream directly.

My documentation may also provide some insight:

  http://apidoc.apsw.googlecode.com/hg/vfs.html

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkyon2IACgkQmOOfHg372QRIHwCgteuP7uL0oXOtk3aQ3HnkI+JK
DHIAoLy/m55y0AX7q0Fkbt73fp5F3FL+
=aWfE
-----END PGP SIGNATURE-----
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to