Skip to content
This repository has been archived by the owner on Jun 11, 2018. It is now read-only.

Commit

Permalink
prevent string interpolation with default empty tuple when contains %…
Browse files Browse the repository at this point in the history
… for MySQL, fixes issue #94
  • Loading branch information
jalvz committed Feb 19, 2016
1 parent 8dadef7 commit 785088e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions opbeat/instrumentation/packages/dbapi2.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@ def extract_signature(sql):
class CursorProxy(wrapt.ObjectProxy):
provider_name = None

def callproc(self, procname, params=None):
def callproc(self, procname, params=()):
return self._trace_sql(self.__wrapped__.callproc, procname,
params)

def execute(self, sql, params=None):
def execute(self, sql, params=()):
return self._trace_sql(self.__wrapped__.execute, sql, params)

def executemany(self, sql, param_list):
Expand Down
7 changes: 7 additions & 0 deletions opbeat/instrumentation/packages/mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ class MySQLCursorProxy(CursorProxy):
def extract_signature(self, sql):
return extract_signature(sql)

def callproc(self, procname, params=None):
return self._trace_sql(self.__wrapped__.callproc, procname,
params)

def execute(self, sql, params=None):
return self._trace_sql(self.__wrapped__.execute, sql, params)


class MySQLConnectionProxy(ConnectionProxy):
cursor_proxy = MySQLCursorProxy
Expand Down

0 comments on commit 785088e

Please sign in to comment.