问题
How do I connect multiple sqlite files into a single sqlite3* handle, in C/C++? I'm thinking it's possible considering there's a command called ATTACH, but do not know how to do so in C++. Thanks in advance.
Answer (thanks to Robert)
sqlite3_exec(db, "ATTACH 'C:/tmp/tmp.sqlite' as mytmp");
回答1:
Execute the ATTACH DATABASE
SQL command:
ATTACH path_to_database AS database-name
You can then refer to tables in the attached database as:
database-name.table-name
http://www.sqlite.org/lang_attach.html
来源:https://stackoverflow.com/questions/10592292/sqlite-via-c-opening-multiple-sqlite-files