summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-03-01 01:00:12 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2010-03-01 01:00:12 +0000
commitda1666cc18cebc485563332d2f1c3d3818affc1f (patch)
treea39e0357dd2910df389c8ebdb473848707d46b70 /lib/sqlalchemy
parentfbe6772d44bbcccfbd6ca21dc4b2d76bd21cd696 (diff)
downloadsqlalchemy-da1666cc18cebc485563332d2f1c3d3818affc1f.tar.gz
- adjusted the literal coercion rules to take the left side's type into account, if it is
compatible with what was found for the right, so that things like oracle CHAR conversions work. - oracle dialect specific tests pass again.
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/sql/expression.py2
-rw-r--r--lib/sqlalchemy/types.py11
2 files changed, 10 insertions, 3 deletions
diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py
index f3a1562c5..1c3961f1f 100644
--- a/lib/sqlalchemy/sql/expression.py
+++ b/lib/sqlalchemy/sql/expression.py
@@ -2155,6 +2155,8 @@ class _BindParamClause(ColumnElement):
if type_ is None:
self.type = sqltypes.type_map.get(type(value), _fallback_type or sqltypes.NULLTYPE)
+ if _fallback_type and _fallback_type._type_affinity == self.type._type_affinity:
+ self.type = _fallback_type
elif isinstance(type_, type):
self.type = type_()
else:
diff --git a/lib/sqlalchemy/types.py b/lib/sqlalchemy/types.py
index 7f1e38003..cdbf7927e 100644
--- a/lib/sqlalchemy/types.py
+++ b/lib/sqlalchemy/types.py
@@ -704,7 +704,8 @@ class Unicode(String):
"""
kwargs.setdefault('convert_unicode', True)
- super(Unicode, self).__init__(length=length, _warn_on_bytestring=True, **kwargs)
+ kwargs.setdefault('_warn_on_bytestring', True)
+ super(Unicode, self).__init__(length=length, **kwargs)
class UnicodeText(Text):
"""An unbounded-length Unicode string.
@@ -732,7 +733,8 @@ class UnicodeText(Text):
"""
kwargs.setdefault('convert_unicode', True)
- super(UnicodeText, self).__init__(length=length, _warn_on_bytestring=True, **kwargs)
+ kwargs.setdefault('_warn_on_bytestring', True)
+ super(UnicodeText, self).__init__(length=length, **kwargs)
class Integer(_DateAffinity, TypeEngine):
@@ -838,7 +840,10 @@ class Numeric(_DateAffinity, TypeEngine):
# try:
# from fastdec import mpd as Decimal
# except ImportError:
- return processors.to_decimal_processor_factory(_python_Decimal, self.scale)
+ if self.scale is not None:
+ return processors.to_decimal_processor_factory(_python_Decimal, self.scale)
+ else:
+ return processors.to_decimal_processor_factory(_python_Decimal)
else:
return None