Don't forget that all driver-private attribute and functions should
start with the driver prefix. So backend_pid should be called pg_backend_pid

Tim.

On Thu, Jun 13, 2002 at 07:35:23AM -0400, [EMAIL PROTECTED] wrote:
> Its a fairly small change to add this, 10 lines of code. I wrote this
> patch for a previous place, unfortunately I no longer work with Pg
> regularly, and don't have time to clean it up and give you a proper patch
> 
> The interface is $pid=$dbh->func('backend_pid')
> 
> Unfortunately, I don't work with Pg often enough, but this should get you 
> started:
> in Pg.xs:
> 
> +void
> +backend_pid(dbh)
> +    SV *       dbh
> +    CODE:
> +    D_imp_dbh(dbh);
> +
> +    ST(0) = dbd_db_backend_pid(dbh, imp_dbh);
> 
> In dbdimp.c:
> 
> +int
> +dbd_db_backend_pid (dbh, imp_dbh)
> +    SV *dbh;
> +    imp_dbh_t *imp_dbh;
> +{
> +    char id;
> +    SV* retsv;
> +
> +    if (dbis->debug >= 1) { fprintf(DBILOGFP, "dbd_db_backend_pid\n"); }
> +
> +    return PQbackendPID(imp_dbh->conn);
> +}
> 
> 
> Good luck. Once it works, submit it to maintainer, will ya? ;)
> 
> -alex
> 
> On 13 Jun 2002, Jeff Boes wrote:
> 
> > On Thu, 2002-06-13 at 11:25, Jeff Boes wrote:
> > > I may have asked this or seen this asked before, but my memory is poor
> > > today: is there any way to know the process ID associated with the
> > > database backend connected to a DBD::Pg database handle?
> > 
> > Further investigation shows:
> > 
> > The old 'Pg.pm' (pre-DBD days) had many more functions connected to the
> > internal API.  In particular, Pg.xs of that day had
> > 
> >   int
> >   PQbackendPID(conn)
> >      PG_conn   conn
> > 
> > but as I'm not (yet) a hacker of XS, I can't figure out how to shoehorn
> > this into DBD::Pg.  Any takers?
> > 
> > 
> > 
> 
> 
> 
> 

Reply via email to