Closed mbunal closed 3 years ago
i tried with this code in lib/database/ez_sqlite3.php at the end.
public function enableExceptions()
{
return $this->dbh->enableExceptions(true);
}
i think it is working. mayde added future relases...
Already possible: https://github.com/ezSQL/ezsql/blob/4bc6a254b7ac9d4856da343682c9af14cbec8909/lib/ezsqlModel.php#L446
All errors is processed thru: https://github.com/ezSQL/ezsql/blob/4bc6a254b7ac9d4856da343682c9af14cbec8909/lib/ezsqlModel.php#L429
An exception is only throw when vendor database driver not installed, missing config settings, or using transactional database queries. Otherwise, you need to check if false
is returned.
->show_errors()
default state is true
.
First of all thank you.
I'm not a php guru. I just tried to enter the same value in a field that should be unique. show_errors didn't work for me but enableExceptions did. i think "show_errors" and "exceptions" are completely different error handling mechanism.
anyway. thanks for great sql interface to all.
They are different.
This library only throw exceptions as stated, you need to check a return queries for boolean false
, or it will do a non catchable fatal error if warrent.
Your solution, might just be valid for that vendor sql driver, whereas, this library make all method/function calls used interchangeable.
hi, how can i use try catch with ezsql?