Commit a8ef83a6 authored by BAIRE Anthony's avatar BAIRE Anthony
Browse files

dead code

parent 220371d2
......@@ -30,37 +30,6 @@ log = logging.getLogger("controller")
assert MySQLdb.threadsafety >= 1
class DBTrace:
def __init__(self, conn):
self._conn = conn
self._nb = 0
def __enter__(self):
conn = self._conn
cur = conn.__enter__()
if not self._nb:
conn.query("set profiling_history_size = 0")
conn.query("set profiling_history_size = 100")
conn.query("set profiling = 1")
self._nb += 1
return cur
def __exit__(self, *exc):
conn = self._conn
try:
conn.__exit__(*exc)
finally:
self._nb -= 1
if not self._nb:
conn.query("set profiling = 0")
with conn.cursor() as cur:
cur.execute("show profiles")
log.debug("db transaction\n\033[35m%s\033[30m",
"\n".join("\t%s" % query for _, _, query in cur.fetchall()))
conn.query("set profiling_history_size = 0")
def __getattr__(self, name):
return getattr(self._conn, name)
class Error(Exception):
pass
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment