From e37a3a961c9f5bf822f86682c0f96418281d3e42 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 26 Sep 2007 14:55:44 +0000 Subject: - the behavior of String/Unicode types regarding that they auto-convert to TEXT/CLOB when no length is present now occurs *only* for an exact type of String or Unicode with no arguments. If you use VARCHAR or NCHAR (subclasses of String/Unicode) with no length, they will be interpreted by the dialect as VARCHAR/NCHAR; no "magic" conversion happens there. This is less surprising behavior and in particular this helps Oracle keep string-based bind parameters as VARCHARs and not CLOBs [ticket:793]. --- lib/sqlalchemy/sql/expression.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/sqlalchemy/sql/expression.py') diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py index dac5d7a74..d649fc0ff 100644 --- a/lib/sqlalchemy/sql/expression.py +++ b/lib/sqlalchemy/sql/expression.py @@ -1758,9 +1758,11 @@ class _BindParamClause(ClauseElement, _CompareMixin): self.type = type_ # TODO: move to types module, obviously + # using VARCHAR/NCHAR so that we dont get the genericized "String" + # type which usually resolves to TEXT/CLOB type_map = { - str : sqltypes.String, - unicode : sqltypes.Unicode, + str : sqltypes.VARCHAR, + unicode : sqltypes.NCHAR, int : sqltypes.Integer, float : sqltypes.Numeric, type(None):sqltypes.NullType -- cgit v1.2.1