SQLite VFS implementation guide lines with FOpen*

Viewed 4754

I am about to implement a custom VFS (virtual file system) for a Netburner embedded device (non windows) using FOpen, FRead, FWrite, FSeek, and FClose. I was surprised that i could not find a FOpen* version of the VFS available. It would make it a lot more portable to embedded devices.

I found some information on creating the VFS for SQLite here http://sqlite.org/c3ref/vfs.html but the information is very detailed and I have lots of other questions about the implementation.

I have some example VFS in the SQLite source code for Win, OS2, Linux but they don't have a lot of comments, only source code.

I could use the information provided in the link above and the examples to create my custom VFS but i'm sure that I would miss something if I did it that way.

My questions are:

  • Is there any more documentation about the SQLite VFS that I am missing? Maybe an implementation guide?
  • Is there an Fopen version of the SQLite VFS that is available?
  • Is there a unit testing code available to test my custom SQLite VFS once I have created it?
  • Suggestions, comments, experiences with implementing SQLite VFS that you would like to share.
2 Answers

One option is to use a memory based VFS then simply dump the memory to file when you are done. See: http://article.gmane.org/gmane.comp.db.sqlite.general/46450 for a memory based VFS that already supports serialization/deserialization.

The disadvantage is that you must manually write the file out for it to persist. If your application suddenly dies any intermediate changes to the DB will not be persisted.

Related