From: Mike Bayer Date: Sun, 24 Jul 2011 16:51:25 +0000 (-0400) Subject: - Fixed OurSQL dialect to use ansi-neutral X-Git-Tag: rel_0_6_9~39 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5c882f5fba176f7c218a3ee21fb57b516128633d;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - Fixed OurSQL dialect to use ansi-neutral quote symbol "'" for XA commands instead of '"'. [ticket:2186]. --- diff --git a/CHANGES b/CHANGES index e00f78e0a1..969fa7a16a 100644 --- a/CHANGES +++ b/CHANGES @@ -59,6 +59,11 @@ CHANGES ForeignKeyConstraint refers to a column name in the parent that is not found. +- mysql + - Fixed OurSQL dialect to use ansi-neutral + quote symbol "'" for XA commands instead + of '"'. [ticket:2186]. + - oracle - Added ORA-00028 to disconnect codes, use cx_oracle _Error.code to get at the code, diff --git a/lib/sqlalchemy/dialects/mysql/oursql.py b/lib/sqlalchemy/dialects/mysql/oursql.py index 001f8a0bbc..06163e417e 100644 --- a/lib/sqlalchemy/dialects/mysql/oursql.py +++ b/lib/sqlalchemy/dialects/mysql/oursql.py @@ -107,6 +107,7 @@ class MySQLDialect_oursql(MySQLDialect): # Py3K # charset = self._connection_charset # arg = connection.connection._escape_string(xid.encode(charset)).decode(charset) + arg = "'%s'" % arg connection.execution_options(_oursql_plain_query=True).execute(query % arg) # Because mysql is bad, these methods have to be @@ -115,23 +116,23 @@ class MySQLDialect_oursql(MySQLDialect): # the parameterized query API, or refuse to be parameterized # in the first place. def do_begin_twophase(self, connection, xid): - self._xa_query(connection, 'XA BEGIN "%s"', xid) + self._xa_query(connection, 'XA BEGIN %s', xid) def do_prepare_twophase(self, connection, xid): - self._xa_query(connection, 'XA END "%s"', xid) - self._xa_query(connection, 'XA PREPARE "%s"', xid) + self._xa_query(connection, 'XA END %s', xid) + self._xa_query(connection, 'XA PREPARE %s', xid) def do_rollback_twophase(self, connection, xid, is_prepared=True, recover=False): if not is_prepared: - self._xa_query(connection, 'XA END "%s"', xid) - self._xa_query(connection, 'XA ROLLBACK "%s"', xid) + self._xa_query(connection, 'XA END %s', xid) + self._xa_query(connection, 'XA ROLLBACK %s', xid) def do_commit_twophase(self, connection, xid, is_prepared=True, recover=False): if not is_prepared: self.do_prepare_twophase(connection, xid) - self._xa_query(connection, 'XA COMMIT "%s"', xid) + self._xa_query(connection, 'XA COMMIT %s', xid) # Q: why didn't we need all these "plain_query" overrides earlier ? # am i on a newer/older version of OurSQL ?