I have a line as such:
string query; query = "insert or replace into TABLEA (a,b,c) values (@a,\"@b\",\"@c\");";
this way I can insert rows in B and C with just a simple replacement:
string instring("I have a 3\" gauge"); string instring2("I am looking for 1/8\" thickness"); Replace(&query, "@a", to_string(1)); Replace(&query, "@b", instring); Replace(&query, "@c", instring2);
So now my query string is:
"insert or replace into TABLEA (a,b,c) values (1,\"I have a 3\" gauge\",\"I am looking for 1/8\" thickness\");";
SQLITE3 gets it, and it looks like this:
insert or replace into TABLEA (a,b,c) values (1,"I have a 3" gauge","I am looking for 1/8" thickness");
The problem is that the lines end prematurely. I tried adding extra escape characters, but that didn't work either.
Right now I am using sqlite3_exec () to accomplish everything. Is there anything else I should do? Is a prepared statement handling what I'm trying to do?
Should I just try it with prepare_v2 and solve the problems?
How do I approach this?