- Column.copy() takes along the "unique" attribute
among others, fixes [ticket:1829] regarding declarative
mixins
+
+- mysql
+ - MySQL dialect doesn't emit CAST() for MySQL version
+ detected < 4.0.2. This allows the unicode
+ check on connect to proceed. [ticket:1826]
- firebird
- Fixed incorrect signature in do_execute(), error
def visit_cast(self, cast, **kwargs):
# No cast until 4, no decimals until 5.
+ if not self.dialect._supports_cast:
+ return self.process(cast.clause)
+
type_ = self.process(cast.typeclause)
if type_ is None:
return self.process(cast.clause)
if self._server_ansiquotes:
# if ansiquotes == True, build a new IdentifierPreparer
# with the new setting
- self.identifier_preparer = self.preparer(self, server_ansiquotes=self._server_ansiquotes)
+ self.identifier_preparer = self.preparer(self,
+ server_ansiquotes=self._server_ansiquotes)
+ @property
+ def _supports_cast(self):
+ return self.server_version_info is None or \
+ self.server_version_info >= (4, 0, 2)
+
@reflection.cache
def get_schema_names(self, connection, **kw):
rp = connection.execute("SHOW schemas")
for type_, expected in specs:
self.assert_compile(cast(t.c.col, type_), expected)
-
+
+ def test_no_cast_pre_4(self):
+ self.assert_compile(
+ cast(Column('foo', Integer), String),
+ "CAST(foo AS CHAR)",
+ )
+ dialect = mysql.dialect()
+ dialect.server_version_info = (3, 2, 3)
+ self.assert_compile(
+ cast(Column('foo', Integer), String),
+ "foo",
+ dialect=dialect
+ )
+
def test_extract(self):
t = sql.table('t', sql.column('col1'))