<story><title>VFS shim that allows a SQLite database to be appended to another file</title><url>https://sqlite.org/src/file/ext/misc/appendvfs.c</url></story><parent_chain><item><author>torstenvl</author><text>It seems like the intended use-case would be for the database to be appended after the executable that is using it. But writing to a file that&amp;#x27;s being executed seems (to my naive view - I&amp;#x27;m not terribly experienced) like it could cause issues.&lt;p&gt;What am I missing?</text></item></parent_chain><comment><author>pjc50</author><text>I&amp;#x27;m going to have to try this, but I suspect such writing won&amp;#x27;t work on Windows, which aggressively locks executables. Maybe it just locks the in-use range and allows appending.&lt;p&gt;On Linux this probably works fine because writing past the executable part of the file does not change any offsets beforehand.&lt;p&gt;(On NFS systems you can definitely overwrite in-use executables at any point, which works until the relevant bit gets paged out then back in)&lt;p&gt;&lt;i&gt;Reading&lt;/i&gt;, on the other hand, ought to work fine everywhere. This continues &amp;quot;SQLite is a replacement for fopen()&amp;quot; - you can use it in similar cases to self-extracting ZIP files or self-executing JAR files.</text></comment>
<story><title>VFS shim that allows a SQLite database to be appended to another file</title><url>https://sqlite.org/src/file/ext/misc/appendvfs.c</url></story><parent_chain><item><author>torstenvl</author><text>It seems like the intended use-case would be for the database to be appended after the executable that is using it. But writing to a file that&amp;#x27;s being executed seems (to my naive view - I&amp;#x27;m not terribly experienced) like it could cause issues.&lt;p&gt;What am I missing?</text></item></parent_chain><comment><author>yellowapple</author><text>I suspect the intent would be an extension of the idea of using SQLite as the base for a custom binary file format.  One use case might be to embed non-code resources (graphics, audio, localization strings, etc.) such that they can be easily queried and loaded via SQLite instead of some other method.</text></comment>