From 7de80b4322206937af0e6f739d73ff918d7a9ee3 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 22 Jun 2010 17:05:21 +0000 Subject: [PATCH] backporting r30991-4: using egw_db->capabilities[egw_db::CASE_INSENSITIVE_LIKE] and other PostgreSQL 8.3 fixes --- calendar/inc/class.calendar_so.inc.php | 2 +- phpgwapi/inc/class.egw_db.inc.php | 2 +- phpgwapi/inc/class.translation.inc.php | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/calendar/inc/class.calendar_so.inc.php b/calendar/inc/class.calendar_so.inc.php index f2d3f53a0c..fa86584c4b 100644 --- a/calendar/inc/class.calendar_so.inc.php +++ b/calendar/inc/class.calendar_so.inc.php @@ -280,7 +280,7 @@ class calendar_so { foreach(array('cal_title','cal_description','cal_location') as $col) { - $to_or[] = $col . ' LIKE ' . $this->db->quote('%'.$query.'%'); + $to_or[] = $col.' '.$this->db->capabilities[egw_db::CAPABILITY_CASE_INSENSITIV_LIKE].' '.$this->db->quote('%'.$query.'%'); } $where[] = '('.implode(' OR ',$to_or).')'; } diff --git a/phpgwapi/inc/class.egw_db.inc.php b/phpgwapi/inc/class.egw_db.inc.php index 28fbc85e79..cef7788f76 100644 --- a/phpgwapi/inc/class.egw_db.inc.php +++ b/phpgwapi/inc/class.egw_db.inc.php @@ -504,7 +504,7 @@ class egw_db $this->capabilities[self::CAPABILITY_NAME_CASE] = 'lower'; $this->capabilities[self::CAPABILITY_CLIENT_ENCODING] = (float) $db_version >= 7.4; $this->capabilities[self::CAPABILITY_OUTER_JOIN] = true; - $this->capabilities[self::CAPABILITY_CASE_INSENSITIV_LIKE] = 'ILIKE'; + $this->capabilities[self::CAPABILITY_CASE_INSENSITIV_LIKE] = '::text ILIKE'; $this->capabilities[self::CAPABILITY_REQUIRE_TRUNCATE_VARCHAR] = true; break; diff --git a/phpgwapi/inc/class.translation.inc.php b/phpgwapi/inc/class.translation.inc.php index b63b34d667..eb5127f5e0 100644 --- a/phpgwapi/inc/class.translation.inc.php +++ b/phpgwapi/inc/class.translation.inc.php @@ -931,8 +931,7 @@ class translation */ static function get_message_id($translation,$app=null,$lang=null) { - $like = self::$db->Type == 'pgsql' ? 'ILIKE' : 'LIKE'; - $where = array('content '.$like.' '.self::$db->quote($translation)); // like to be case-insensitive + $where = array('content '.self::$db->capabilities[egw_db::CAPABILITY_CASE_INSENSITIV_LIKE].' '.self::$db->quote($translation)); if ($app) $where['app_name'] = $app; if ($lang) $where['lang'] = $lang;