diff options
| author | Federico Caselli <cfederico87@gmail.com> | 2020-04-18 20:58:41 +0200 |
|---|---|---|
| committer | Federico Caselli <cfederico87@gmail.com> | 2020-04-29 17:50:44 +0000 |
| commit | 18ce4f9937c2d6753acbb054b4990c7da298a5d7 (patch) | |
| tree | c385de2c16ef63586a1c604efe9393bddbb20acf /lib/sqlalchemy/dialects/mssql/adodbapi.py | |
| parent | 0faee1bbf20cb4a2599888b427b8015ec5f3c890 (diff) | |
| download | sqlalchemy-18ce4f9937c2d6753acbb054b4990c7da298a5d7.tar.gz | |
Deprecate unsupported dialects and dbapi
- Deprecate dialects firebird and sybase.
- Deprecate DBAPI
- mxODBC for mssql
- oursql for mysql
- pygresql and py-postgresql for postgresql
- Removed adodbapi DBAPI for mssql
Fixes: #5189
Change-Id: Id9025f4f4de7e97d65aacd0eb4b0c21beb9a67b5
Diffstat (limited to 'lib/sqlalchemy/dialects/mssql/adodbapi.py')
| -rw-r--r-- | lib/sqlalchemy/dialects/mssql/adodbapi.py | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/lib/sqlalchemy/dialects/mssql/adodbapi.py b/lib/sqlalchemy/dialects/mssql/adodbapi.py deleted file mode 100644 index 15f1b6511..000000000 --- a/lib/sqlalchemy/dialects/mssql/adodbapi.py +++ /dev/null @@ -1,90 +0,0 @@ -# mssql/adodbapi.py -# Copyright (C) 2005-2020 the SQLAlchemy authors and contributors -# <see AUTHORS file> -# -# This module is part of SQLAlchemy and is released under -# the MIT License: http://www.opensource.org/licenses/mit-license.php - -""" -.. dialect:: mssql+adodbapi - :name: adodbapi - :dbapi: adodbapi - :connectstring: mssql+adodbapi://<username>:<password>@<dsnname> - :url: http://adodbapi.sourceforge.net/ - -.. note:: - - The adodbapi dialect is not implemented in SQLAlchemy versions 0.6 and - above at this time. - -""" -import datetime -import sys - -from sqlalchemy import types as sqltypes -from sqlalchemy import util -from sqlalchemy.dialects.mssql.base import MSDateTime -from sqlalchemy.dialects.mssql.base import MSDialect - - -class MSDateTime_adodbapi(MSDateTime): - def result_processor(self, dialect, coltype): - def process(value): - # adodbapi will return datetimes with empty time - # values as datetime.date() objects. - # Promote them back to full datetime.datetime() - if type(value) is datetime.date: - return datetime.datetime(value.year, value.month, value.day) - return value - - return process - - -class MSDialect_adodbapi(MSDialect): - supports_sane_rowcount = True - supports_sane_multi_rowcount = True - supports_unicode = sys.maxunicode == 65535 - supports_unicode_statements = True - driver = "adodbapi" - - @classmethod - def import_dbapi(cls): - import adodbapi as module - - return module - - colspecs = util.update_copy( - MSDialect.colspecs, {sqltypes.DateTime: MSDateTime_adodbapi} - ) - - def create_connect_args(self, url): - def check_quote(token): - if ";" in str(token): - token = "'%s'" % token - return token - - keys = dict((k, check_quote(v)) for k, v in url.query.items()) - - connectors = ["Provider=SQLOLEDB"] - if "port" in keys: - connectors.append( - "Data Source=%s, %s" % (keys.get("host"), keys.get("port")) - ) - else: - connectors.append("Data Source=%s" % keys.get("host")) - connectors.append("Initial Catalog=%s" % keys.get("database")) - user = keys.get("user") - if user: - connectors.append("User Id=%s" % user) - connectors.append("Password=%s" % keys.get("password", "")) - else: - connectors.append("Integrated Security=SSPI") - return [[";".join(connectors)], {}] - - def is_disconnect(self, e, connection, cursor): - return isinstance( - e, self.dbapi.adodbapi.DatabaseError - ) and "'connection failure'" in str(e) - - -dialect = MSDialect_adodbapi |
