OracleDB: add debug of SQL query in doSQL & doSelect methods
This commit is contained in:
parent
366260e92a
commit
ef510a36ee
1 changed files with 18 additions and 2 deletions
|
@ -112,6 +112,14 @@ class OracleDB:
|
|||
|
||||
cursor = self._conn.cursor()
|
||||
try:
|
||||
log.debug(
|
||||
'Run SQL query "%s" %s',
|
||||
sql,
|
||||
"with params = %s" % ', '.join([
|
||||
"%s = %s" % (key, value)
|
||||
for key, value in params.items()
|
||||
]) if params else "without params"
|
||||
)
|
||||
if isinstance(params, dict):
|
||||
cursor.execute(sql, **params)
|
||||
else:
|
||||
|
@ -120,7 +128,7 @@ class OracleDB:
|
|||
return True
|
||||
except Exception:
|
||||
log.error(
|
||||
'Error during SQL request "%s" %s',
|
||||
'Error during SQL query "%s" %s',
|
||||
sql,
|
||||
"with params = %s" % ', '.join([
|
||||
"%s = %s" % (key, value)
|
||||
|
@ -143,6 +151,14 @@ class OracleDB:
|
|||
"""
|
||||
cursor = self._conn.cursor()
|
||||
try:
|
||||
log.debug(
|
||||
'Run SQL SELECT query "%s" %s',
|
||||
sql,
|
||||
"with params = %s" % ', '.join([
|
||||
"%s = %s" % (key, value)
|
||||
for key, value in params.items()
|
||||
]) if params else "without params"
|
||||
)
|
||||
if isinstance(params, dict):
|
||||
cursor.execute(sql, **params)
|
||||
else:
|
||||
|
@ -152,7 +168,7 @@ class OracleDB:
|
|||
return results
|
||||
except Exception:
|
||||
log.error(
|
||||
'Error during SQL request "%s" %s',
|
||||
'Error during SQL query "%s" %s',
|
||||
sql,
|
||||
"with params = %s" % ', '.join([
|
||||
"%s = %s" % (key, value)
|
||||
|
|
Loading…
Reference in a new issue