diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-09-01 00:11:10 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-09-11 14:17:10 -0400 |
commit | 31f80b9eaeb3c3435b7f6679b41e434478b1d11c (patch) | |
tree | 9802d4470d78768ba2a8812b47fae0f91e689d5c /lib/sqlalchemy/engine | |
parent | 4c97ea116c3686cb03f566f16b0a0e9a9fd33968 (diff) | |
download | sqlalchemy-oracle_numeric.tar.gz |
Refactor for cx_Oracle version 6oracle_numeric
Drops support for cx_Oracle prior to version 5.x, reworks
numeric and binary support.
Fixes: #4064
Change-Id: Ib9ae9aba430c15cd2a6eeb4e5e3fd8e97b5fe480
Diffstat (limited to 'lib/sqlalchemy/engine')
-rw-r--r-- | lib/sqlalchemy/engine/default.py | 10 | ||||
-rw-r--r-- | lib/sqlalchemy/engine/interfaces.py | 10 | ||||
-rw-r--r-- | lib/sqlalchemy/engine/result.py | 16 |
3 files changed, 13 insertions, 23 deletions
diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py index 8b72c0001..227ff0845 100644 --- a/lib/sqlalchemy/engine/default.py +++ b/lib/sqlalchemy/engine/default.py @@ -108,7 +108,6 @@ class DefaultDialect(interfaces.Dialect): supports_sane_rowcount = True supports_sane_multi_rowcount = True - dbapi_type_map = {} colspecs = {} default_paramstyle = 'named' supports_default_values = False @@ -1112,7 +1111,8 @@ class DefaultExecutionContext(interfaces.ExecutionContext): return (self.isinsert or self.isupdate) and \ bool(self.compiled.postfetch) - def set_input_sizes(self, translate=None, exclude_types=None): + def set_input_sizes( + self, translate=None, include_types=None, exclude_types=None): """Given a cursor and ClauseParameters, call the appropriate style of ``setinputsizes()`` on the cursor, using DB-API types from the bind parameter's ``TypeEngine`` objects. @@ -1136,7 +1136,8 @@ class DefaultExecutionContext(interfaces.ExecutionContext): 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): + (not exclude_types or dbtype not in exclude_types) and \ + (not include_types or dbtype in include_types): if key in self._expanded_parameters: inputsizes.extend( [dbtype] * len(self._expanded_parameters[key])) @@ -1154,7 +1155,8 @@ class DefaultExecutionContext(interfaces.ExecutionContext): 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): + (not exclude_types or dbtype not in exclude_types) and \ + (not include_types or dbtype in include_types): if translate: # TODO: this part won't work w/ the # expanded_parameters feature, e.g. for cx_oracle diff --git a/lib/sqlalchemy/engine/interfaces.py b/lib/sqlalchemy/engine/interfaces.py index 3e09e4971..518038d29 100644 --- a/lib/sqlalchemy/engine/interfaces.py +++ b/lib/sqlalchemy/engine/interfaces.py @@ -110,16 +110,6 @@ class Dialect(object): the "implicit" functionality is not used and inserted_primary_key will not be available. - dbapi_type_map - A mapping of DB-API type objects present in this Dialect's - DB-API implementation mapped to TypeEngine implementations used - by the dialect. - - This is used to apply types to result sets based on the DB-API - types present in cursor.description; it only takes effect for - result sets against textual statements where no explicit - typemap was present. - colspecs A dictionary of TypeEngine classes from sqlalchemy.types mapped to subclasses that are specific to the dialect class. This diff --git a/lib/sqlalchemy/engine/result.py b/lib/sqlalchemy/engine/result.py index 907dc7bd2..3aae932f2 100644 --- a/lib/sqlalchemy/engine/result.py +++ b/lib/sqlalchemy/engine/result.py @@ -447,7 +447,6 @@ class ResultMetaData(object): def _merge_textual_cols_by_position( self, context, cursor_description, result_columns): dialect = context.dialect - typemap = dialect.dbapi_type_map num_ctx_cols = len(result_columns) if result_columns else None if num_ctx_cols > len(cursor_description): @@ -470,14 +469,13 @@ class ResultMetaData(object): "in textual SQL: %r" % obj[0]) seen.add(obj[0]) else: - mapped_type = typemap.get(coltype, sqltypes.NULLTYPE) + mapped_type = sqltypes.NULLTYPE obj = None yield idx, colname, mapped_type, coltype, obj, untranslated def _merge_cols_by_name(self, context, cursor_description, result_columns): dialect = context.dialect - typemap = dialect.dbapi_type_map case_sensitive = dialect.case_sensitive result_map = self._create_result_map(result_columns, case_sensitive) @@ -487,7 +485,7 @@ class ResultMetaData(object): try: ctx_rec = result_map[colname] except KeyError: - mapped_type = typemap.get(coltype, sqltypes.NULLTYPE) + mapped_type = sqltypes.NULLTYPE obj = None else: obj = ctx_rec[1] @@ -496,11 +494,9 @@ class ResultMetaData(object): def _merge_cols_by_none(self, context, cursor_description): dialect = context.dialect - typemap = dialect.dbapi_type_map for idx, colname, untranslated, coltype in \ self._colnames_from_description(context, cursor_description): - mapped_type = typemap.get(coltype, sqltypes.NULLTYPE) - yield idx, colname, mapped_type, coltype, None, untranslated + yield idx, colname, sqltypes.NULLTYPE, coltype, None, untranslated @classmethod def _create_result_map(cls, result_columns, case_sensitive=True): @@ -1385,8 +1381,10 @@ class BufferedColumnResultProxy(ResultProxy): fetchone() is called. If fetchmany() or fetchall() are called, the full grid of results is fetched. This is to operate with databases where result rows contain "live" results that fall out - of scope unless explicitly fetched. Currently this includes - cx_Oracle LOB objects. + of scope unless explicitly fetched. + + .. versionchanged:: 1.2 This :class:`.ResultProxy` is not used by + any SQLAlchemy-included dialects. """ |