Index: src/Libraries/Hyena/Hyena.Query/StringQueryValue.cs
===================================================================
--- src/Libraries/Hyena/Hyena.Query/StringQueryValue.cs	(revision 5001)
+++ src/Libraries/Hyena/Hyena.Query/StringQueryValue.cs	(working copy)
@@ -38,13 +38,17 @@
 {
     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}%'" + SQLiteEscapeClause, ":");
+        public static readonly Operator DoesNotContain = new Operator ("doesNotContain", Catalog.GetString ("doesn't contain"), "NOT LIKE '%{0}%'" + SQLiteEscapeClause, 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}%'" + SQLiteEscapeClause, "=");
+        public static readonly Operator EndsWith       = new Operator ("endsWith", Catalog.GetString ("ends with"), "LIKE '%{0}'" + SQLiteEscapeClause, ":=");
 
+        private static string SQLiteEscapeClause {
+            get { return " ESCAPE '\\'"; }
+        }
+
         protected string value;
 
         public override string XmlElementName {
@@ -79,7 +83,15 @@
 
         public override string ToSql ()
         {
-            return String.IsNullOrEmpty (value) ? null : value.Replace ("'", "''");
+            return String.IsNullOrEmpty (value) ? null : SQLiteEscape (value);
         }
+
+        private string SQLiteEscape (string orig)
+        {
+            return orig.Replace ("'", "''")
+                       .Replace ("\\", "\\\\")
+                       .Replace ("%", "\\%")
+                       .Replace ("_", "\\_");
+        }
     }
 }
