Delete/Create in the same transaction
Chandrashekhar Mullaparthi
Chandrashekhar.Mullaparthi@REDACTED
Mon Apr 16 11:42:32 CEST 2001
6> mnesia:create_table(bag, [{attributes, [a,b]}, {type, bag}, {disc_copies,
[node()]}]).
{atomic,ok}
.
.
18> mnesia:transaction(fun() -> mnesia:write({bag, 1, 2}) end).
{atomic,ok}
19>
19>
19> mnesia:transaction(fun() -> mnesia:write({bag, 1, 3}) end).
{atomic,ok}
20>
20> [mnesia:dirty_read({bag, X}) || X <- mnesia:dirty_all_keys(bag)].
[[{bag,1,2},{bag,1,3}]]
21>
21> mnesia:transaction(fun() -> mnesia:delete_object({bag, 1, 2}),
mnesia:write({bag, 1, 2}) end).
{atomic,ok}
22>
22> [mnesia:dirty_read({bag, X}) || X <- mnesia:dirty_all_keys(bag)].
[[{bag,1,3}]]
In step 21, Why is it that if I delete an object in a transaction and write
it back again in the same, the object doesn't exist in the database??
Intuitively it seems to be a bug....
cheers,
Chandru
NOTICE AND DISCLAIMER:
This email (including attachments) is confidential. If you have received
this email in error please notify the sender immediately and delete this
email from your system without copying or disseminating it or placing any
reliance upon its contents. We cannot accept liability for any breaches of
confidence arising through use of email. Any opinions expressed in this
email (including attachments) are those of the author and do not necessarily
reflect our opinions. We will not accept responsibility for any commitments
made by our employees outside the scope of our business. We do not warrant
the accuracy or completeness of such information.
More information about the erlang-questions
mailing list