291 try: |
291 try: |
292 query = QSqlQuery(db) |
292 query = QSqlQuery(db) |
293 # step 1: create entry in file table and get the ID |
293 # step 1: create entry in file table and get the ID |
294 query.prepare(self.populate_file_stmt) |
294 query.prepare(self.populate_file_stmt) |
295 query.bindValue(":file", apiFile) |
295 query.bindValue(":file", apiFile) |
296 query.exec_() |
296 if not query.exec_(): |
|
297 return |
297 query.prepare(self.file_id_stmt) |
298 query.prepare(self.file_id_stmt) |
298 query.bindValue(":file", apiFile) |
299 query.bindValue(":file", apiFile) |
299 query.exec_() |
300 if not query.exec_(): |
300 query.next() |
301 return |
|
302 if not query.next(): |
|
303 return |
301 id = int(query.value(0)) |
304 id = int(query.value(0)) |
302 |
305 |
303 # step 2: delete all entries belonging to this file |
306 # step 2: delete all entries belonging to this file |
304 query.prepare(self.populate_del_api_stmt) |
307 query.prepare(self.populate_del_api_stmt) |
305 query.bindValue(":fileId", id) |
308 query.bindValue(":fileId", id) |