"documentations update on how to use exceptions instead of depricated hald_on_error attribute"

This commit is contained in:
Ralf Becker 2008-10-25 05:36:25 +00:00
parent b17b108062
commit 9ba17c163c

View File

@ -35,6 +35,15 @@
* *
* To fetch a next (single) row, you can use: * To fetch a next (single) row, you can use:
* $row = $db->query("SELECT COUNT(*) FROM ...")->fetch($fetchmod=null); * $row = $db->query("SELECT COUNT(*) FROM ...")->fetch($fetchmod=null);
*
* egw_db allows to use exceptions to catch sql-erros, not existing tables or failure to connect to the database, eg.:
* try {
* $this->db->connect();
* $num_config = $this->db->select(config::TABLE,'COUNT(config_name)',false,__LINE__,__FILE__)->fetchSingle();
* }
* catch(Exception $e) {
* echo "Connection to DB failed (".$e->getMessage().")!\n";
* }
*/ */
// some constanst for pre php4.3 // some constanst for pre php4.3
@ -114,6 +123,7 @@ class egw_db
var $Debug = 0; var $Debug = 0;
/** /**
* @deprecated use exceptions (try/catch block) to handle failed connections or sql errors
* @var string $Halt_On_Error "yes" (halt with message), "no" (ignore errors quietly), "report" (ignore errror, but spit a warning) * @var string $Halt_On_Error "yes" (halt with message), "no" (ignore errors quietly), "report" (ignore errror, but spit a warning)
*/ */
var $Halt_On_Error = 'yes'; var $Halt_On_Error = 'yes';