i'm wondering about the usage/usability of wxSQLite3StatementBuffer::Format.
As its parameters are directly passed to the underlying sqlite functions, there are a few things that don't work.
E.g.
a) The format string can't contain any non-ascii chars, because it can't be wide string.
b) I can't use a wxString directly as parameter. And if i add a ToUTF8() myself to the parameter, i'm making the assumption that the implementation uses UTF8. Which is true, but i think this should be hidden
Code: Select all
wxSQLite3StatementBuffer bufSQL;
wxString value( wxT("äöüÄÖÜ O'Brian") );
// doesn't compile, because the format string is wide
bufSQL.Format( wxT("INSERT INTO test VALUES(%Q);"), value);
// compiles, but doesn't work, as wxString is not passed correctly
bufSQL.Format( "INSERT INTO test VALUES(%Q);", value);
// this works, but is a pain to type if you have many parameters
bufSQL.Format( "INSERT INTO test VALUES(%Q);", (const char *)value.ToUTF8());
Ideally, i'd like something like this, without wxSQLite3StatementBuffer at all:
Code: Select all
wxString s1, s2, s3;
// ...
db->ExecuteUpdate( "INSERT INTO test VALUES(%Q, %Q, %Q);", s1, s2, s3 );