Dave Page wrote:
The docs may say that, but I can tell you that:
if (PQsetClientEncoding(conn, "SQL_ASCII"))
wxLogError(wxT("%s"), PQerrorMessage(conn));
causes wxLogError to be run, if there was an error in the connection. For example, try connecting to a postgres database with an incorrect password. You will get *two* password incorrect dialogs. The first is displayed by the above code.
Yes, this is because the PQsetClientEncoding fails because the connection failed. I've changed the preceeding code to:
// Set client encoding to Unicode/Ascii
if (PQstatus(conn) == CONNECTION_OK)
{
#if wxUSE_UNICODE
wxLogInfo(wxT("Setting client_encoding to 'UNICODE'"));
...
...
which takes care of it.
Regards, Dave.