I think that I resolved problems with DatabaseStringConverter class. Here are two functions which do the job and I think that they are compatibile with unicode build too.
Code: Select all
wxString ConvertToUTF8(wxString value)
{
wxString str(value.wc_str(*wxConvCurrent), wxConvUTF8);
return str;
}
wxString ConvertFromUTF8(wxString value)
{
wxString str(value.wc_str(wxConvUTF8), *wxConvCurrent);
return str;
}
So what's next?
On every place where database is especting char parameter (sql command or parameter in prepared statement) we have to:
- 1. convert it with ConvertToUTF8 function and
2. procede it with wxString::c_str() to database api function.
- 1. convert it to op.sys. locale with ConvertFromUTF8 function and
2. return the new string value
And I have one question/suggestion. There are two RunQuery() and RunQueryWithResult() functions. One in DatabaseLayer class and one in PreparedStatement. I think that this is a little bit confusing. Maybe we should unique it somehow. We should separate transactions, statements and database like in IBPP. I admit that I'm under an impact of IBPP library and that's because I'm using it for about a year, so sorry if I mention it a lot.
All the best,
Damir