From 55488e613db64707d46fe14e85a7f3918313fad4 Mon Sep 17 00:00:00 2001 From: "Donald A. Lobo" Date: Sat, 13 Apr 2013 08:04:33 -0700 Subject: [PATCH] CRM-12341 - use wildcards only as suffix ---------------------------------------- * CRM-12341: prev/next cache should not do double-ended wildcard search http://issues.civicrm.org/jira/browse/CRM-12341 --- CRM/Core/BAO/PrevNextCache.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/CRM/Core/BAO/PrevNextCache.php b/CRM/Core/BAO/PrevNextCache.php index 1cdfa58927..e1536ef996 100644 --- a/CRM/Core/BAO/PrevNextCache.php +++ b/CRM/Core/BAO/PrevNextCache.php @@ -314,7 +314,7 @@ AND (entity_id1 = %2 OR entity_id2 = %2) if ($action == 'select') { $whereClause .= "AND is_selected = 0"; $sql = "UPDATE civicrm_prevnext_cache SET is_selected = 1 {$whereClause} {$entity_whereClause}"; - $params[1] = array("%{$cacheKey}%", 'String'); + $params[1] = array("{$cacheKey}%", 'String'); } elseif ($action == 'unselect') { $whereClause .= "AND is_selected = 1"; @@ -330,7 +330,7 @@ SET is_selected = 0 WHERE cacheKey LIKE %1 AND is_selected = 1 {$entity_whereClause} "; - $params[1] = array("%{$cacheKey}%", 'String'); + $params[1] = array("{$cacheKey}%", 'String'); } CRM_Core_DAO::executeQuery($sql, $params); } @@ -360,7 +360,7 @@ WHERE cacheKey LIKE %1 $entity_whereClause ORDER BY id "; - $params[1] = array("%{$cacheKey}%", 'String'); + $params[1] = array("{$cacheKey}%", 'String'); $contactIds = array($cacheKey => array()); $cIdDao = CRM_Core_DAO::executeQuery($sql, $params); @@ -383,8 +383,8 @@ WHERE cacheKey LIKE %1 AND is_selected=1 AND cacheKey NOT LIKE %2 "; - $params1[1] = array("%{$cacheKey}%", 'String'); - $params1[2] = array("%{$cacheKey}_alphabet%", 'String'); + $params1[1] = array("{$cacheKey}%", 'String'); + $params1[2] = array("{$cacheKey}_alphabet%", 'String'); $dao = CRM_Core_DAO::executeQuery($query, $params1); $val = array( ); @@ -415,8 +415,8 @@ WHERE cacheKey LIKE %1 AND is_selected = 1 AND cacheKey NOT LIKE %2 "; - $params1[1] = array("%{$cacheKey}%", 'String'); - $params1[2] = array("%{$cacheKey}_alphabet%", 'String'); + $params1[1] = array("{$cacheKey}%", 'String'); + $params1[2] = array("{$cacheKey}_alphabet%", 'String'); $paramsTotal = CRM_Core_DAO::singleValueQuery($query, $params1); $params['total'] = $paramsTotal; $obj->_pager = new CRM_Utils_Pager($params); -- 2.25.1