Is it possible to attach a named SQLite3 :memory: database using the C API? There is of course sqlite3_open, but how do I set the name to be used in queries? Also, I could attach it by executing the ATTACH DATABASE statement, but then how do I get hold of its DB pointer?
Background:
I am using virtual tables to drive a SQLite interface to a set of external files. I am using SQLite mainly to get access to decent SQL querying and existing drivers for e.g. Python. I have defined a function open_myfiles which currently creates all the virtual tables based on the files in a given directory. The application just has to do SELECT open_myfiles('/path/to/tables') and the database is populated with the correct virtual tables.
However, I am attempting an improvement. Currently, the virtual tables are persisted to the current database and it is difficult to load multiple directories. I think that a better approach would be to attach each directory as a separate, named, :memory: database.