summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/databases/mysql.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2006-06-17 00:53:33 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2006-06-17 00:53:33 +0000
commit1ffed8432e282aa57ecde9f3e4ca778a1756ddc0 (patch)
tree0849938da765ee182bc23284337b214e3202e5d1 /lib/sqlalchemy/databases/mysql.py
parent3736b3ddff65f6d4b7e273b040b48b19dbac9b66 (diff)
downloadsqlalchemy-1ffed8432e282aa57ecde9f3e4ca778a1756ddc0.tar.gz
cast converted into its own ClauseElement so that it can have an explicit compilationrel_0_2_3
function in ANSICompiler MySQLCompiler then skips most CAST calls since it only seems to support the standard syntax for Date types; other types now a TODO for MySQL then, polymorphic_union() function now CASTs null()s to the type corresponding to the columns in the UNION, since postgres doesnt like mixing NULL with integer types (long road for that .....)
Diffstat (limited to 'lib/sqlalchemy/databases/mysql.py')
-rw-r--r--lib/sqlalchemy/databases/mysql.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/sqlalchemy/databases/mysql.py b/lib/sqlalchemy/databases/mysql.py
index aa05134d0..e32d6f120 100644
--- a/lib/sqlalchemy/databases/mysql.py
+++ b/lib/sqlalchemy/databases/mysql.py
@@ -9,7 +9,6 @@ import sys, StringIO, string, types, re, datetime
from sqlalchemy import sql,engine,schema,ansisql
from sqlalchemy.engine import default
import sqlalchemy.types as sqltypes
-import sqlalchemy.databases.information_schema as ischema
import sqlalchemy.exceptions as exceptions
try:
@@ -250,6 +249,15 @@ class MySQLDialect(ansisql.ANSIDialect):
class MySQLCompiler(ansisql.ANSICompiler):
+ def visit_cast(self, cast):
+ """hey ho MySQL supports almost no types at all for CAST"""
+ if (isinstance(cast.type, sqltypes.Date) or isinstance(cast.type, sqltypes.Time) or isinstance(cast.type, sqltypes.DateTime)):
+ return super(MySQLCompiler, self).visit_cast(cast)
+ else:
+ # so just skip the CAST altogether for now.
+ # TODO: put whatever MySQL does for CAST here.
+ self.strings[cast] = self.strings[cast.clause]
+
def limit_clause(self, select):
text = ""
if select.limit is not None: