Module db_util

This module contains various usefull functions used to handle mnesia tables.

Introduced in: 22 Sep 2004 by Håkan Stenholm <hsten@it.su.se>

Authors: Håkan Stenholm (hsten@it.su.se).

Description

This module contains various usefull functions used to handle mnesia tables

Function Index

delete_all_entries/1 delete all entries in the mnesia table MnesiaTab.
delete_record/1 wraps mnesia:delete_object in a transaction context NOTE: Record MUST have the same name as the table it is inserted into Returns : mnesia:transaction().
delete_with_key/2 wraps mnesia:delete({Db, Key}) in a transaction context.
generic_table_info/2 Get mnesia table information, regardless of where table resides.
insert_record/1 wraps mnesia:write in a transaction context.
match_object/1 alternative match_object based on mnesia:select/2 it should be faster than mnesia:match_object/1.
tab_to_list/1 return a list with all entries in MnesiaTab Note : This is a time and memory consuming operation if the table is large.

Function Details

delete_all_entries/1

delete_all_entries(MnesiaTab) -> term()

delete all entries in the mnesia table MnesiaTab

delete_record/1

delete_record(Record) -> term()

wraps mnesia:delete_object in a transaction context NOTE: Record MUST have the same name as the table it is inserted into Returns : mnesia:transaction()

delete_with_key/2

delete_with_key(Db, Key) -> term()

wraps mnesia:delete({Db, Key}) in a transaction context

generic_table_info/2

generic_table_info(Tab, Item) -> term()

Get mnesia table information, regardless of where table resides.

insert_record/1

insert_record(Record) -> term()

wraps mnesia:write in a transaction context. NOTE: Record MUST have the same name as the table it is inserted into

match_object/1

match_object(Pattern) -> Records

alternative match_object based on mnesia:select/2 it should be faster than mnesia:match_object/1. Finds the records that match the pattern Pattern. Pattern is usually something like: #rec_name{f1 = V1, f2 = V2, ..., _ = '_'} where '_' acts as a wildcard value NOTE : the record name must be = table name. '$number' (e.g. '$1', '$2', .... ) can not be used in Pattern (it has special meaning in the match specification used by mnesia:select/1)

tab_to_list/1

tab_to_list(MnesiaTab) -> [records]

return a list with all entries in MnesiaTab Note : This is a time and memory consuming operation if the table is large


Generated by EDoc, Oct 17 2007, 16:48:08.