Re: Return codes on PDO insert

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

 



On Thu, Mar 25, 2021 at 02:18:15PM -0700, R. Eric Wheeler wrote:

> Paul,
> 
> I think what you are looking for is
> https://www.php.net/manual/en/pdo.setattribute.php
> 
> Specifically PDO::ATTR_ERRMODE.
> 
> Or are you saying that PDO::errorCode() had no errors?

The attribute you mention only specified how an error gets "advertised",
not whether an error is thrown. At its lowest setting, it still sets error
codes.

In the case where an insert fails because of a constraint violation,
PDO::errorInfo()[0] produces a SQLSTATE error code of 000, meaning no
error. Yet it seems like a failed insert should produce some kind of code.
I'm wondering if I'm wrong about that or if I'm doing something wrong.

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