Author: croberts
Date: 2012-10-23 19:49:54 +0000 (Tue, 23 Oct 2012)
New Revision: 5519
Modified:
trunk/rosemary/python/rosemary/sqlfilter.py
Log:
Adding SqlILikeFilter to do case-insensitive searching.
Modified: trunk/rosemary/python/rosemary/sqlfilter.py
===================================================================
--- trunk/rosemary/python/rosemary/sqlfilter.py 2012-10-23 14:53:24 UTC (rev 5518)
+++ trunk/rosemary/python/rosemary/sqlfilter.py 2012-10-23 19:49:54 UTC (rev 5519)
@@ -89,6 +89,13 @@
def __init__(self, this, operator="like"):
super(SqlLikeFilter, self).__init__(this, operator)
+class SqlILikeFilter(SqlValueFilter):
+ BEGINS = "B"
+ CONTAINS = "C"
+ def __init__(self, this, operator="ilike"):
+ super(SqlILikeFilter, self).__init__(this, operator)
+
+
class SqlDateValueFilter(SqlFilter):
def __init__(self, this, that, operator="="):
super(SqlDateValueFilter, self).__init__()
@@ -100,4 +107,4 @@
self.operator = operator
def emit(self):
- return "date_trunc('day', %s) %s date_trunc('day',
date('%s'))" % (self.this, self.operator, self.that)
\ No newline at end of file
+ return "%s %s date('%s')" % (self.this, self.operator,
self.that)
\ No newline at end of file
Show replies by date