pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dmitry A Jackovlev <hobbut@orionet.ru>
To: pgsql-interfaces@postgresql.org
Subject: Extrach PGconn* form $dbh (perl)
Date: Thu, 23 Nov 2006 11:27:06 +0300
Message-ID: <1484180210.20061123112706@orionet.ru> (raw)

Hello.

      Sorry for my bad English.

I need to extract PGconn*-type variable from perl $dbh (e.g.
magicfunction(dbh)) to use it in my XS-function, but I can't
understand how  to get PGconn from my function using DBH (I send dbh
to my function and need to get PGconn variable as returned value from my function).

Please help me to write PGconn *magicfunction(SV*) function.

      for example:
      
parser.pl:
...
my $dbh= DBI->connect("dbi:Pg:dbname=some_db","user","pass");
my $h=myfunction($dbh, "filename");
...

myfunction.xs:
HV *
myfunction( DBH, filename )
        SV *DBH
        char *filename
    CODE:
         HV *hash=newHV(); // some hash
         PGconn *myconnection=magicfunction( DBH );
         processfile ( hash, filename ); //fill hash from file.
         writehash ( hash, myconnection );
         RETVAL=hash;
    OUTPUT:
         RETVAL


-- 
WBR,
 Dmitry                          mailto:hobbut@orionet.ru




Message-ID: <1484180210.20061123112706@orionet.ru>
Permalink:  ../1484180210.20061123112706@orionet.ru/
Also on:    postgresql.org/message-id/1484180210.20061123112706@orionet.ru

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: hobbut@orionet.ru
  Subject: Re: Extrach PGconn* form $dbh (perl)
  In-Reply-To: <1484180210.20061123112706@orionet.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox