From cb2bc809ef29f349d38c89e202d821e67bb4c947 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Tue, 21 Sep 2010 14:47:55 -0400
Subject: [PATCH] Fix db_mode check in insert_id()

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

diff --git a/program/include/rcube_mdb2.php b/program/include/rcube_mdb2.php
index 84b6e2f..06f5915 100644
--- a/program/include/rcube_mdb2.php
+++ b/program/include/rcube_mdb2.php
@@ -123,9 +123,11 @@
     {
         // Already connected
         if ($this->db_connected) {
-            // no replication, current connection is ok
-            if (empty($this->db_dsnr) || $this->db_dsnw == $this->db_dsnr)
+            // no replication, current connection is ok for read and write
+            if (empty($this->db_dsnr) || $this->db_dsnw == $this->db_dsnr) {
+                $this->db_mode = 'w';
                 return;
+            }
 
             // connected to read-write db, current connection is ok
             if ($this->db_mode == 'w')

--
Gitblit v1.9.1