diff options
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/dialects/oracle/cx_oracle.py | 8 | ||||
| -rw-r--r-- | lib/sqlalchemy/engine/default.py | 33 |
2 files changed, 22 insertions, 19 deletions
diff --git a/lib/sqlalchemy/dialects/oracle/cx_oracle.py b/lib/sqlalchemy/dialects/oracle/cx_oracle.py index 1605c3a67..0bd682d19 100644 --- a/lib/sqlalchemy/dialects/oracle/cx_oracle.py +++ b/lib/sqlalchemy/dialects/oracle/cx_oracle.py @@ -240,6 +240,7 @@ class _OracleInteger(sqltypes.Integer): return handler + class _OracleNumeric(sqltypes.Numeric): is_number = False @@ -326,8 +327,6 @@ class _OracleNUMBER(_OracleNumeric): is_number = True - - class _OracleDate(sqltypes.Date): def bind_processor(self, dialect): return None @@ -595,7 +594,7 @@ class OracleDialect_cx_oracle(OracleDialect): driver = "cx_oracle" - colspecs = colspecs = { + colspecs = { sqltypes.Numeric: _OracleNumeric, sqltypes.Float: _OracleNumeric, sqltypes.Integer: _OracleInteger, @@ -654,7 +653,8 @@ class OracleDialect_cx_oracle(OracleDialect): self._include_setinputsizes = { cx_Oracle.NCLOB, cx_Oracle.CLOB, cx_Oracle.LOB, cx_Oracle.NCHAR, cx_Oracle.FIXED_NCHAR, - cx_Oracle.BLOB, cx_Oracle.FIXED_CHAR, cx_Oracle.TIMESTAMP + cx_Oracle.BLOB, cx_Oracle.FIXED_CHAR, cx_Oracle.TIMESTAMP, + _OracleInteger } self._is_cx_oracle_6 = self.cx_oracle_ver >= (6, ) diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py index 099e694b6..ea806deae 100644 --- a/lib/sqlalchemy/engine/default.py +++ b/lib/sqlalchemy/engine/default.py @@ -1126,19 +1126,26 @@ class DefaultExecutionContext(interfaces.ExecutionContext): if not hasattr(self.compiled, 'bind_names'): return - types = dict( - (self.compiled.bind_names[bindparam], bindparam.type) - for bindparam in self.compiled.bind_names) + key_to_dbapi_type = {} + for bindparam in self.compiled.bind_names: + key = self.compiled.bind_names[bindparam] + dialect_impl = bindparam.type.dialect_impl(self.dialect) + dialect_impl_cls = type(dialect_impl) + dbtype = dialect_impl.get_dbapi_type(self.dialect.dbapi) + if dbtype is not None and ( + not exclude_types or dbtype not in exclude_types and + dialect_impl_cls not in exclude_types + ) and ( + not include_types or dbtype in include_types or + dialect_impl_cls in include_types + ): + key_to_dbapi_type[key] = dbtype if self.dialect.positional: inputsizes = [] for key in self.compiled.positiontup: - typeengine = types[key] - dbtype = typeengine.dialect_impl(self.dialect).\ - get_dbapi_type(self.dialect.dbapi) - if dbtype is not None and \ - (not exclude_types or dbtype not in exclude_types) and \ - (not include_types or dbtype in include_types): + if key in key_to_dbapi_type: + dbtype = key_to_dbapi_type[key] if key in self._expanded_parameters: inputsizes.extend( [dbtype] * len(self._expanded_parameters[key])) @@ -1152,12 +1159,8 @@ class DefaultExecutionContext(interfaces.ExecutionContext): else: inputsizes = {} for key in self.compiled.bind_names.values(): - typeengine = types[key] - dbtype = typeengine.dialect_impl(self.dialect).\ - get_dbapi_type(self.dialect.dbapi) - if dbtype is not None and \ - (not exclude_types or dbtype not in exclude_types) and \ - (not include_types or dbtype in include_types): + if key in key_to_dbapi_type: + dbtype = key_to_dbapi_type[key] if translate: # TODO: this part won't work w/ the # expanded_parameters feature, e.g. for cx_oracle |
