summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/databases/mysql.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/databases/mysql.py')
-rw-r--r--lib/sqlalchemy/databases/mysql.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/sqlalchemy/databases/mysql.py b/lib/sqlalchemy/databases/mysql.py
index 325347464..662d276e9 100644
--- a/lib/sqlalchemy/databases/mysql.py
+++ b/lib/sqlalchemy/databases/mysql.py
@@ -289,6 +289,22 @@ class MySQLDialect(ansisql.ANSIDialect):
def preparer(self):
return MySQLIdentifierPreparer(self)
+ def do_executemany(self, cursor, statement, parameters, **kwargs):
+ try:
+ cursor.executemany(statement, parameters)
+ except mysql.OperationalError, o:
+ if o.args[0] == 2006 or o.args[0] == 2014:
+ cursor.invalidate()
+ raise o
+ def do_execute(self, cursor, statement, parameters, **kwargs):
+ try:
+ cursor.execute(statement, parameters)
+ except mysql.OperationalError, o:
+ if o.args[0] == 2006 or o.args[0] == 2014:
+ cursor.invalidate()
+ raise o
+
+
def do_rollback(self, connection):
# some versions of MySQL just dont support rollback() at all....
try: