[Fusionforge-commits] r8151 - trunk/gforge/common/search

Roland Mas lolando at libremir.placard.fr.eu.org
Wed Sep 23 17:18:13 CEST 2009


Author: lolando
Date: 2009-09-23 17:18:12 +0200 (Wed, 23 Sep 2009)
New Revision: 8151

Modified:
   trunk/gforge/common/search/SearchQuery.class.php
Log:
Finished removing non-portable ILIKE constructs in SQL

Modified: trunk/gforge/common/search/SearchQuery.class.php
===================================================================
--- trunk/gforge/common/search/SearchQuery.class.php	2009-09-23 15:17:57 UTC (rev 8150)
+++ trunk/gforge/common/search/SearchQuery.class.php	2009-09-23 15:18:12 UTC (rev 8151)
@@ -208,12 +208,9 @@
 	function getIlikeCondition($fieldName) {
 		global $sys_database_type;
 
-		$wordArgs = array_merge($this->words, str_replace(' ', "\\\s+",$this->phrases));
-		if ( $sys_database_type == "mysql" ) {
-			return $fieldName." LIKE '%" . implode("%' ".$this->operator." ".$fieldName." ILIKE '%", $wordArgs) ."%'";
-		} else {
-			return $fieldName." ILIKE '%" . implode("%' ".$this->operator." ".$fieldName." ILIKE '%", $wordArgs) ."%'";
-		}
+		$wordArgs = array_map ('strtolower',
+				       array_merge($this->words, str_replace(' ', "\\\s+", $this->phrases)));
+		return "lower($fieldName) LIKE '%". implode("%' ".$this->operator." lower(".$fieldName.") LIKE '%", $wordArgs) ."%'";
 	}
 
 	function getMatchCond($fieldName, $arr) {




More information about the Fusionforge-commits mailing list