Mnesia Read/Write question.

Steve Davis steven.charles.davis@REDACTED
Fri Jul 31 08:04:03 CEST 2009


Hello Gene,

It looks like #test.id is the key, not #test.item. In the first
example, I suspect id is undefined. In the second it is. To find by
item, which appears to be what you are trying to do in (A), you would
have to use matches.

/sd

On Jul 30, 11:19 pm, "G.S." <corticalcompu...@REDACTED> wrote:
> Hello everyone,
> This is probably a very stupid question/problem, but I'm having trouble
> using the following commands:
>
> A) mnesia:dirty_write(Id#test{item = hello}) and
> mnesia:dirty_read(Id#test.item)  I get: exception error: {badrecord,test}
> but this works on the same table/schema...:
> B) Thing = #test{id = 1, item = hello}, mnesia:dirty_write(test,Thing),
> mnesia:dirty_read(test,Id).
>
> Are "A)" valid commands, what am I doing wrong?
>
> Regards,
> -Gene


More information about the erlang-questions mailing list