Mnesia fundamentals
orbitz@REDACTED
orbitz@REDACTED
Mon Apr 3 21:01:22 CEST 2006
You're doing this in a transaction I hope?
On Apr 3, 2006, at 10:45 AM, kaslist wrote:
> Hi,
>
> I think this is a just a quick question for someone who knows....
> I've been trying to get to grips with using Mnesia and, with a
> simple: one table one record setup, I've managed to work through
> most of the functions very happily. I thought I was really getting
> somewhere until a couple of days ago when... I tried to fill two
> tables defined with the same record type.
>
> Specifically, the tutorial that I based my studies on used:
>
> -record(employee, {emp_no, name, salary, sex, phone, room_no}).
> mnesia:create_table(employee, [{attributes, record_info(fields,
> employee)}]),
> Emp = #employee{emp_no= 843838, name = klacke, salary = 3, sex =
> male, phone = 98111, room_no ={221, 051}},
>
> ...and to insert the data within a transaction:
>
> mnesia:write(employee, Emp, write)
>
> All well and good. However, when I restart the program with the
> addition a second table:
>
> mnesia:create_table(employee2, [{attributes, record_info(fields,
> employee)}]),
>
> and attempted to insert the data within a transaction thus:
>
> mnesia:write(employee2, Emp, write)
>
> ...everything compiles happily, runs happily... but employee2 table
> is not filled and yet no errors/exceptions are found.
> I have gone over and over the tutorials and the dozen or so Mnesia
> references/blogs on the net looking for examples of this issue but
> to no avail. Must there be a relationship between the record and
> table names??? Can anyone help me out of this newbie ditch I've got
> myself into?
>
> Thanks,
>
> Kyle.
>
>
>
More information about the erlang-questions
mailing list