mnesia:transform_table(Tab, Fun, NewAttributeList)

Torbjorn Tornkvist <>
Thu Jul 6 23:50:03 CEST 2006


Trap Exit wrote:
> Hi, folks.
> 
> I have a mnesia table where I am about to change the definition of the record which it is based on.
> I have found the mnesia:transform_table/3 and mnesia:transform_table/4 functions. I know how to implement this if I use tuples in the funs that transform the objects in the table.
> 
> fun({user, UserId, UserName, UserPassword}) ->
>     UserEMail = none,
>     {user, UserId, UserName, UserPassword, UserEMail}.
> 
> The problem is that I have been thought to to assume that records are tuples.
> You cant have a record name with two definitions, if you have diffrent name, you will have to enter the new recordnam into the databas.
> 
> So, how should one procede?
> * When changeing the recodord defintion for at mnesia table change the record name, or
> * Use the tuple definition of records. The code will only be used once so who cares, or

Yes!

--Tobbe

> * None of the above.
> 
> 
> Regards,
> Andreas Hillqvist
> _________________________________________________________
> Post sent from www.trapexit.org
> 
> Read this topic online here: http://trapexit.erlang-consulting.com/forum/viewtopic.php?p=135#135
> 




More information about the erlang-questions mailing list