note 93469 modified in pdo.prepare by danbrown
| From: | danbrown@php.net | Date: | Fri, 11 Sep 2009 15:39:00 +0000 |
| Subject: | note 93469 modified in pdo.prepare by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-160462@lists.php.net to get a copy of this message | ||
beware
PDO will emulate prepared statements/bound parameters for drivers that do not natively support them,
and can also rewrite named or question mark style parameter markers to something more appropriate,
if the driver supports one style but not the other.
This includes mySQL it seems so
<?php
try{
$sth1 = $this->db1->prepare($t1, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
}
catch(PDOException $e){
return $this->pack('dbError', $e->getMessage());
}
?>
does not and so will not throw the exception if your SQL is wrong.
You will need to check that $sth1 is not null.
--was--
beware
PDO will emulate prepared statements/bound parameters for drivers that do not natively support them,
and can also rewrite named or question mark style parameter markers to something more appropriate,
if the driver supports one style but not the other.
This includes mySQL it seems so
try{
$sth1 = $this->db1->prepare($t1, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
}
catch(PDOException $e){
return $this->pack('dbError', $e->getMessage());
}
does not and so will not throw the exception if your SQL is wrong.
You will need to check that $sth1 is not null.
http://php.net/manual/en/pdo.prepare.php