From d7c91c14f8ebacc6fde60b9a6cb16cab523102f1 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Wed, 17 Sep 2014 13:58:54 -0400
Subject: [PATCH] Add Oracle driver which uses OCI8 extension - the one that supports CLOB columns

---
 program/lib/Roundcube/rcube_db.php |   36 +++++++++++++++++++++++++++---------
 1 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/program/lib/Roundcube/rcube_db.php b/program/lib/Roundcube/rcube_db.php
index b12c99d..72cad01 100644
--- a/program/lib/Roundcube/rcube_db.php
+++ b/program/lib/Roundcube/rcube_db.php
@@ -130,6 +130,20 @@
             return $this->dbh;
         }
 
+        // connect to database
+        if ($dbh = $this->conn_create($dsn)) {
+            $this->dbh          = $dbh;
+            $this->dbhs[$mode]  = $dbh;
+            $this->db_mode      = $mode;
+            $this->db_connected = true;
+        }
+    }
+
+    /**
+     * Create PDO connection
+     */
+    protected function conn_create($dsn)
+    {
         // Get database specific connection options
         $dsn_string  = $this->dsn_string($dsn);
         $dsn_options = $this->dsn_options($dsn);
@@ -151,6 +165,8 @@
 
             // don't throw exceptions or warnings
             $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
+
+            $this->conn_configure($dsn, $dbh);
         }
         catch (Exception $e) {
             $this->db_error     = true;
@@ -163,11 +179,7 @@
             return null;
         }
 
-        $this->dbh          = $dbh;
-        $this->dbhs[$mode]  = $dbh;
-        $this->db_mode      = $mode;
-        $this->db_connected = true;
-        $this->conn_configure($dsn, $dbh);
+        return $dbh;
     }
 
     /**
@@ -442,8 +454,16 @@
         // log query
         $this->debug($query);
 
+        return $this->query_execute($query);
+    }
+
+    /**
+     * Query execution
+     */
+    protected function query_execute($query)
+    {
         // destroy reference to previous result, required for SQLite driver (#1488874)
-        $this->last_result = null;
+        $this->last_result  = null;
         $this->db_error_msg = null;
 
         // send query
@@ -453,9 +473,7 @@
             $result = $this->handle_error($query);
         }
 
-        $this->last_result = $result;
-
-        return $result;
+        return $this->last_result = $result;
     }
 
     /**

--
Gitblit v1.9.1