=== modified file 'src/Libraries/Hyena/Hyena.Query/QueryField.cs'
--- src/Libraries/Hyena/Hyena.Query/QueryField.cs	2008-12-29 22:18:50 +0000
+++ src/Libraries/Hyena/Hyena.Query/QueryField.cs	2009-02-08 21:13:49 +0000
@@ -146,6 +146,10 @@
             string value = qv.ToSql () ?? String.Empty;
 
             if (op == null) op = qv.OperatorSet.First;
+            if (op.SqlFormat.ToLower ().IndexOf ("LIKE", StringComparison.CurrentCultureIgnoreCase) != -1) {
+                // The LIKE operator is used, escape the query value
+                value = StringQueryValue.EscapeLike (value);
+            }
 
             StringBuilder sb = new StringBuilder ();
 

=== modified file 'src/Libraries/Hyena/Hyena.Query/StringQueryValue.cs'
--- src/Libraries/Hyena/Hyena.Query/StringQueryValue.cs	2008-07-20 23:05:30 +0000
+++ src/Libraries/Hyena/Hyena.Query/StringQueryValue.cs	2009-02-08 21:16:04 +0000
@@ -38,12 +38,14 @@
 {
     public class StringQueryValue : QueryValue
     {
-        public static readonly Operator Contains       = new Operator ("contains", Catalog.GetString ("contains"), "LIKE '%{0}%'", ":");
-        public static readonly Operator DoesNotContain = new Operator ("doesNotContain", Catalog.GetString ("doesn't contain"), "NOT LIKE '%{0}%'", true, "!:");
+        public static readonly Operator Contains       = new Operator ("contains", Catalog.GetString ("contains"), "LIKE '%{0}%'" + ESCAPE_CLAUSE, ":");
+        public static readonly Operator DoesNotContain = new Operator ("doesNotContain", Catalog.GetString ("doesn't contain"), "NOT LIKE '%{0}%'" + ESCAPE_CLAUSE, true, "!:");
         public static readonly Operator Equal          = new Operator ("equals", Catalog.GetString ("is"), "= '{0}'", "==");
         public static readonly Operator NotEqual       = new Operator ("notEqual", Catalog.GetString ("is not"), "!= '{0}'", true, "!=");
-        public static readonly Operator StartsWith     = new Operator ("startsWith", Catalog.GetString ("starts with"), "LIKE '{0}%'", "=");
-        public static readonly Operator EndsWith       = new Operator ("endsWith", Catalog.GetString ("ends with"), "LIKE '%{0}'", ":=");
+        public static readonly Operator StartsWith     = new Operator ("startsWith", Catalog.GetString ("starts with"), "LIKE '{0}%'" + ESCAPE_CLAUSE, "=");
+        public static readonly Operator EndsWith       = new Operator ("endsWith", Catalog.GetString ("ends with"), "LIKE '%{0}'" + ESCAPE_CLAUSE, ":=");
+
+        private const string ESCAPE_CLAUSE = " ESCAPE '\\'";
 
         protected string value;
 
@@ -81,5 +83,12 @@
         {
             return String.IsNullOrEmpty (value) ? null : value.Replace ("'", "''");
         }
+        
+        public static string EscapeLike (string orig)
+        {
+            return orig.Replace ("\\", "\\\\")
+                       .Replace ("%", "\\%")
+                       .Replace ("_", "\\_");
+        }
     }
 }

