Mnesia: Tables on the fly.

martin logan <>
Wed Jul 3 01:57:41 CEST 2002


Hello All, I seem to be facing a small problem having to do with mnesia. I 
have the following code:

% definitions of all the tables we are going to create
    MappingTabDef = [{type, set}, {ram_copies, [node()]}, {attributes, 
record_info(fields, mapping)}],
% More tables here.

% create the tables
mnesia:create_table(mapping, MappingTabDef),
% Create more tables here


I would like to replace that with somthing like the following:
Tables = [{mapping, ram_copies}|T],

Fun = fun({Table, StoreType}) ->            create_table([{type, set}, 
{StoreType, [node()]}, {attributes, record_info(fields, Table)}] end,

lists:foreach(Fun, Tables),

When I statically define everything as illustrated in the first example 
things work perfectly. Unfortunatly the second bit of code blows up every 
time.  Does anyone understand why?

Thanks,
Martin

_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com



More information about the erlang-questions mailing list