]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
added _get_from_obj to TypeClause
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 17 Apr 2006 01:15:19 +0000 (01:15 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 17 Apr 2006 01:15:19 +0000 (01:15 +0000)
lib/sqlalchemy/sql.py
test/select.py

index b18b0916e91fd42a40a9039a4a8d35b652ff4c58..02e1619a1579b22ce78d5f9b40361433a44244b2 100644 (file)
@@ -702,7 +702,8 @@ class TypeClause(ClauseElement):
         self.type = type
     def accept_visitor(self, visitor):
         visitor.visit_typeclause(self)
-               
+    def _get_from_objects(self):
+        return []           
 class TextClause(ClauseElement):
     """represents literal a SQL text fragment.  public constructor is the 
     text() function.  
index adaf65ec1a8ff51708de959e69d2afad1a2e62d2..5038f8f138f60c85fd3b0bac36ab29190cb8bc64 100644 (file)
@@ -549,6 +549,9 @@ FROM mytable, myothertable WHERE mytable.myid = myothertable.otherid AND mytable
             self.assertEqual(str(cast(1234, TEXT, engine=engine)), 'CAST(%s AS %s)' %(literal, expected_results[3]))
             self.assertEqual(str(cast('test', String(20), engine=engine)), 'CAST(%s AS %s)' %(literal, expected_results[4]))
             
+            sel = select([tbl, cast(tbl.c.v1, Numeric)], engine=engine)
+            self.assertEqual(str(sel), "SELECT casttest.id, casttest.v1, casttest.v2, casttest.ts, CAST(casttest.v1 AS NUMERIC(10, 2)) \nFROM casttest")
+            
         # first test with Postgres engine
         check_results(postgres.engine({}), ['NUMERIC(10, 2)', 'NUMERIC(12, 9)', 'DATE', 'TEXT', 'VARCHAR(20)'], '%(literal)s')