From 619376e7ac5e3a2e698b789fa601d117057ab133 Mon Sep 17 00:00:00 2001 From: Brad Allen Date: Sat, 20 Mar 2010 22:00:51 -0600 Subject: [PATCH] For cases when mxODBC's cursor.execute can't do the job, raise a warning and fall back on cursor.executedirect which is less picky. This causes a drastic improvement in passing tests. --- lib/sqlalchemy/connectors/mxodbc.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/sqlalchemy/connectors/mxodbc.py b/lib/sqlalchemy/connectors/mxodbc.py index ac7075209c..78a1719c10 100644 --- a/lib/sqlalchemy/connectors/mxodbc.py +++ b/lib/sqlalchemy/connectors/mxodbc.py @@ -126,4 +126,11 @@ class MxODBCConnector(Connector): version.append(n) return tuple(version) - + def do_execute(self, cursor, statement, parameters, context=None): + # temporary workaround until a more comprehensive solution can + # be found for controlling when to use executedirect + try: + cursor.execute(statement, parameters) + except (InterfaceError, ProgrammingError), e: + warnings.warn("cursor.execute failed; falling back to executedirect") + cursor.executedirect(statement, parameters) -- 2.47.3