plugins/libkolab

Thomas Brüderli bruederli at kolabsys.com
Mon Feb 10 09:27:28 CET 2014


 plugins/libkolab/lib/kolab_storage_cache.php |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 22a1c7a7eeceb6a22e2727db63f01a41e3d7d7c0
Author: Thomas Bruederli <thomas at roundcube.net>
Date:   Mon Feb 10 09:27:16 2014 +0100

    Don't set error state on simple arrays; simplify query

diff --git a/plugins/libkolab/lib/kolab_storage_cache.php b/plugins/libkolab/lib/kolab_storage_cache.php
index 477fd66..20b2812 100644
--- a/plugins/libkolab/lib/kolab_storage_cache.php
+++ b/plugins/libkolab/lib/kolab_storage_cache.php
@@ -447,19 +447,19 @@ class kolab_storage_cache
             // fetch full object data on one query if a small result set is expected
             $fetchall = !$uids && $this->count($query) < 500;
             $sql_result = $this->db->query(
-                "SELECT " . (!$fetchall ? 'msguid, msguid AS _msguid, uid' : '*') . " FROM $this->cache_table ".
+                "SELECT " . ($fetchall ? '*' : 'msguid AS _msguid, uid') . " FROM $this->cache_table ".
                 "WHERE folder_id=? " . $this->_sql_where($query),
                 $this->folder_id
             );
 
             if ($this->db->is_error($sql_result)) {
-                $result->set_error(true);
+                if (!$uids) $result->set_error(true);
                 return $result;
             }
 
             while ($sql_arr = $this->db->fetch_assoc($sql_result)) {
                 if ($uids) {
-                    $this->uid2msg[$sql_arr['uid']] = $sql_arr['msguid'];
+                    $this->uid2msg[$sql_arr['uid']] = $sql_arr['_msguid'];
                     $result[] = $sql_arr['uid'];
                 }
                 else if ($fetchall && ($object = $this->_unserialize($sql_arr))) {
@@ -484,7 +484,7 @@ class kolab_storage_cache
             }
 
             if ($index->is_error()) {
-                $result->set_error(true);
+                if (!$uids) $result->set_error(true);
                 return $result;
             }
 




More information about the commits mailing list