Re: Integration of Psycopg with XTA - Mailing list psycopg

From Federico Di Gregorio
Subject Re: Integration of Psycopg with XTA
Date
Msg-id 618fbba4-0f31-2e44-8517-a158cccbef0d@dndg.it
Whole thread Raw
In response to Re: Integration of Psycopg with XTA  (Christian Ferrari <camauz@yahoo.com>)
Responses Re: Integration of Psycopg with XTA  (Christian Ferrari <camauz@yahoo.com>)
Re: Integration of Psycopg with XTA  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
Re: Integration of Psycopg with XTA  (Christian Ferrari <camauz@yahoo.com>)
Re: Integration of Psycopg with XTA  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
List psycopg
On 10/05/2018 06:02 PM, Christian Ferrari wrote:
> In a previous mail I stated something like "the name of the method 
> doesn't matter"...
> ... after better thinking I realized a decent name might be better than 
> other ones...
> Let me say:
> 
> get_native_conn()
> get_native_connection()
> 
> might be better than "get_/something/_pgconn" because the same type of 
> method could be useful for other databases in the future...
> More or less all the databases use a "native connection", only 
> PostgreSQL uses "PGconn connection".

After some more checking I discovered that it isn't possible to 
"invalidate" a PyCapsule so there is no way to tell if the pointer 
inside it is still a valid libpq connection.

The current code (feel free to pull) adds a new method

get_native_connection()

that raise an exception if called on a closed connection. I better like 
a method here because it gives the idea that you need to call it every 
time you want a Capsule to pass to the target C API.

I also added some docs and a dumb test.

https://github.com/fogzot/psycopg2/tree/feature-expose-pgconn

@Daniele, if Christian reports no problems I'll merge this later for 2.8.

federico

-- 
Federico Di Gregorio                         federico.digregorio@dndg.it
DNDG srl                                                  http://dndg.it
  Io non sono romantica. La candelina sul tavolo mi vede e si spegne.
                                                       -- sisterconfusion


psycopg by date:

Previous
From: Christian Ferrari
Date:
Subject: Re: Integration of Psycopg with XTA
Next
From: Christian Ferrari
Date:
Subject: Re: Integration of Psycopg with XTA