From: | Christian Ferrari <camauz(at)yahoo(dot)com> |
---|---|
To: | psycopg(at)lists(dot)postgresql(dot)org |
Subject: | Re: Integration of Psycopg with XTA |
Date: | 2018-10-10 21:10:55 |
Message-ID: | 1164838604.11237894.1539205855738@mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | psycopg |
By the way, PyMySQL/mysqlclient-python project asked me to rename the method from "get_native_conn()" to "_get_native_conn()".
I'm not a "naming addicted person", but from the developer point of view, using two different methods would be for sure not appreciated...
xar1 = PostgresqlXaResource(rm1.get_native_connection(), "PostgreSQL", "dbname=testdb")
xar2 = MysqlXaResource(rm2._get_native_connection(), "MySQL", "localhost,0,lixa,,lixa")
If you don't mind, I kindly ask you to wait a couple of days: I hope to close the pull request https://github.com/PyMySQL/mysqlclient-python/pull/269 shortly...
Thank you in advanceKind RegardsCh.F.
-------------------------------------------------------------
Good design can't stop bad implementation
Il domenica 7 ottobre 2018, 13:56:49 CEST, Federico Di Gregorio <fog(at)dndg(dot)it> ha scritto:
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(dot)digregorio(at)dndg(dot)it
DNDG srl http://dndg.it
Io non sono romantica. La candelina sul tavolo mi vede e si spegne.
-- sisterconfusion
From | Date | Subject | |
---|---|---|---|
Next Message | Federico Di Gregorio | 2018-10-10 21:19:45 | Re: Integration of Psycopg with XTA |
Previous Message | Christian Ferrari | 2018-10-08 19:51:25 | Re: Integration of Psycopg with XTA |