--- a/server/sources/rql2sql.py Tue Aug 02 17:31:04 2011 +0200
+++ b/server/sources/rql2sql.py Tue Aug 02 17:31:06 2011 +0200
@@ -1442,6 +1442,10 @@
pass
return '(%s %s %s)'% (lhs.accept(self), operator, rhs.accept(self))
+ def visit_unaryexpression(self, uexpr):
+ """generate SQL for a unary expression"""
+ return '%s%s'% (uexpr.operator, uexpr.children[0].accept(self))
+
def visit_function(self, func):
"""generate SQL name for a function"""
if func.name == 'FTIRANK':
--- a/server/test/unittest_rql2sql.py Tue Aug 02 17:31:04 2011 +0200
+++ b/server/test/unittest_rql2sql.py Tue Aug 02 17:31:06 2011 +0200
@@ -88,7 +88,6 @@
]
BASIC = [
-
("Any AS WHERE AS is Affaire",
'''SELECT _AS.cw_eid
FROM cw_Affaire AS _AS'''),
@@ -201,7 +200,12 @@
('Any X WHERE X title V, NOT X wikiid V, NOT X title "parent", X is Card',
'''SELECT _X.cw_eid
FROM cw_Card AS _X
-WHERE NOT (_X.cw_wikiid=_X.cw_title) AND NOT (_X.cw_title=parent)''')
+WHERE NOT (_X.cw_wikiid=_X.cw_title) AND NOT (_X.cw_title=parent)'''),
+
+ ("Any -AS WHERE AS is Affaire",
+ '''SELECT -_AS.cw_eid
+FROM cw_Affaire AS _AS'''),
+
]
BASIC_WITH_LIMIT = [