Unverified Commit 289ac3ce authored by Sebastian Schüpbach's avatar Sebastian Schüpbach
Browse files

log sql statement parameters


Signed-off-by: Sebastian Schüpbach's avatarSebastian Schüpbach <sebastian.schuepbach@unibas.ch>
parent e34b041d
Pipeline #19206 passed with stages
in 2 minutes and 7 seconds
......@@ -55,17 +55,18 @@ class Indexer:
"""
Insert record in DB
"""
entities_stmt, entities_values = Indexer._create_sql_stmt('entities', record,
stmt, values = Indexer._create_sql_stmt('entities', record,
['sig', 'uri', 'access', 'proto'])
metadata_stmt, metadata_values = Indexer._create_sql_stmt('metadata', record,
try:
self.mariadb_cursor.execute(stmt, values)
stmt, values = Indexer._create_sql_stmt('metadata', record,
['sig', 'mimetype', 'height',
'width', 'duration', 'type'])
try:
self.mariadb_cursor.execute(entities_stmt, entities_values)
self.mariadb_cursor.execute(metadata_stmt, metadata_values)
self.mariadb_cursor.execute(stmt, values)
return True, ""
except mariadb.Error as ex:
logging.error(f"Problems in sql statement ({entities_stmt}): {ex}")
logging.error(f'Problems in sql statement (statement: "{stmt}", '
f'parameters: {values}): {ex}')
return False, str(ex)
def commit(self):
......
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