mnesia transaction

paweł kamiński kamiseq@REDACTED
Mon Aug 3 20:34:54 CEST 2009


hej all,
I tired to look for answers but all I got was about quering itslef and only
highlighted that quering without transaction is very dangerous... :) (yeah
tell me more)

I have a question why my query in qlc cant be run without transaction??

Q = qlc:q([C#client_map.rel_clientID || C <- mnesia:table(client_map),
                        C#client_map.mtr_clientID == ClientID]),
    Read = fun()->
           qlc:e(Q)
       end,
    {atomic, List} = mnesia:transaction(Read),
    List.

my first attempt was
Q = qlc:q([C#client_map.rel_clientID || C <- mnesia:table(client_map),
                        C#client_map.mtr_clientID == ClientID]),
           qlc:e(Q).

more questions :
1)can I select rows dirtily??
2)is there a way to read snapshot of data while other processes are still
writing to db, so transaction is no needed. I ve read in man that ther is
fun activate_checkpoint/1 but can I run a query without transaction that
will implicitly create such a checkpoint.??
3)then what is the difference between qlc and dirty_read, dirty_select or
qlc is somehow compiled to dirty_* functions??
4)what will exactly happened when I dirty_write to my table when 10 other
processes are reading from it???

thanks

pozdrawiam
Paweł Kamiński

kamiseq@REDACTED
pkaminski.prv@REDACTED
______________________


More information about the erlang-questions mailing list