Changeset:
        7faf747c7fdc
        
https://sourceforge.net/p/mrbs/hg-code/ci/7faf747c7fdc4d04ffbc333d73607518ae63a4f5
Author:
        Campbell Morrison <[email protected]>
Date:
        Thu Sep 29 15:19:32 2016 +0100
Log message:

Removed error checking from calls to DB::command()

diffstat:

 web/lib/MRBS/DB.php       |  12 ------------
 web/lib/MRBS/DB_mysql.php |   6 ------
 web/lib/MRBS/DB_pgsql.php |  15 +++++++--------
 3 files changed, 7 insertions(+), 26 deletions(-)

diffs (82 lines):

diff -r ec8e273d2560 -r 7faf747c7fdc web/lib/MRBS/DB.php
--- a/web/lib/MRBS/DB.php       Thu Sep 29 14:23:51 2016 +0100
+++ b/web/lib/MRBS/DB.php       Thu Sep 29 15:19:32 2016 +0100
@@ -210,12 +210,6 @@
   function commit()
   {
     $result = $this->command("COMMIT");
-  
-    if ($result < 0)
-    {
-      trigger_error ($this->error(), E_USER_WARNING);
-    }
-    
     mrbs_ignore_user_abort(FALSE);
   }
 
@@ -224,12 +218,6 @@
   function rollback()
   {
     $result = $this->command("ROLLBACK", array());
-  
-    if ($result < 0)
-    {
-      trigger_error ($this->error(), E_USER_WARNING);
-    }
-    
     mrbs_ignore_user_abort(FALSE);
   }
 
diff -r ec8e273d2560 -r 7faf747c7fdc web/lib/MRBS/DB_mysql.php
--- a/web/lib/MRBS/DB_mysql.php Thu Sep 29 14:23:51 2016 +0100
+++ b/web/lib/MRBS/DB_mysql.php Thu Sep 29 15:19:32 2016 +0100
@@ -36,13 +36,7 @@
   public function begin()
   {
     parent::begin();
-    
     $result = $this->command("START TRANSACTION");
-  
-    if ($result < 0)
-    {
-      trigger_error ($this->error(), E_USER_WARNING);
-    }
   }
 
   
diff -r ec8e273d2560 -r 7faf747c7fdc web/lib/MRBS/DB_pgsql.php
--- a/web/lib/MRBS/DB_pgsql.php Thu Sep 29 14:23:51 2016 +0100
+++ b/web/lib/MRBS/DB_pgsql.php Thu Sep 29 15:19:32 2016 +0100
@@ -68,13 +68,7 @@
   public function begin()
   {
     parent::begin();
-    
     $result = $this->command("BEGIN");
-  
-    if ($result < 0)
-    {
-      trigger_error ($this->error(), E_USER_WARNING);
-    }
   }
 
   
@@ -92,11 +86,16 @@
   // It does not timeout, but waits forever for the lock.
   public function mutex_lock($name)
   {
-    if (($this->command("BEGIN") < 0) ||
-        ($this->command("LOCK TABLE $name IN EXCLUSIVE MODE") < 0))
+    try
+    {
+      $this->command("BEGIN");
+      $this->command("LOCK TABLE $name IN EXCLUSIVE MODE");
+    }
+    catch (DBException $e)
     {
       return 0;
     }
+
     $this->mutex_lock_name = $name;
 
     return 1;

------------------------------------------------------------------------------
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to