From c94ccaf932b769a85ae43aa1ebaeff250e49cc58 Mon Sep 17 00:00:00 2001 From: Rick Morrison Date: Thu, 17 Apr 2008 19:07:12 +0000 Subject: Added 'odbc_options' keyword to the MSSQL dialect. Allows a partial ODBC connection string to be passed through to the connection string generator. --- lib/sqlalchemy/databases/mssql.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/sqlalchemy/databases/mssql.py') diff --git a/lib/sqlalchemy/databases/mssql.py b/lib/sqlalchemy/databases/mssql.py index 6cc5f4fd3..55d4b7cf2 100644 --- a/lib/sqlalchemy/databases/mssql.py +++ b/lib/sqlalchemy/databases/mssql.py @@ -345,7 +345,6 @@ class MSSQLExecutionContext(default.DefaultExecutionContext): self.cursor.execute("SELECT @@identity AS lastrowid") row = self.cursor.fetchone() self._last_inserted_ids = [int(row[0])] + self._last_inserted_ids[1:] - # print "LAST ROW ID", self._last_inserted_ids super(MSSQLExecutionContext, self).post_exec() _ms_is_select = re.compile(r'\s*(?:SELECT|sp_columns|EXEC)', @@ -799,7 +798,12 @@ class MSSQLDialect_pyodbc(MSSQLDialect): # This should obviously be set to 'No' if you query a cp1253 encoded # database from a latin1 client... if 'odbc_autotranslate' in keys: - connectors.append("AutoTranslate=%s" % keys.pop("odbc_autotranslate")) + connectors.append("AutoTranslate=%s" % keys.pop("odbc_autotranslate")) + + # Allow specification of partial ODBC connect string + if 'odbc_options' in keys: + connectors.append(keys.pop('odbc_options')) + return [[";".join (connectors)], {}] def is_disconnect(self, e): -- cgit v1.2.1