From e355f5236490e27892024fbe586eba2ee8544674 Mon Sep 17 00:00:00 2001 From: liugang Date: Thu, 17 Oct 2024 10:49:04 +0800 Subject: [PATCH] * [perf] fix error of fetching where clause. --- lib/zredis/zredis.class.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/zredis/zredis.class.php b/lib/zredis/zredis.class.php index d35b95ede6..fdf8e23029 100644 --- a/lib/zredis/zredis.class.php +++ b/lib/zredis/zredis.class.php @@ -177,13 +177,20 @@ class zredis $splitPOS = $orderPOS ? $orderPOS : $limitPOS; $splitPOS = $havingPOS ? $havingPOS : $splitPOS; $splitPOS = $groupPOS ? $groupPOS : $splitPOS; - $condition = substr($sql, $wherePOS + $whereLen, $splitPOS - $wherePOS - $whereLen); + if($splitPOS) + { + $condition = substr($sql, $wherePOS + $whereLen, $splitPOS - $wherePOS - $whereLen); + } + else + { + $condition = substr($sql, $wherePOS + $whereLen); + } if($event == 'delete') { /* 执行删除操作后数据已经被删除,所以需要提前获取 ID 列表。*/ $field = $this->config->redis->tables[$table]->key; - $keyList = $this->dao->select($field)->from($table)->where($condition)->fetchPairs(); + $keyList = $this->dao->select($field)->from($table)->beginIF($condition)->where($condition)->fi()->fetchPairs(); } }