From 98c1aa154ed162f7678bc25e63b7e965070f0134 Mon Sep 17 00:00:00 2001 From: adustman Date: Tue, 16 Jul 2002 16:26:40 +0000 Subject: [PATCH] Revert execute behavior: Do not use % operator when there are no args --- MySQLdb/MySQLdb/cursors.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/MySQLdb/MySQLdb/cursors.py b/MySQLdb/MySQLdb/cursors.py index 6bc4790..5298fa5 100644 --- a/MySQLdb/MySQLdb/cursors.py +++ b/MySQLdb/MySQLdb/cursors.py @@ -77,7 +77,7 @@ class BaseCursor: self.errorhandler(self, ProgrammingError, "cursor closed") return self.connection - def execute(self, query, args=()): + def execute(self, query, args=None): """Execute a query. @@ -98,7 +98,10 @@ class BaseCursor: from types import ListType, TupleType from sys import exc_info try: - r = self._query(query % self.connection.literal(args)) + if args is None: + r = self._query(query) + else: + r = self._query(query % self.connection.literal(args)) except TypeError, m: if m.args[0] in ("not enough arguments for format string", "not all arguments converted"):