Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gALl6-0001B5-S5 for psycopg@arkaria.postgresql.org; Wed, 10 Oct 2018 21:11:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gALl5-0002RX-9c for psycopg@arkaria.postgresql.org; Wed, 10 Oct 2018 21:11:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gALl4-0002RQ-Uj for psycopg@lists.postgresql.org; Wed, 10 Oct 2018 21:11:07 +0000 Received: from sonic301-22.consmr.mail.ir2.yahoo.com ([77.238.176.99]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gALkx-0000BH-Dy for psycopg@lists.postgresql.org; Wed, 10 Oct 2018 21:11:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1539205857; bh=AdET4cV8EA9lKfGmZrjoab2R5pP/SNNUMAoKZN+AA+w=; h=Date:From:Reply-To:To:In-Reply-To:References:Subject:From:Subject; b=Ip6hk3166Bw/p9sRcRi6k647m18cuRniNLb7CA26lZPmOS09QTTTvenpar5lYZSkYkYYg218lYlo7fdpwi08qfpM1hwtCvta80/f8UycbPvADKqMrI0iifFSUGgyrDJSWdIklZnSYdS2U7oDG0F0MO7DcEQSJbnhM4/5Cid92M3vL97Eem6f9qhhL9/JzQjkQRWeDpKmURdBEiJh488vOgrjZcASwEURusuCfk6vnVMvfFZcc+opQjjFG73pEVkwdi6W+6FMaKSJN9JdrZDGHqnN/SCJZ540I1YZa9ozAZ57AnZZgcJPBFkE3sR2Go5A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AaW0r5Skn l69Kntuf5EDIPuqrFJWBw7TDK4BDEr8i5XbwPAyJntTb5SBldVHPOmZTASYw- Received: from sonic.gate.mail.ne1.yahoo.com by sonic301.consmr.mail.ir2.yahoo.com with HTTP; Wed, 10 Oct 2018 21:10:57 +0000 Date: Wed, 10 Oct 2018 21:10:55 +0000 (UTC) From: Christian Ferrari Reply-To: Christian Ferrari To: psycopg@lists.postgresql.org Message-ID: <1164838604.11237894.1539205855738@mail.yahoo.com> In-Reply-To: <618fbba4-0f31-2e44-8517-a158cccbef0d@dndg.it> References: <1005537726.6324310.1538685211791@mail.yahoo.com> <602182297.6960405.1538755378178@mail.yahoo.com> <618fbba4-0f31-2e44-8517-a158cccbef0d@dndg.it> Subject: Re: Integration of Psycopg with XTA MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_11237893_382686310.1539205855736" X-Mailer: WebService/1.1.12512 YMailNorrin Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0 Content-Length: 8141 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_Part_11237893_382686310.1539205855736 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable By the way, PyMySQL/mysqlclient-python project asked me to rename the metho= d from "get_native_conn()" to "_get_native_conn()". I'm not a "naming addicted person", but from the developer point of view, u= sing two different methods would be for sure not appreciated...=20 xar1 =3D PostgresqlXaResource(rm1.get_native_connection(), "PostgreSQL", "d= bname=3Dtestdb") xar2 =3D 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 clo= se 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 =20 Il domenica 7 ottobre 2018, 13:56:49 CEST, Federico Di Gregorio ha scritto: =20 =20 On 10/05/2018 06:02 PM, Christian Ferrari wrote: > In a previous mail I stated something like "the name of the method=20 > doesn't matter"... > ... after better thinking I realized a decent name might be better than= =20 > other ones... > Let me say: >=20 > get_native_conn() > get_native_connection() >=20 > might be better than "get_/something/_pgconn" because the same type of=20 > method could be useful for other databases in the future... > More or less all the databases use a "native connection", only=20 > PostgreSQL uses "PGconn connection". After some more checking I discovered that it isn't possible to=20 "invalidate" a PyCapsule so there is no way to tell if the pointer=20 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=20 a method here because it gives the idea that you need to call it every=20 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 --=20 Federico Di Gregorio=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 federico.digregorio@dndg.it DNDG srl=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 http://dndg.it =C2=A0 Io non sono romantica. La candelina sul tavolo mi vede e si spegne. =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 -- sisterconfusion =20 ------=_Part_11237893_382686310.1539205855736 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
By the way, PyMySQL/mysqlclient-python project asked me to rename the metho= d 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 =3D PostgresqlXaResource(rm1.get_native_con= nection(), "PostgreSQL", "dbname=3Dtestdb")
xar2 =3D 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.c= om/PyMySQL/mysqlclient-python/pull/269 shortly...
=
Thank you in advance
Kind Regards
Ch.F.

-------= ------------------------------------------------------
Good design can't stop bad implementation

=20
=20
Il domenica 7 ottobre 2018, 13:56:49 CEST, Federico Di = Gregorio <fog@dndg.it> ha scritto:


On 10/05/2018 06:02 PM, Christian Fer= rari wrote:
> In a previous mail I stated something li= ke "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 data= bases use a "native connection", only
> PostgreSQL us= es "PGconn connection".

After some mor= e checking I discovered that it isn't possible to
"inval= idate" 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 pa= ss to the target C API.

I also added s= ome docs and a dumb test.

https://github.com/fogzot/psycopg2/tre= e/feature-expose-pgconn

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


federico

--
Federico Di Gregorio            =             federico.d= igregorio@dndg.it
DNDG srl       =                     &nbs= p;                     = http://dndg.it

  Io non sono romantica. La= candelina sul tavolo mi vede e si spegne.
    =                      = ;                     &nb= sp;       -- sisterconfusion


<= /div>
------=_Part_11237893_382686310.1539205855736--