From 22a1c7a7eeceb6a22e2727db63f01a41e3d7d7c0 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Mon, 10 Feb 2014 09:27:16 +0100 Subject: [PATCH] Don't set error state on simple arrays; simplify query --- plugins/libkolab/lib/kolab_storage_cache.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/libkolab/lib/kolab_storage_cache.php b/plugins/libkolab/lib/kolab_storage_cache.php index 477fd661..20b28126 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; }