On Fri, Mar 10, 2006 at 12:09:44PM -0500, Chris wrote:
Under what circumstances does PDOStatement::execute() return false?
It seems to always return true.
I'm assuming you have some code like:
$sth = $dbh-prepare($sql);
if(! $sth-execute() ) {
// false
} else {
//true
}
When it returns false sort of depends what kind of $sql you have.
if you have something like:
select * from something ...
-execute() will return true probably about 99.9% of the time,
except for cases like when you loose a connection to the db, since
the prepare() does the parsing of the statment, the errors in
parsing will occur at prepare().
If you have something like:
insert into blah values(something)
The -execute will fail if you violate a constraint on the DB like
a primary/foreign/unique key constraint.
Basically anytime the db server responsed with: Um this isn't
allowed even though the syntax is valid.
HTH,
Curt.
--
cat .signature: No such file or directory
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php