X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id EDE4CB439CB for ; Tue, 8 Jul 2003 22:41:53 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 89721-04 for ; Tue, 8 Jul 2003 19:41:18 -0300 (ADT) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id 07796B430B8 for ; Tue, 8 Jul 2003 19:40:53 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id h68MenT06234; Tue, 8 Jul 2003 18:40:49 -0400 (EDT) From: Bruce Momjian Message-Id: <200307082240.h68MenT06234@candle.pha.pa.us> Subject: Re: DBD::Pg 1.30_1 WAS (Re: Prepare and prepare ?) In-Reply-To: <3EDB7F17.7010607@semantico.com> To: Dominic Mitchell Date: Tue, 8 Jul 2003 18:40:49 -0400 (EDT) Cc: Tim Bunce , Rudy Lippan , David Wheeler , pgsql-interfaces@postgresql.org, "'DBI developers'" X-Mailer: ELM [version 2.4ME+ PL99 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/9 X-Sequence-Number: 4323 I meant to say "Already applied by someone else --- not me". --------------------------------------------------------------------------- Dominic Mitchell wrote: > Tim Bunce wrote: > > Ah, you're passing it the address of (probably temporary) reference. > > It's the underlying object (which the ref points to) that you need. > > > > Try something like: > > > > PQsetNoticeProcessor(imp_dbh->conn, pg_warn, (void *)SvRV(dbh)); > > > > the D_imp_dbh( (SV *)arg ) will do-the-right-thing *if* the > > handle is the 'last handle used' ($DBI::lasth) whenever it's called. > > > > That's probably not a safe assumption so you could try something > > more like this: > > > > D_imp_dbh( sv_2mortal(newRV((SV*)arg)) ); > > Thank you! This worked a treat. It turned out that sv_2mortal() was > necessary after all. I'm going to go away and read up on XS before I > try this sort of thing again, I think. > > Could somebody with a commit bit for dbdpg please apply the attached > patch? It passes all tests here on perl 5.8.0 / postgres 7.3.2. I > don't think that it will cause any problems for other perl versions... -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073