相关疑难解决方法(0)

erlang mnesia - illegal record info

I am trying to have a function that ensures the table I need is already created and if not to create it. Here's the sample:

ensure_table_exists(Table, MnesiaTables, Nodes) ->
case lists:member(Table, MnesiaTables) of
    true ->
        throw({error, db_might_have_already_been_created});
    false ->
        mnesia:create_table(Table, [{disc_copies, Nodes},
                {attributes, record_info(fields, Table)}]), 
        ok  
end.
Run Code Online (Sandbox Code Playgroud)

The issue is that when compiling I get the error: illegal record info. It might have to do that record_info is resolved at compile time or that the second argument to record …

erlang mnesia record

5
推荐指数
2
解决办法
1639
查看次数

标签 统计

erlang ×1

mnesia ×1

record ×1