]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- sending None as an argument to func.<something> will produce
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 28 Mar 2007 23:18:04 +0000 (23:18 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 28 Mar 2007 23:18:04 +0000 (23:18 +0000)
an argument of NULL

CHANGES
lib/sqlalchemy/sql.py
test/sql/select.py

diff --git a/CHANGES b/CHANGES
index dfb5f08eebaa8cfd3d2a35e0e5fadea3193f0aaf..2289a14b274aa9ab83109862905fc7ebd5700ff7 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -14,6 +14,8 @@
     - preliminary support for unicode table and column names added.
     - fix for fetchmany() "size" argument being positional in most
       dbapis [ticket:505]
+    - sending None as an argument to func.<something> will produce
+      an argument of NULL
 - orm:
     - improved/fixed custom collection classes when giving it "set"/
       "sets.Set" classes or subclasses (was still looking for append()
index 78d07bec8584be775ecc1b5589b8c5b1edde2710..9bdbc0cb8cc8962a799b2ad3988f34a8f823983b 100644 (file)
@@ -1565,7 +1565,7 @@ class _Function(_CalculatedClause, FromClause):
         self.type = sqltypes.to_instance(kwargs.get('type', None))
         self.packagenames = kwargs.get('packagenames', None) or []
         self._engine = kwargs.get('engine', None)
-        ClauseList.__init__(self, parens=True, *clauses)
+        ClauseList.__init__(self, parens=True, *[c is None and _Null() or c for c in clauses])
 
     key = property(lambda self:self.name)
 
index f71d5366b24109b85996b31836a6bc4aa5081865..7406d6c4fee5ba7c9a6509181a7e8b2533159644 100644 (file)
@@ -466,7 +466,10 @@ FROM mytable, myothertable WHERE foo.id = foofoo(lala) AND datetime(foo) = Today
 
         # test a dotted func off the engine itself
         self.runtest(func.lala.hoho(7), "lala.hoho(:hoho)")
-    
+        
+        # test None becomes NULL
+        self.runtest(func.my_func(1,2,None,3), "my_func(:my_func, :my_func_1, NULL, :my_func_2)")
+        
     def testextract(self):
         """test the EXTRACT function"""
         self.runtest(select([extract("month", table3.c.otherstuff)]), "SELECT extract(month FROM thirdtable.otherstuff) FROM thirdtable")