summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/mssql/adodbapi.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2016-11-10 17:08:06 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2016-11-11 13:30:25 -0500
commit5fba7db9be7a03076d50051fb84dade31d55262e (patch)
tree08b4da15962dbac0eae834f69005be2de9a221fe /lib/sqlalchemy/dialects/mssql/adodbapi.py
parent91e7d46fe1dc037a4817667813abb0a0bf164a1a (diff)
downloadsqlalchemy-5fba7db9be7a03076d50051fb84dade31d55262e.tar.gz
Quote URL tokens with semicolons for pyodbc, adodbapi
Fixed bug in pyodbc dialect (as well as in the mostly non-working adodbapi dialect) whereby a semicolon present in the password or username fields could be interpreted as a separator for another token; the values are now quoted when semicolons are present. Change-Id: I5f99fd8db53ebf8e805e7d9d60bc09b8f1af603f Fixes: #3762
Diffstat (limited to 'lib/sqlalchemy/dialects/mssql/adodbapi.py')
-rw-r--r--lib/sqlalchemy/dialects/mssql/adodbapi.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/sqlalchemy/dialects/mssql/adodbapi.py b/lib/sqlalchemy/dialects/mssql/adodbapi.py
index 60fa25d34..a85ce5a57 100644
--- a/lib/sqlalchemy/dialects/mssql/adodbapi.py
+++ b/lib/sqlalchemy/dialects/mssql/adodbapi.py
@@ -56,7 +56,14 @@ class MSDialect_adodbapi(MSDialect):
)
def create_connect_args(self, url):
- keys = url.query
+ 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: