On Thu, 12 Sep 2002, Tim Bunce wrote:
> On Wed, Sep 11, 2002 at 08:50:51PM -0400, Steven N. Hirsch wrote:
> > Tim,
> >
> > Two fixes and a suggestion follow. To be applied over my most recent
> > diffs.
> >
> > The fixes ensure that $db_obj->state always gets called with a string of
> > exactly five chars (it complains otherwise.)
> >
> > The suggested change to CallMethod prevents the logs from filling with
> > errors in the case where we will be triggering hundreds or thousands of
> > them quite knowingly (client app inserts in a loop where we suppress
> > RaiseError and simply continue past some expected failure conditions, e.g.
> > duplicate primary key.)
> >
> > By feeding the death message to Debug, we can still choose to watch if
> > need be.
>
> Yeap.
> > sub proxy_set_err {
> > my ($h,$errmsg) = @_;
> > my ($err,$state) =
> > - ($errmsg =~ s/ \[err=(.*?),state=(.*?)\]//) ? ($1,$2) : (1,5 x ' ');
> > + ($errmsg =~ s/ \[err=(.*?),state=(.*?)\]//) ? ($1,$2) : (1,' ');
> > return DBI::set_err($h, $err, $errmsg, $state);
> > }
>
> I think a better fix is to use ... : (1,'')
> which is what I suggested originally. Was there a problem with that?
Yes, it causes an exception from DBI::set_err(), which carps about
expecting a five char string. My original use of a single space was a
typo, but I did try it with '' - same problem.
> If state is '' but err is non-zero then the DBI will return state
> as 'S1000' (general error).
I'll look into why this doesn't seem to be working for me.
>
> > --- ProxyServer.pm 2002/09/10 01:37:40 1.5
> > +++ ProxyServer.pm 2002/09/12 00:35:25 1.6
> > @@ -195,7 +195,7 @@
> > - my $state = $_[1]->state || '';
> > + my $state = $_[1]->state || ' ';
>
> I don't think that needs changing.
If the logic on the client is fixed per my patch, I agree. It's odd that
we're seeing different behavior from DBI::set_err().
Will advise...