From: Brad Allen Date: Sun, 21 Mar 2010 04:00:51 +0000 (-0600) Subject: For cases when mxODBC's cursor.execute can't do the job, raise a warning and fall... X-Git-Tag: rel_0_6beta3~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=619376e7ac5e3a2e698b789fa601d117057ab133;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git 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. --- 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)