]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
merged select([literal('foo')]) fix from trunk r4933
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 15 Jul 2008 15:07:00 +0000 (15:07 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 15 Jul 2008 15:07:00 +0000 (15:07 +0000)
CHANGES
lib/sqlalchemy/sql/compiler.py
test/sql/select.py

diff --git a/CHANGES b/CHANGES
index 603aa578238757c0956b5112121f6bbbee92c796..ebc85b42972565dc5b8ed01cb3294c9c353e7180 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,7 @@
 =======
 CHANGES
 =======
+
 0.4.7
 =====
 - orm
@@ -30,6 +31,10 @@ CHANGES
     - Removed erroneous 'self' reference when raising
       UnmappedColumnError during flush() operation.
 
+- sql
+    - Fixed bug when calling select([literal('foo')])
+      or select([bindparam('foo')]).
+      
 - schema
     - create_all(), drop_all(), create(), drop() all raise
       an error if the table name or schema name contains
index 408d24c27895b722b45e31040344b572eb63236a..76877aded44e2e1f2c209100a4d5cab3b79d2158 100644 (file)
@@ -461,7 +461,7 @@ class DefaultCompiler(engine.Compiled):
             column.table is not None and \
             not isinstance(column.table, sql.Select):
             return column.label(column.name)
-        elif not isinstance(column, (sql._UnaryExpression, sql._TextClause)) and (not hasattr(column, 'name') or isinstance(column, sql._Function)):
+        elif not isinstance(column, (sql._UnaryExpression, sql._TextClause, sql._BindParamClause)) and (not hasattr(column, 'name') or isinstance(column, sql._Function)):
             return column.label(column.anon_label)
         else:
             return column
index bea8621121be7f72272399fb71c80f4aca81e65c..82795d01990cadd658bb002c53254c6baa67c42b 100644 (file)
@@ -729,6 +729,9 @@ FROM mytable, myothertable WHERE foo.id = foofoo(lala) AND datetime(foo) = Today
         
 
     def test_literal(self):
+        
+        self.assert_compile(select([literal('foo')]), "SELECT :param_1")
+        
         self.assert_compile(select([literal("foo") + literal("bar")], from_obj=[table1]),
             "SELECT :param_1 || :param_2 AS anon_1 FROM mytable")