From: | Federico Di Gregorio <fog(at)dndg(dot)it> |
---|---|
To: | psycopg(at)lists(dot)postgresql(dot)org |
Subject: | Re: Integration of Psycopg with XTA |
Date: | 2018-10-03 12:28:00 |
Message-ID: | 4d647279-19ae-75ea-83a7-b74b647c79bd@dndg.it |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | psycopg |
On 10/02/2018 10:07 PM, Christian Ferrari wrote:
> Hi Federico,
> I have been able to test _raw_pgconn using SWIG, as documented here
> https://sourceforge.net/p/swig/mailman/message/27919299/ , the trick to
> use PyCapsule and SWIG together is to specifically map the type with a
> directive like this one:
>
> %typemap(in) PGconn * {
> $1 = (PGconn *) PyCapsule_GetPointer($input,
> "psycopg2.connection._raw_pgconn");
> }
>
> This is interesting because PyCapsule is for sure a "clean" way to pass
> the pointer from Psycopg to XTA.
>
>
> A couple of questions to understand how to implement it as a re-usable
> deliverable.
>
> In current branch, _raw_pgconn is a property, it's not a method, I have
> to retrieve it as below:
>
> pgconn = rm1._raw_pgconn
> xar1 = PostgresqlXaResource(pgconn, "PostgreSQL", "dbname=testdb")
>
> what do you think about a "getter method":
>
> pgconn = rm1._raw_pgconn()
>
> the name of the method does not really matter to me.
>
> _raw_pgconn() create a Capsule object that should be destroyed.
Right now the getter creates a new capsule at every invocation so
transforming it into a method should be straightforward. I'll do it
later today so that you can test.
> What do you think about a factory to create and destroy a PyCapsule that
> contains the PGconn pointer?
Mm. I don't understand what you need here? Can you show an example of usage?
federico
--
Federico Di Gregorio federico(dot)digregorio(at)dndg(dot)it
DNDG srl http://dndg.it
Credo fermamente che da qualche parte, in una scatola ci sia un gatto
che non è vivo ne morto. Credo anche che se i fisici non si sbrigano
a dargli una scatoletta, ben presto sarà solo morto.
-- adattato da una frase di Sam Black Crow
From | Date | Subject | |
---|---|---|---|
Next Message | Daniele Varrazzo | 2018-10-03 12:37:56 | Re: Integration of Psycopg with XTA |
Previous Message | Christian Ferrari | 2018-10-02 20:07:50 | Re: Integration of Psycopg with XTA |