Return codes on PDO insert

[email protected] (Paul M Foster)
Newsgroups php.general
Message-ID <[email protected]>
I'm using a database class which wraps around the PDO classes, using a
SQLite3 database. I wrote some PHP to insert a record, and it didn't
insert, but no error was issued. Turns out I violated a constraint on the
table-- I'd left a field blank, and the column had a NOT NULL constraint.

I fixed the code to fill in that field. But I can't figure out why PDO
doesn't throw an error code when an insert fails due to a failed
constraint. I deliberately wrote some code to violate the constraint, and
inserted some code into the database class to dump out with whatever code
was returned from the execute() call. A failed insert yielded a 0000 code
(no error). So it's not my class.

Am I missing something? I would think the PDO driver would issue a (bad)
error code on a failed (constraint) insert. Is this not expected behavior?
Or is the SQLite3 back end at fault for not issuing an error?

Paul

-- 
Paul M. Foster
http://noferblatz.com
http://quillandmouse.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.