Re: DBD::Pg 1.30_1 WAS (Re: Prepare and prepare ?)

From: Tim Bunce <Tim(dot)Bunce(at)pobox(dot)com>
To: Dominic Mitchell <dom(at)semantico(dot)com>
Cc: Tim Bunce <Tim(dot)Bunce(at)pobox(dot)com>, Rudy Lippan <rlippan(at)remotelinux(dot)com>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, David Wheeler <david(at)wheeler(dot)net>, pgsql-interfaces(at)postgresql(dot)org, "'DBI developers'" <dbi-dev(at)perl(dot)org>
Subject: Re: DBD::Pg 1.30_1 WAS (Re: Prepare and prepare ?)
Date: 2003-05-30 14:03:13
Message-ID: 20030530140313.GP6818@dansat.data-plan.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

On Fri, May 30, 2003 at 10:20:11AM +0100, Dominic Mitchell wrote:
> Tim Bunce wrote:
> >On Thu, May 29, 2003 at 10:00:21AM +0100, Dominic Mitchell wrote:
> >
> >>One more thing for the change log: notice messages generated by the
> >>database now use the perl warning mechanism instead of going to stderr,
> >>so they can be trapped if needed.
> >
> >
> >Hopefully implemented as
> >
> > if (DBIc_WARN(imp_xxh))
> > warn("...", ...)
> >
> >The $h->{Warn} attribute defaults to true. Can be useful to silence
> >warnings for a handle without having to play games with $SIG{__WARN__}.
>
> See, I told you I wasn't an XS guru. :-)
>
> Actually, I looked at this, but my limited C and DBI skills couldn't
> work out a) what the required handle was (probably dbh)

Just whatever handle was used to call the method that's generating the warning.

> and b) how to pass that into the PQsetNoticeProcessor function as data
> and get it out again.

Ah, different issue. For that I'd say if DBIc_WARN(imp_xxh) isn't true
then disable the PQsetNoticeProcessor function.

> I'll happily take another look though, now that it's been brought up as
> desirable.

Actually I'd misunderstood the circumstances of the warn (not reading
your message carefully enough). For notice messages generated by
the database server they'll soon(ish) be a $h->{HandleEvent} = sub { ... }
hook that should be used.

But that'll bring you back to needing some way for the PQsetNoticeProcessor
function to get at the handle data it'll need to pass to the HandleEvent
hook. The PQsetNoticeProcessor API ought to allow you to some way to do that.

Tim.

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Dominic Mitchell 2003-05-30 14:13:04 Re: DBD::Pg 1.30_1 WAS (Re: Prepare and prepare ?)
Previous Message Dominic Mitchell 2003-05-30 09:20:11 Re: DBD::Pg 1.30_1 WAS (Re: Prepare and prepare ?)