[nycphp-talk] question re DB_Error (PEAR)
David Mintz
dmintz at davidmintz.org
Fri Mar 19 17:04:43 EST 2004
On Fri, 19 Mar 2004, Mitch Pirtle wrote:
> David Mintz wrote:
> > On Fri, 19 Mar 2004, Mitch Pirtle wrote:
> >
> > Nuh uh. That's why I said "something *like* parse it out of the string
> > returned by..." [emphasis added] (-: The string returned by getDebugInfo()
> > is identical (well ok, I mean == ) to that returned by getUserInfo() in
> > the code I'm playing with right now.
> >
> > The point being, it looks like you gotta use something like mysql_errno()
> > (in which case, so much for your abstraction) or parse it yourself.
>
> Whups, then I misunderstood (: My bad.
>
> You are trying to get the exact error as reported by the database,
> correct? And if so, is the purpose for error reporting or somesuch?
Actually my wording was a little ambiguous, now that I look at it yet
again. The native error code is *contained* in the string returned by
getUserInfo() so in that sense... nevermind. (-:
Yeah, I would like to trap Duplicate entry (1062) and tell the user, you
can't do that. I'm working with a table where the rows represent people
and the email must be either NULL or unique. So if DB::isError($result),
I'm parsing $result->getUserInfo().
I know that PEAR has its own DB_ERROR_ALREADY_EXISTS constant and I guess
that's the equivalent of MySQL's 1062.
Thanks Mitch.
---
David Mintz
http://davidmintz.org/
"Anybody else got a problem with Webistics?" -- Sopranos 24:17
More information about the talk
mailing list