[erlang-questions] Re: Mnesia Read/Write question.

G.S. corticalcomputer@REDACTED
Fri Jul 31 11:35:34 CEST 2009


Yeah, I finally realized what I was doing thanks. I don't know what I was
thinking, but Steve pointed me in the right direction.
Thanks.
-Gene

On Fri, Jul 31, 2009 at 2:23 AM, Ola Andersson A <
ola.a.andersson@REDACTED> wrote:

> Hi Gene,
>
> Read the answers from Maria and Steve again. They are both right.
> Anyway, the first problem with A) is probably that Id do not contain a
> #test{} record.
> That is the most likely cause for the {badrecord,test} error.
> The second problem is that you're syntax for mnesia:dirty_read is wrong.
> Assuming that you have Id assigned to a #test{} record, the call
> translates to mnesia:dirty_read(undefined)
> (or what ever the value of the field item happens to be).
> This has obviously never worked. You have to specify the table that the
> key belong to.
> Like mnesia:dirty_read({test, Key}).
> /Ola.
>
> > -----Original Message-----
> > From: erlang-questions@REDACTED
> > [mailto:erlang-questions@REDACTED] On Behalf Of G.S.
> > Sent: den 31 juli 2009 09:02
> > To: Steve Davis
> > Cc: Erlang
> > Subject: Re: [erlang-questions] Re: Mnesia Read/Write question.
> >
> > Hello,
> >
> > Maria, I'm not having problems with the B) version, only with
> > A). (The error you noted was due to my misspelling it in the email).
> >
> > Could syntax in "A)" be deprecated? I got it from Mnesia A
> > Distributed Robust DBMS for Telecommunications Applications,
> > which I think was published in 98 or earlier.
> >
> > Regards,
> > -Gene
> >
> > On Thu, Jul 30, 2009 at 11:04 PM, Steve Davis <
> > steven.charles.davis@REDACTED> wrote:
> >
> > > 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
> > >
> > > ________________________________________________________________
> > > erlang-questions mailing list. See http://www.erlang.org/faq.html
> > > erlang-questions (at) erlang.org
> > >
> > >
> >
>


More information about the erlang-questions mailing list