Re: PQexecPrepared() question

From: Igor Korot <ikorot01(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: PQexecPrepared() question
Date: 2025-12-21 19:44:49
Message-ID: CA+FnnTxCCoA+ju+-HAde8t8kmQt6Qm58oP5z2U2eZGHr7qAf6Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi, Tom,

On Sun, Dec 21, 2025 at 9:17 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter J. Holzer 2025-12-21 21:19:25 Re: PQexecPrepared() question
Previous Message Tom Lane 2025-12-21 17:17:16 Re: PQexecPrepared() question