I'm thinking I could use something like:

SQLITE_API int sqlite3_attach(sqlite3* db, const char* zPath, const
char* dbname);
SQLITE_API int sqlite3_detach(sqlite3* db, const char* dbname);

Right now, I have a helper in Chromium which does "ATTACH DATABASE ?
AS ?".  This works, but AFAICT this page:
   https://www.sqlite.org/lang_keywords.html
implies that the dbname _probably_ should not be a string literal but
instead an identifier.  So it should be "dbname" with embedded "
characters doubled (nobody should ever do that, but *shrug*).

WDYT?  Mostly this just came up because I saw someone writing code
which constructed things sprintf-style, without quoting, which was
clearly error-prone.  But in describing the right way to do it, I had
to do notable hand-waving.

Thanks,
scott

Reply via email to