Re: PQexecPrepared() question - Mailing list pgsql-general

From Igor Korot
Subject Re: PQexecPrepared() question
Date
Msg-id CA+FnnTxCCoA+ju+-HAde8t8kmQt6Qm58oP5z2U2eZGHr7qAf6Q@mail.gmail.com
Whole thread Raw
In response to Re: PQexecPrepared() question  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: PQexecPrepared() question
List pgsql-general
Hi, Tom,

On Sun, Dec 21, 2025 at 9:17 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Adrian Klaver <adrian.klaver@aklaver.com> writes:
> > It is not the same setup, in your original question you are hand writing
> > code not running a script through the ODBC driver. Best bet is the ODBC
> > driver is picking up the client(Windows) encoding and passing it to the
> > server.
>
> It might be the other way around.  psql absolutely will try to infer
> an encoding from its environment, but perhaps the ODBC driver does
> not, or does it differently.
>
> In any case, "SHOW client_encoding" in both the working and
> non-working contexts would yield useful information.

Adding following code:

        SQLHSTMT stmt;
        SQLWCHAR value[25];
        ret = SQLAllocHandle( SQL_HANDLE_STMT, m_hdbc, &stmt );
        ret = SQLExecDirect( stmt, L"SHOW client_encoding", SQL_NTS );
        ret = SQLBindCol( stmt, 1, SQL_C_WCHAR, &value, 25, 0 );
        ret = SQLFetch( stmt );
        ret = SQLFreeHandle( SQL_HANDLE_STMT, stmt );

the value of the "value" variable is still "UTF8".

Thank you.

>
>                         regards, tom lane



pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: PQexecPrepared() question
Next
From: "Peter J. Holzer"
Date:
Subject: Re: PQexecPrepared() question