Commit 86bd7143 authored by Vincent Pelletier's avatar Vincent Pelletier

Add a query which only purpose is the ability to negate a whole where-expression.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17115 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7806f850
......@@ -262,6 +262,26 @@ class QueryMixin:
"""
raise NotImplementedError
class NegatedQuery(QueryMixin):
"""
Do a boolean negation of given query.
"""
def __init__(self, query):
self._query = query
def asSQLExpression(self, *args, **kw):
sql_expression_dict = self._query.asSQLExpression(*args, **kw)
sql_expression_dict['where_expression'] = '(NOT (%s))' % \
(sql_expression_dict['where_expression'], )
return sql_expression_dict
def getSQLKeyList(self, *args, **kw):
return self._query.getSQLKeyList(*args, **kw)
def getRelatedTableMapDict(self, *args, **kw):
return self._query.getRelatedTableMapDict(*args, **kw)
class Query(QueryMixin):
"""
This allow to define constraints on a sql column
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment