]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
repaired FB functions, [ticket:862]
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 18 Nov 2007 21:20:32 +0000 (21:20 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 18 Nov 2007 21:20:32 +0000 (21:20 +0000)
lib/sqlalchemy/databases/firebird.py
test/dialect/firebird.py

index 5316f528dc7a03cdc6982f5f87bae5b54c282246..7580a750aafe6c84dda979b072d8f2ea9526d4a2 100644 (file)
@@ -354,11 +354,11 @@ class FBCompiler(compiler.DefaultCompiler):
         else:
             return self.process(alias.original, **kwargs)
 
-    def visit_function(self, func):
+    def apply_function_parens(self, func):
         if func.clauses:
-            return super(FBCompiler, self).visit_function(func)
+            return super(FBCompiler, self).apply_function_parens(func)
         else:
-            return func.name
+            return False
 
     def default_from(self):
         return " FROM rdb$database"
index 98750730682463ac5ec5f12ba4a05cf06539b1e6..daf2abba670d6d4da863336473f0609bdd51ba2c 100644 (file)
@@ -20,6 +20,12 @@ class CompileTest(SQLCompileTest):
         s = select([t.alias()])
         self.assert_compile(s, "SELECT sometable_1.col1, sometable_1.col2 FROM sometable sometable_1")
 
-
+    def test_function(self):
+        self.assert_compile(func.foo(1, 2), "foo(:foo, :foo_1)")
+        self.assert_compile(func.current_time(), "current_time")
+        self.assert_compile(func.foo(), "foo")
+        t = table('sometable', column('col1'), column('col2'))
+        self.assert_compile(select([func.max(t.c.col1)]), "SELECT max(sometable.col1) FROM sometable")
+        
 if __name__ == '__main__':
     testbase.main()