I am trying to bind wide string to sqlite3 prepared statement. I was trying to follow this answer, but it didn't work
const auto sql_command = L"SELECT * FROM register_names WHERE name is ?VVV";
sqlite3_stmt *statement;
sqlite3_prepare16(db, sql_command, -1, &statement, NULL);
wstring p = ObjectAttributes->ObjectName->Buffer;
sqlite3_bind_text16(statement, 1, p.data(), -1, SQLITE_TRANSIENT);
printf("sql command: %s\n", sqlite3_sql(statement));
auto data = "Callback function called";
char *zErrMsg = nullptr;
auto rc = sqlite3_exec(db, sqlite3_sql(statement), callback, (void *) data, &zErrMsg);
I tried using 0 or 1 in sqlite3_bind_text16 but I either get null or original string with no substitution. What am I doing wrong?