[erlang-questions] Mnesia docs question

Christian S <>
Thu Jun 14 10:42:55 CEST 2007


It is mnesia:transaction/1,2,3 that adds the {atomic, X}, where X is
the return value of your Fun passed to mnesia:transaction. It allows
you to check that the transaction succeeded.

Your badmatch could be that you are running this from the shell and X
is already bound?


On 6/14/07, Kirill Zaborski <> wrote:
> Reading docs for mnesia I see
>   read({Tab, Key}) -> transaction abort | RecordList
>
> And in User docs I see an example:
>   [E] = mnesia:read(employee, Eno, write)
>
> But when I run (x is some existing example table):
>   mnesia:transaction( fun()-> [X] = mnesia:read({x, 1}) end).
>
> I get
>   {aborted,{{badmatch,[#x{a = 1,b = 1}]},[{erl_eval,expr,3}]}}
>
> It looks like read/2 returns {atomic, RecordList} and not just RecordList.
> Was their some such change in mnesia API and there is a bug in
> documentation and I should post it to erlang-bugs?
>
> Regards,
> Kirill.
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list