core (memory, memory/sqlite): implemented fileDelete

This commit is contained in:
Goffi 2019-04-28 08:55:13 +02:00
commit 80da9a6591

View file

@ -931,7 +931,7 @@ class SqliteStorage(object):
log.error(_(u"Can't update file table"))
def fileUpdate(self, file_id, column, update_cb):
"""update a column value using a method to avoid race conditions
"""Update a column value using a method to avoid race conditions
the older value will be retrieved from database, then update_cb will be applied
to update it, and file will be updated checking that older value has not been changed meanwhile
@ -948,6 +948,15 @@ class SqliteStorage(object):
raise exceptions.InternalError('bad column name')
return self.dbpool.runInteraction(self._fileUpdate, file_id, column, update_cb)
def fileDelete(self, file_id):
"""Delete file metadata from the database
@param file_id(unicode): id of the file to delete
NOTE: file itself must still be removed, this method only handle metadata in
database
"""
return self.dbpool.runQuery("DELETE FROM files WHERE id = ?", (file_id,))
##Helper methods##
def __getFirstResult(self, result):