From d8d41658d3fb87c71c3e30825003f827f4ffbdae Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Sat, 09 Aug 2008 16:20:59 -0400
Subject: [PATCH] - Case insensitive contacts searching using PostgreSQL (#1485259)

---
 program/include/rcube_mdb2.php |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/program/include/rcube_mdb2.php b/program/include/rcube_mdb2.php
index 9f2f30c..0adb6e2 100644
--- a/program/include/rcube_mdb2.php
+++ b/program/include/rcube_mdb2.php
@@ -509,6 +509,27 @@
 
 
   /**
+   * Return SQL statement for case insensitive LIKE
+   *
+   * @param  string  Field name
+   * @param  string  Search value
+   * @return string  SQL statement to use in query
+   * @access public
+   */
+  function ilike($column, $value)
+    {
+    // TODO: use MDB2's matchPattern() function
+    switch($this->db_provider)
+      {
+      case 'pgsql':
+        return $this->quote_identifier($column).' ILIKE '.$this->quote($value);
+      default:
+        return $this->quote_identifier($column).' LIKE '.$this->quote($value);
+      }
+    }
+
+
+  /**
    * Adds a query result and returns a handle ID
    *
    * @param  object  Query handle

--
Gitblit v1.9.1