Module usr_db

Back end for the mobile subscriber database.

Copyright © 2009 Francesco Cesarini and Simon Thompson

Authors: Francesco Cesarini (support@erlang-consulting.com), Simon Thompson [web site: http://www.cs.kent.ac.uk/~sjt/].

References

Description

Back end for the mobile subscriber database. The module provides an example of using ETS and DETS tables.

Function Index

add_usr/1Add a user (of the usr record type) to the database.
close_tables/0Close the ETS and DETS tables implementing the database.
create_tables/1Create the ETS and DETS tables which implement the database.
delete_usr/1Delete a user, specified by their customer id.
delete_usr/2Delete a user, specified by their phone number and customer id.
update_usr/1Updates the ram and disk tables with a Usr.

Function Details

add_usr/1

add_usr(Usr::#usr{}) -> ok

Add a user (of the usr record type) to the database.

close_tables/0

close_tables() -> ok | {error, string()}

Close the ETS and DETS tables implementing the database. Returns either ok or and error tuple with the reason for the failure to close the DETS table.

create_tables/1

create_tables(FileName::string()) -> {ok, reference()} | {error, string()}

Create the ETS and DETS tables which implement the database. The argument gives the filename which is used to hold the DETS table. If the table can be created, an ok tuple containing a reference to the created table is returned; if not, it returns an error tuple with a string describing the error.

delete_usr/1

delete_usr(CustId::integer()) -> ok | {error, string()}

Delete a user, specified by their customer id. Returns either ok or an error tuple with a reason, if either the lookup of the id fails, or the delete of the tuple.

delete_usr/2

delete_usr(PhoneNo::integer(), CustId::integer()) -> ok | {error, string()}

Delete a user, specified by their phone number and customer id. Returns either ok or an error tuple with a reason.

update_usr/1

update_usr(Usr::#usr{}) -> ok

Updates the ram and disk tables with a Usr.


Generated by EDoc, Feb 28 2009, 12:50:24.