]> git.ipfire.org Git - thirdparty/psycopg.git/commit
Add bindings for PQ tracing functions
authorDenis Laxalde <denis.laxalde@dalibo.com>
Fri, 3 Dec 2021 07:05:16 +0000 (08:05 +0100)
committerDenis Laxalde <denis@laxalde.org>
Tue, 7 Dec 2021 21:36:53 +0000 (22:36 +0100)
commitde69c53ae83fd3fe42c6fc12646ca12127d8d9af
tree5944fd2f75e19baf8d4555d4848e44170d9f6429
parent0d207bd80fda01166585bbd12b25e3f05fd6ac61
Add bindings for PQ tracing functions

Since we cannot pass a file descriptor as a FILE value, as expected by
PQtrace(), PGconn.trace() method accepts a 'fileno: int' value. This is
then used to build an stdio's FILE value through fdopen(). The latter
also needs a binding in ctypes. This only works on Linux platform.

In _pq_ctypes.pyi, fdopen() and PQtrace() are not autogenerated because
of the needed '# type: ignore' (similar to existing ones).

PQsetTraceFlags() is new from libpq 14, so we declare it conditionally.
psycopg/psycopg/pq/__init__.py
psycopg/psycopg/pq/_enums.py
psycopg/psycopg/pq/_pq_ctypes.py
psycopg/psycopg/pq/_pq_ctypes.pyi
psycopg/psycopg/pq/abc.py
psycopg/psycopg/pq/pq_ctypes.py
psycopg_c/psycopg_c/pq/libpq.pxd
psycopg_c/psycopg_c/pq/pgconn.pyx
tests/pq/test_pgconn.py