# HG changeset patch # User Goffi # Date 1448912534 -3600 # Node ID 3765e10ec52fa77dd4798b2a97615403e494dcf3 # Parent 292f9c2712f2e60cdfb8a469f5cfd7297650b92b core (sqlite storage): do explicit delete to profile linked tables for deleteProfile diff -r 292f9c2712f2 -r 3765e10ec52f src/memory/sqlite.py --- a/src/memory/sqlite.py Mon Nov 30 20:40:55 2015 +0100 +++ b/src/memory/sqlite.py Mon Nov 30 20:42:14 2015 +0100 @@ -174,9 +174,16 @@ return failure def delete(txn): - del self.profiles[name] + profile_id = self.profiles.pop(name) txn.execute("PRAGMA foreign_keys = ON") txn.execute("DELETE FROM profiles WHERE name = ?", (name,)) + # FIXME: the following queries should be done by the ON DELETE CASCADE + # but it seems they are not, so we explicitly do them by security + # this need more investigation + txn.execute("DELETE FROM history WHERE profile_id = ?", (profile_id,)) + txn.execute("DELETE FROM param_ind WHERE profile_id = ?", (profile_id,)) + txn.execute("DELETE FROM private_ind WHERE profile_id = ?", (profile_id,)) + txn.execute("DELETE FROM private_ind_bin WHERE profile_id = ?", (profile_id,)) return None d = self.dbpool.runInteraction(delete)