Among the appropriate uses for sqlite3 is "in-memory databases". This seems like a very helpful tool for my C++ programs. Does anybody have a good example of how this really is completed in C or C++? I am particularly searching for a canonical method to slurp several flat-files into an in-memory database, then perform some joins.
It's really really simple. Just specify ':memory:' because the database filename when opening a database while using C/C++ API. It is a special constant the engine will recognize. Exactly the same really works best for other languages for example Python or Ruby, given that they typically just wrap the C/C++ API. See http://sqlite.org/c3ref/open.html for complete particulars.
Just open the file :memory: which must do it (a minimum of it will in PHP).
You mention that you would like to see in a number of flat files and do joins in it. If you can keep flat files as SQLite databases, you are able to work directly with both by affixing together:
ATTACH foo.db AS foo
Then make reference to the tables in foo like so:
SELECT * FROM foo.users
By doing this that you can do your joins without resorting to creating an in-memory database.
If you would like SQLite not to use temporary files as journals, e.g, you wouldn't want any file activity apart from whenever you by hand demands a connect, disconnect, attach or remove. Then make use of the following two pragmas at runtime once you connect with your ":memory:" database.
PRAGMA temp_store=MEMORY; PRAGMA journal_mode=MEMORY;
In the docs.