diff options
author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2019-02-16 18:08:08 +0100 |
---|---|---|
committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2019-02-16 18:12:52 +0100 |
commit | 80b7b845d2cfaddef3f623a1357048954308dc0a (patch) | |
tree | cec7367f6bda555bab2befe50911744821ecc59e /doc/src/cursor.rst | |
parent | 3b7c083c3d92b7c1cd22c5af53b9ee18dc331db3 (diff) | |
download | psycopg2-80b7b845d2cfaddef3f623a1357048954308dc0a.tar.gz |
Added docs about pgconn_ptr, pgresult_ptrlibpq-ptrs
Diffstat (limited to 'doc/src/cursor.rst')
-rw-r--r-- | doc/src/cursor.rst | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/doc/src/cursor.rst b/doc/src/cursor.rst index 1d7098f..c6b04cf 100644 --- a/doc/src/cursor.rst +++ b/doc/src/cursor.rst @@ -632,6 +632,24 @@ The ``cursor`` class using Unicode data instead of bytes. + .. rubric:: Interoperation with other C API modules + + .. attribute:: pgresult_ptr + + Return the cursor's internal `!PGresult*` as integer. Useful to pass + the libpq raw result structure to C functions, e.g. via `ctypes`:: + + >>> import ctypes + >>> libpq = ctypes.pydll.LoadLibrary(ctypes.util.find_library('pq')) + >>> libpq.PQcmdStatus.argtypes = [ctypes.c_void_p] + >>> libpq.PQcmdStatus.restype = ctypes.c_char_p + + >>> curs.execute("select 'x'") + >>> libpq.PQcmdStatus(curs.pgresult_ptr) + b'SELECT 1' + + .. versionadded:: 2.8 + .. testcode:: :hide: |