On Sunday, 25 January 2015 at 18:15:21 UTC, Paul wrote:
I'd like to vary the query based on input but if I try to move
the string out of the sqlite3_exec call like this:
string sqlStatement = "CREATE TABLE people(id INT PRIMARY KEY
NOT NULL, surname TEXT NOT NULL);";
result = sqlite3_exec(db, sqlStatement, &aCallback, null, &msg);
...it won't compile:
Error: function etc.c.sqlite3.sqlite3_exec (sqlite3*,
const(char)* sql,...
is not callable using argument types (sqlite3*, string,...
I can assign using:
const char *sqlStatement = "CREATE TABLE...
So how do I get a constant character pointer that can be
modified at runtime?
Paul
Only string literals convert to const(char)*, because only for
them it is guaranteed that they are null terminated. For
everything else use toStringz.