summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/sybase/pysybase.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-03-17 13:14:47 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2010-03-17 13:14:47 -0400
commitb81e9741ba26f2740725c9d403d116284af7d7a4 (patch)
tree5b8792ceca125ac46e8055db997ce9e6e82bba11 /lib/sqlalchemy/dialects/sybase/pysybase.py
parent893f6563730f4d2460dd266a8fea40a38c678794 (diff)
downloadsqlalchemy-b81e9741ba26f2740725c9d403d116284af7d7a4.tar.gz
- basic sybase+pyodbc support. in particular this will impact freetds detection for MS-SQL as well.
Diffstat (limited to 'lib/sqlalchemy/dialects/sybase/pysybase.py')
-rw-r--r--lib/sqlalchemy/dialects/sybase/pysybase.py20
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/sqlalchemy/dialects/sybase/pysybase.py b/lib/sqlalchemy/dialects/sybase/pysybase.py
index 195407384..200ce11a2 100644
--- a/lib/sqlalchemy/dialects/sybase/pysybase.py
+++ b/lib/sqlalchemy/dialects/sybase/pysybase.py
@@ -20,6 +20,14 @@ from sqlalchemy.dialects.sybase.base import SybaseDialect, \
class SybaseExecutionContext_pysybase(SybaseExecutionContext):
+
+ def set_ddl_autocommit(self, dbapi_connection, value):
+ if value:
+ # call commit() on the Sybase connection directly,
+ # to avoid any side effects of calling a Connection
+ # transactional method inside of pre_exec()
+ dbapi_connection.commit()
+
def pre_exec(self):
SybaseExecutionContext.pre_exec(self)
@@ -28,18 +36,6 @@ class SybaseExecutionContext_pysybase(SybaseExecutionContext):
param["@" + key] = param[key]
del param[key]
- if self.isddl:
- # TODO: to enhance this, we can detect "ddl in tran" on the
- # database settings. this error message should be improved to
- # include a note about that.
- if not self.should_autocommit:
- raise exc.InvalidRequestError("The Sybase dialect only supports "
- "DDL in 'autocommit' mode at this time.")
- # call commit() on the Sybase connection directly,
- # to avoid any side effects of calling a Connection
- # transactional method inside of pre_exec()
- self.root_connection.engine.logger.info("COMMIT (Assuming no Sybase 'ddl in tran')")
- self.root_connection.connection.commit()
class SybaseSQLCompiler_pysybase(SybaseSQLCompiler):
def bindparam_string(self, name):