Mnemosyne

Ulf Wiger etxuwig@REDACTED
Tue Oct 30 17:49:28 CET 2001


On Tue, 30 Oct 2001, Sean Hinde wrote:

>In R8B ets you can specify the number of rows which are
>returned from a match or select call so you could do a match on
>each record type in turn with ets:match(Tab, Pattern Max_rows)
>where Max_rows is set to 1.
>
>Unfortunately mnesia doesn't support this addition to ets but I
>dare say that might follow sometime. Meanwhile you can do ets
>operations directly on local mnesia tables so long as you don't
>want any transaction safety.

Actually, mnesia _does_ support select() in R8B:

  mnesia:select(Tab, MatchPattern)
  mnesia:select(Tab, MatchPattern, LockKind)
  mnesia:dirty_select(Tab, MatchPattern)

It's even documented.  (:
>From
http://www.erlang.org/doc/r8b/lib/mnesia-4.0/doc/html/mnesia.html#select%3

"For example to find the names of all male persons with an age
over 30 in table Tab do:

  MatchHead = #person{name='$1', sex=male, age='$2', _='_'},
       Guard = {'>', '$2', 30},
       Result = '$1',
       mnesia:select(Tab,[{MatchHead, [Guard], [Result]}]),"

/Uffe
-- 
Ulf Wiger                                    tfn: +46  8 719 81 95
Senior System Architect                      mob: +46 70 519 81 95
Strategic Product & System Management    ATM Multiservice Networks
Data Backbone & Optical Services Division      Ericsson Telecom AB




More information about the erlang-questions mailing list