[code]wxString SQLite3_Db::Format( const wxString& format, ... )
char * t = sqlite3_vmprintf( format.mb_str(wxConvUTF8).data(), marker );
wxString retVal( t, wxConvUTF8 );
sqlite3_free( t );
This is code I have to format a string. For some this might look Chinese, but let me explain.
I want to send something like 'printf('SELECT * FROM %s', 'tablename')'.
the sqlite3_vmprintf() function should do that (because it has the added value of having the '%q' which inserts a string, escaping the "dangerous" characters.
Now when I do this, the first va_arg that I got into the sqlite-function is the pointer of the second argument.
What I mean is:
::Format("%d %s %s", 1, "test", "test2");
In the sqlite3_ functions I receive the correct format, and then sqlite starts parsing. but in %d the va_arg() is taking from "test", so it displays the integer value of a pointer... Which is obviously not what I want to achieve.
I already asked on the sqlite mailing list, but they opt that it would be a problem in the va_* functions.
Can someone of you help me with this please?