mnesia:clear_table

Serge Aleynikov serge@REDACTED
Tue Aug 16 14:14:04 CEST 2005


Ulf,

I'm sorry - it was my oversight - I looked back at the test I did and saw:

(t@REDACTED)5> F = fun() -> mnesia:clear_table(test), 
mnesia:write({test, 1, 1}) end.
#Fun<erl_eval.20.102880425>
(t@REDACTED)6> mnesia:transaction(F).
{atomic,ok}

Clearly the return of mnesia:write() masked the failure of the 
mnesia:clear_table.

Thinking in line with the other thread on exceptions vs. return of 
{error, Reason}, looks like this type of error would be a good candidate 
for raising an exception.

Serge

Ulf Wiger (AL/EAB) wrote:
> Serge Aleynikov wrote:
> 
>>If schema transaction don't support nesting, I am not sure 
>>your answer clarifies why the following code should work
>>if schema transaction don't support nesting:
>>
>>mnesia:transaction(
>>   fun() ->
>>     mnesia:clear_table(test),
>>   end).
> 
> 
> 
> But it doesn't work:
> 
> 4> mnesia:create_table(test,[{ram_copies,[node()]}]).
> {atomic,ok}
> 5> mnesia:transaction(fun() -> mnesia:clear_table(test) end).
> {atomic,{aborted,nested_transaction}}
> 
> Granted, the return value is a bit funny. (:
> 
> 
> /Uffe



More information about the erlang-questions mailing list