Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Records in Erl (Erlang question)

Tags:

erlang

mnesia

erl

Is there a way to use records directly in erl? No matter what I try, it always says it canno find the record. I am trying to do mnesia transactions and I cannot go too far without my records. Any help is greatly appreciated - thank you!

like image 864
ewindsor Avatar asked Sep 06 '09 17:09

ewindsor


1 Answers

Yes, use help() and find these commands in the shell.

rd(R,D)    -- define a record
rf()       -- remove all record information
rf(R)      -- remove record information about R
rl()       -- display all record information
rl(R)      -- display record information about R
rp(Term)   -- display Term using the shell's record information
rr(File)   -- read record information from File (wildcards allowed)
rr(F,R)    -- read selected record information from file(s)
rr(F,R,O)  -- read selected record information with options

These are a clever hack in the shell, they allow you to load record definitions used in modules when they were compiled. Use the rr command to load it from your module.

Remember that these are only available for the interactive shell to use.

like image 164
Christian Avatar answered Nov 04 '22 14:11

Christian