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: ...@@ -55,17 +55,18 @@ class Indexer:
""" """
Insert record in DB 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']) ['sig', 'uri', 'access', 'proto'])
metadata_stmt, metadata_values = Indexer._create_sql_stmt('metadata', record,
['sig', 'mimetype', 'height',
'width', 'duration', 'type'])
try: try:
self.mariadb_cursor.execute(entities_stmt, entities_values) self.mariadb_cursor.execute(stmt, values)
self.mariadb_cursor.execute(metadata_stmt, metadata_values) stmt, values = Indexer._create_sql_stmt('metadata', record,
['sig', 'mimetype', 'height',
'width', 'duration', 'type'])
self.mariadb_cursor.execute(stmt, values)
return True, "" return True, ""
except mariadb.Error as ex: 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) return False, str(ex)
def commit(self): def commit(self):
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