[erlang-questions] mnesia and QLC in dirty mode

Igor Ribeiro Sucupira <>
Wed Sep 8 17:33:05 CEST 2010


You are passing the atom read as the callback module:
http://erlang.org/doc/man/mnesia.html#activity-4

On Wed, Sep 8, 2010 at 12:24 PM, Evans, Matthew <> wrote:
> Hi,
>
> What is the exact syntax for doing a QLC query in dirty mode?
>
>
> ()149> Cursor =  mnesia:activity(sync_dirty, fun qlc:cursor/1, [qlc:q([R || R<- mnesia:table(cmfs_index_table)])], read).
> {qlc_cursor,{<0.3115.0>,<0.3102.0>}}
>
> ()150> qlc:next_answers(Cursor,1).
> ** exception error: undefined function read:select/6
>     in function  mnesia:'-table/2-fun-1-'/4
>     in call from qlc:reply/4
>     in call from qlc:next_loop/3
> ()151>
>
>
> If I wrap the qlc:next_answers in an mnesia:activity I get:
>
> ()2> mnesia:activity(sync_dirty, fun qlc:next_answers/2, [Cursor,1], read).
> ** exception exit: {undef,[{read,select,
>                                 [{sync_dirty,<0.625.0>},
>                                  non_transaction,cmfs_index_table,
>                                  [{'$1',[],['$1']}],
>                                  100,read]},
>                           {mnesia,'-table/2-fun-1-',4},
>                           {qlc,reply,4},
>                           {qlc,next_loop,3},
>                           {mnesia_tm,non_transaction,5},
>                           {erl_eval,do_apply,5},
>                           {shell,exprs,7},
>                           {shell,eval_exprs,7}]}
>     in function  mnesia_tm:non_transaction/5
>     in call from mnesia_tm:non_transaction/5
>
>
> Any ideas?
>
> Thanks
>
> Matt
>



-- 
"The secret of joy in work is contained in one word - excellence. To
know how to do something well is to enjoy it." - Pearl S. Buck.


More information about the erlang-questions mailing list