Commit 1c2ab1ec authored by Xiaowu Zhang's avatar Xiaowu Zhang

ZMySQLDA/db.py: show error sql in log

parent 588617cd
...@@ -395,10 +395,10 @@ class DB(TM): ...@@ -395,10 +395,10 @@ class DB(TM):
self._forceReconnection() self._forceReconnection()
self.db.query(query) self.db.query(query)
else: else:
LOG('ZMySQLDA', ERROR, 'query failed: %s' % (query,)) LOG(' Operation ZMySQLDA', ERROR, 'query failed: %s' % (query,))
raise raise
except ProgrammingError: except ProgrammingError:
LOG('ZMySQLDA', ERROR, 'query failed: %s' % (query,)) LOG('Programming ZMySQLDA', ERROR, 'query failed: %s' % (query,))
raise raise
try: try:
return self.db.store_result() return self.db.store_result()
...@@ -432,6 +432,8 @@ class DB(TM): ...@@ -432,6 +432,8 @@ class DB(TM):
qs = "SET STATEMENT %s FOR SELECT %s" % (statement, select) qs = "SET STATEMENT %s FOR SELECT %s" % (statement, select)
if max_rows: if max_rows:
qs = "%s LIMIT %d" % (qs, max_rows) qs = "%s LIMIT %d" % (qs, max_rows)
if ';' in qs:
LOG('query with ;', ERROR, query_string)
c = self._query(qs) c = self._query(qs)
if c: if c:
if desc is not None is not c.describe(): if desc is not None is not c.describe():
......
Markdown is supported
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