Liste des Groupes | Revenir à co vms |
On Thu, 10 Jul 2025 20:11:59 -0400, Arne Vajhøj wrote:Yes.On 7/10/2025 7:58 PM, Lawrence D'Oliveiro wrote:Again, all of that can be returned via exceptions, which I canOn Thu, 10 Jul 2025 19:05:42 -0400, Arne Vajhøj wrote:>If the PHP developer configure the database connection to not>
throw exceptions because the developer want to check return
status, then that must be respected.
That’s a dumb way of doing it. Most of the errors from an SQL call
indicate program bugs. The only exception I have come across is
IntegrityError, when used to indicate an attempt to add a record
with a duplicate value for a key that must be unique. That can
sometimes be usefully caught and reported back to the user as an
error with the data that they are trying to enter.
There are other:
* dynamic SQL without prepare/parameters and a bad value
* foreign key constraint violation
* invalid data value
* transaction rollback due to timeout or deadlock
* timeout waiting for connection due to connection pool at max
* timeout waiting for connection due to connection at max in database
* no connectivity to server
* invalid login credentials
selectively catch as appropriate if they’re relevant to my program
logic, or leave them to be reported as program bugs if I’m not
expecting them.
Les messages affichés proviennent d'usenet.