Re: pgConn.cpp.patch - Mailing list pgadmin-hackers

From Dave Page
Subject Re: pgConn.cpp.patch
Date
Msg-id 03AF4E498C591348A42FC93DEA9661B83AF137@mail.vale-housing.co.uk
Whole thread Raw
In response to pgConn.cpp.patch  (Adam H.Pendleton <fmonkey@fmonkey.net>)
Responses Re: pgConn.cpp.patch  ("Adam H. Pendleton" <fmonkey@fmonkey.net>)
List pgadmin-hackers
 
-----Original Message-----
From: Adam H. Pendleton [mailto:fmonkey@fmonkey.net]
Sent: 25 June 2003 14:40
To: Dave Page
Cc: pgadmin-hackers@postgresql.org
Subject: Re: [pgadmin-hackers] pgConn.cpp.patch

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.

pgadmin-hackers by date:

Previous
From: Jean-Michel POURE
Date:
Subject: Re: [pgadmin-support] PGA 3 Copy
Next
From: "Adam H. Pendleton"
Date:
Subject: Re: pgConn.cpp.patch