Re: Problem with PDO exceptions
| From: | kesavan trichy rengarajan | Date: | Sun, 08 Mar 2009 07:14:17 +0000 |
| Subject: | Re: Problem with PDO exceptions | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-46058@lists.php.net to get a copy of this message | ||
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@trk7.com>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@webfunteam.hu> 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
> >
> >
>
>