From 6955c70f286dee3d003736c911ad9d3203b0be6c Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Mon, 20 Jul 2009 07:12:33 -0400
Subject: [PATCH] - handle errors in insert_id()

---
 program/include/rcube_mdb2.php |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/program/include/rcube_mdb2.php b/program/include/rcube_mdb2.php
index a83b463..86d798a 100644
--- a/program/include/rcube_mdb2.php
+++ b/program/include/rcube_mdb2.php
@@ -330,7 +330,9 @@
     if (!$this->db_handle || $this->db_mode=='r')
       return FALSE;
 
-    return $this->db_handle->lastInsertID($sequence);
+    $id = $this->db_handle->lastInsertID($sequence);
+    
+    return $this->db_handle->isError($id) ? null : $id;
     }
 
 

--
Gitblit v1.9.1