diff options
| author | Brad Allen <bradallen137@gmail.com> | 2010-03-20 22:00:51 -0600 |
|---|---|---|
| committer | Brad Allen <bradallen137@gmail.com> | 2010-03-20 22:00:51 -0600 |
| commit | 619376e7ac5e3a2e698b789fa601d117057ab133 (patch) | |
| tree | 727466e7896ec28215991f9613840a1bfc5ea2f1 /lib/sqlalchemy/connectors | |
| parent | 323f1b358de19cc9cbfd45408636aa58060adf15 (diff) | |
| download | sqlalchemy-619376e7ac5e3a2e698b789fa601d117057ab133.tar.gz | |
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.
Diffstat (limited to 'lib/sqlalchemy/connectors')
| -rw-r--r-- | lib/sqlalchemy/connectors/mxodbc.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/sqlalchemy/connectors/mxodbc.py b/lib/sqlalchemy/connectors/mxodbc.py index ac7075209..78a1719c1 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) |
