aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mnesia/src/mnesia_lib.erl
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2011-09-19 17:45:48 +0200
committerDan Gudmundsson <[email protected]>2011-09-19 17:45:48 +0200
commit533aeba2211bc29bf2a207737d74ffa52a46bdec (patch)
tree0cbe8f0775dd3fdad0a0311039062205c70cb583 /lib/mnesia/src/mnesia_lib.erl
parent7ebf84abf7e5d06ce9ef6ec11783318aa393093d (diff)
downloadotp-533aeba2211bc29bf2a207737d74ffa52a46bdec.tar.gz
otp-533aeba2211bc29bf2a207737d74ffa52a46bdec.tar.bz2
otp-533aeba2211bc29bf2a207737d74ffa52a46bdec.zip
[mnesia] Use dedicated api for clearing tables
Mainly to correctly clear dets tables. It may also be faster to use the dedicated functions.
Diffstat (limited to 'lib/mnesia/src/mnesia_lib.erl')
-rw-r--r--lib/mnesia/src/mnesia_lib.erl6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/mnesia/src/mnesia_lib.erl b/lib/mnesia/src/mnesia_lib.erl
index 7e926a6258..e8b8c58c70 100644
--- a/lib/mnesia/src/mnesia_lib.erl
+++ b/lib/mnesia/src/mnesia_lib.erl
@@ -1141,12 +1141,18 @@ db_erase(ram_copies, Tab, Key) -> ?ets_delete(Tab, Key), ok;
db_erase(disc_copies, Tab, Key) -> ?ets_delete(Tab, Key), ok;
db_erase(disc_only_copies, Tab, Key) -> dets:delete(Tab, Key).
+db_match_erase(Tab, '_') ->
+ db_delete_all(val({Tab, storage_type}),Tab);
db_match_erase(Tab, Pat) ->
db_match_erase(val({Tab, storage_type}), Tab, Pat).
db_match_erase(ram_copies, Tab, Pat) -> ?ets_match_delete(Tab, Pat), ok;
db_match_erase(disc_copies, Tab, Pat) -> ?ets_match_delete(Tab, Pat), ok;
db_match_erase(disc_only_copies, Tab, Pat) -> dets:match_delete(Tab, Pat).
+db_delete_all(ram_copies, Tab) -> ets:delete_all_objects(Tab);
+db_delete_all(disc_copies, Tab) -> ets:delete_all_objects(Tab);
+db_delete_all(disc_only_copies, Tab) -> dets:delete_all_objects(Tab).
+
db_first(Tab) ->
db_first(val({Tab, storage_type}), Tab).
db_first(ram_copies, Tab) -> ?ets_first(Tab);