core (memory/sqlite): new delPrivateNamespace method to delete all data of a specific namespace for a profile.
This commit is contained in:
parent
c87e9a23e3
commit
6e38be1dab
1 changed files with 17 additions and 0 deletions
|
|
@ -717,6 +717,23 @@ class SqliteStorage(object):
|
|||
d.addErrback(self._privateDataEb, u"delete", namespace, key, profile=profile)
|
||||
return d
|
||||
|
||||
def delPrivateNamespace(self, namespace, binary=False, profile=None):
|
||||
"""Delete all data from a private namespace
|
||||
|
||||
Be really cautious when you use this method, as all data with given namespace are
|
||||
removed.
|
||||
Params are the same as for delPrivateValue
|
||||
"""
|
||||
table = self._getPrivateTable(binary, profile)
|
||||
query_parts = [u"DELETE FROM", table, u"WHERE namespace=?"]
|
||||
args = [namespace]
|
||||
if profile is not None:
|
||||
query_parts.append(u"AND profile_id=?")
|
||||
args.append(self.profiles[profile])
|
||||
d = self.dbpool.runQuery(u" ".join(query_parts), args)
|
||||
d.addErrback(self._privateDataEb, u"delete namespace", namespace, profile=profile)
|
||||
return d
|
||||
|
||||
## Files
|
||||
|
||||
@defer.inlineCallbacks
|
||||
|
|
|
|||
Loading…
Reference in a new issue