From 2c633703e97eb6e7aa7ba840ef86b1fc1bd98ada Mon Sep 17 00:00:00 2001
From: svncommit <devs@roundcube.net>
Date: Wed, 23 May 2007 23:49:19 -0400
Subject: [PATCH] upgrade to TinyMCE v2.1.1.1

---
 program/include/rcube_db.inc |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/program/include/rcube_db.inc b/program/include/rcube_db.inc
old mode 100755
new mode 100644
index a01b38d..626cb64
--- a/program/include/rcube_db.inc
+++ b/program/include/rcube_db.inc
@@ -5,7 +5,7 @@
  | program/include/rcube_db.inc                                          |
  |                                                                       |
  | This file is part of the RoundCube Webmail client                     |
- | Copyright (C) 2005, RoundCube Dev. - Switzerland                      |
+ | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland                 |
  | Licensed under the GNU GPL                                            |
  |                                                                       |
  | PURPOSE:                                                              |
@@ -102,7 +102,7 @@
       $this->db_error = TRUE;
       $this->db_error_msg = $dbh->getMessage();
 
-      raise_error(array('code' => 500, 'type' => 'db', 'line' => __LINE__, 'file' => __FILE__,
+      raise_error(array('code' => 603, 'type' => 'db', 'line' => __LINE__, 'file' => __FILE__,
                         'message' => $this->db_error_msg), TRUE, FALSE);
                         
       return FALSE;
@@ -293,14 +293,16 @@
       {
       case 'pgsql':
         $result = &$this->db_handle->getOne("SELECT CURRVAL('$sequence')");
-        
-      case 'mssql':
-       	$result = &$this->db_handle->getOne("SELECT @@IDENTITY");
-
         if (DB::isError($result))
           raise_error(array('code' => 500, 'type' => 'db', 'line' => __LINE__, 'file' => __FILE__, 
                             'message' => $result->getMessage()), TRUE, FALSE);
+        return $result;
 
+      case 'mssql':
+        $result = &$this->db_handle->getOne("SELECT @@IDENTITY");
+        if (DB::isError($result))
+          raise_error(array('code' => 500, 'type' => 'db', 'line' => __LINE__, 'file' => __FILE__, 
+                            'message' => $result->getMessage()), TRUE, FALSE);
         return $result;
                 
       case 'mysql': // This is unfortuneate
@@ -308,7 +310,7 @@
 
       case 'mysqli':
         return mysqli_insert_id($this->db_handle->connection);
-	
+
       case 'sqlite':
         return sqlite_last_insert_rowid($this->db_handle->connection);
 
@@ -358,12 +360,14 @@
    */
   function _fetch_row($result, $mode)
     {
-    if (DB::isError($result))
+    if (!$result || DB::isError($result))
       {
       raise_error(array('code' => 500, 'type' => 'db', 'line' => __LINE__, 'file' => __FILE__,
                         'message' => $this->db_link->getMessage()), TRUE, FALSE);
       return FALSE;
       }
+      elseif (!is_object($result))
+      return FALSE;
                          
     return $result->fetchRow($mode);
     }

--
Gitblit v1.9.1