postgresql-interfaces/psqlodbc GitHub issues and pull requests (mirror)
help / color / mirror / Atom feedFrom: omeuid (@omeuid) <[email protected]>
To: postgresql-interfaces/psqlodbc <[email protected]>
Subject: [postgresql-interfaces/psqlodbc] issue #117: How to use PostgreSQL extended protocol with ODBC driver executing a parameterized sentence.
Date: Wed, 21 May 2025 14:56:44 +0000
Message-ID: <[email protected]> (raw)
Hi,
Is there a way to configure the ODBC driver to use the extended protocol when running a parameterized query?
Let's assume the following Python client.
> import pyodbc
>
> def connect_to_odbc(uri):
> conn = pyodbc.connect(uri)
> return conn
>
> def execute_query(conn, query):
> cursor = conn.cursor()
> cursor.execute(query, 1)
> result = cursor.fetchall()
> return result
>
> uri = 'DSN=MyDSN'
>
> conn = connect_to_odbc(uri)
> query = 'SELECT * from mytable where id = ?'
>
> result = execute_query(conn, query)
>
> for row in result:
> print(row)
>
> conn.close()
If the DSN is configured with 'server side prepare' option set to 1 (and also batch size is set to 1):
* I expected that the driver would send P/B/E messages.
* However, what I'm observing is that the driver only sends a Q message, with the parameter already replaced.
Could you confirm if this is the expected behaviour?
Is there anything that I can configure in the driver in order to get the behaviour that I was expecting?
Regards
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: github://postgresql-interfaces/psqlodbc
Cc: [email protected], [email protected]
Subject: Re: [postgresql-interfaces/psqlodbc] issue #117: How to use PostgreSQL extended protocol with ODBC driver executing a parameterized sentence.
In-Reply-To: <<[email protected]>>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox