fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7694] API: errorhandling


From: Sigurd Nes
Subject: [Fmsystem-commits] [7694] API: errorhandling
Date: Wed, 21 Sep 2011 16:14:51 +0000

Revision: 7694
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7694
Author:   sigurdne
Date:     2011-09-21 16:14:51 +0000 (Wed, 21 Sep 2011)
Log Message:
-----------
API: errorhandling

Modified Paths:
--------------
    trunk/phpgwapi/inc/class.db.inc.php
    trunk/phpgwapi/inc/class.db_pdo.inc.php

Modified: trunk/phpgwapi/inc/class.db.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.db.inc.php 2011-09-21 13:34:15 UTC (rev 7693)
+++ trunk/phpgwapi/inc/class.db.inc.php 2011-09-21 16:14:51 UTC (rev 7694)
@@ -89,9 +89,9 @@
                var $debug = false;
 
                /**
-               * @var string $Halt_On_Error should connection and script be 
terminated on error?
+               * @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'; // should be true or false
+               var $Halt_On_Error = 'yes';
 
                /*
                 * @var boolean $Exception_On_Error should SQL throw exception 
on error ?

Modified: trunk/phpgwapi/inc/class.db_pdo.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.db_pdo.inc.php     2011-09-21 13:34:15 UTC (rev 
7693)
+++ trunk/phpgwapi/inc/class.db_pdo.inc.php     2011-09-21 16:14:51 UTC (rev 
7694)
@@ -213,9 +213,16 @@
                                return false;
                        }
 
-                       if($this->Halt_On_Error == 'yes')
+                       switch ( $this->Halt_On_Error )
                        {
-                               $this->db->setAttribute(PDO::ATTR_ERRMODE, 
PDO::ERRMODE_EXCEPTION);
+                               case 'yes':
+                                       
$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+                                       break;
+                               case 'report':
+                                       
$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
+                                       break;
+                               default:
+                                       
$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
                        }
                }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]