Open tim-vk opened 1 year ago
Do you really need to use quotation marks when you're using a prepared statement? Have you tried the following:
SQLite::Statement query(db, R"(ATTACH DATABASE ?)");
query.bind(1, "path/to/database.db");
query.exec();
That is, without using extra quotation marks when you bind the parameter
I'm trying to attach a database and for the life of me: i cannot get it to work.
My first issue: Is it correct that you're not allowed to have quotation (either single or double) around a parameter variable? (
?
).The following throws error 25 (
SQLITE_RANGE
) onquery.bind
:To solve that I tried moving the quotation marks to the string itself. e.g.:
However, this throws error 14 (
SQLITE_CANTOPEN
).If i don't use variables at all it works perfectly!:
Are these some sqlite/sqlitecpp quirks i'm running into or is this just misuse on my side?