[Erp5-report] r17115 - /erp5/trunk/products/ZSQLCatalog/SQLCatalog.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Oct 23 11:56:58 CEST 2007


Author: vincent
Date: Tue Oct 23 11:56:58 2007
New Revision: 17115

URL: http://svn.erp5.org?rev=17115&view=rev
Log:
Add a query which only purpose is the ability to negate a whole where-expression.

Modified:
    erp5/trunk/products/ZSQLCatalog/SQLCatalog.py

Modified: erp5/trunk/products/ZSQLCatalog/SQLCatalog.py
URL: http://svn.erp5.org/erp5/trunk/products/ZSQLCatalog/SQLCatalog.py?rev=17115&r1=17114&r2=17115&view=diff
==============================================================================
--- erp5/trunk/products/ZSQLCatalog/SQLCatalog.py (original)
+++ erp5/trunk/products/ZSQLCatalog/SQLCatalog.py Tue Oct 23 11:56:58 2007
@@ -261,6 +261,26 @@
       subqueries) the table alias mapping.
     """
     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):
   """




More information about the Erp5-report mailing list