Return codes on PDO insert

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

 



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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux