Re: Problem with PDO exceptions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am sorry, setting |PDO::ATTR_ERRMODE| attribute to
|PDO::ERRMODE_EXCEPTION|  *does* throw an Exception when the table cannot be
found. Stupid me; I was trying to catch Exception rather than a
PDOException.

On Sun, Mar 8, 2009 at 6:03 PM, kesavan trichy rengarajan <k7@xxxxxxxx>wrote:

> yup, I have set the  |PDO::ATTR_ERRMODE| attribute to
> |PDO::ERRMODE_EXCEPTION|
> and I am still not getting an exception!
>
> My Code is something like this:
>         $query = $db->prepare($sql);
>         $query->execute($bind);
>         $row = $query->fetch(PDO::FETCH_ASSOC);
>
> wher $db is the PDO obj and $sql is the sql query and $bind is the bound
> parameter
>
>
> On Sun, Mar 8, 2009 at 5:35 PM, Zoltan Ormandi <
> ormandi.zoltan@xxxxxxxxxxxxx> wrote:
> > Hi,
> >
> > Did you set the value of the |PDO::ATTR_ERRMODE| attribute to
> > |PDO::ERRMODE_EXCEPTION|?
> >
> > Btw, I don't think ||prepare would throw an exception even for a
> malformed
> > query, but ||execute definitely should.
> >
> > Regards,
> > Z
> >
> >
>
>

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux