25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

Add support to delete content and delete table.

SVN Revision: 2388
This commit is contained in:
Badlop 2009-07-23 15:23:02 +00:00
parent b3eb800be1
commit 140d938bc3

View File

@ -2196,7 +2196,9 @@ db_storage_select(ID, Opt, Lang) ->
end, [{ram_copies, "RAM copy"}, end, [{ram_copies, "RAM copy"},
{disc_copies, "RAM and disc copy"}, {disc_copies, "RAM and disc copy"},
{disc_only_copies, "Disc only copy"}, {disc_only_copies, "Disc only copy"},
{unknown, "Remote copy"}])). {unknown, "Remote copy"},
{delete_content, "Delete content"},
{delete_table, "Delete table"}])).
node_db_parse_query(_Node, _Tables, [{nokey,[]}]) -> node_db_parse_query(_Node, _Tables, [{nokey,[]}]) ->
nothing; nothing;
@ -2211,11 +2213,17 @@ node_db_parse_query(Node, Tables, Query) ->
"ram_copies" -> ram_copies; "ram_copies" -> ram_copies;
"disc_copies" -> disc_copies; "disc_copies" -> disc_copies;
"disc_only_copies" -> disc_only_copies; "disc_only_copies" -> disc_only_copies;
"delete_content" -> delete_content;
"delete_table" -> delete_table;
_ -> false _ -> false
end, end,
if if
Type == false -> Type == false ->
ok; ok;
Type == delete_content ->
mnesia:clear_table(Table);
Type == delete_table ->
mnesia:delete_table(Table);
Type == unknown -> Type == unknown ->
mnesia:del_table_copy(Table, Node); mnesia:del_table_copy(Table, Node);
true -> true ->