Parttern matching in mnesia

Dan Gudmundsson dgud@REDACTED
Wed Mar 1 13:25:47 CET 2000


Vladimir Ulogov writes:
 > Hello folks,
 > Can somebody submit the samples for strings lookup in the mnesia table
 > which will perform similar to 'LIKE' operator in SQL. Another word, how
 > to construct operator like 'SELECT * FROM table WHERE str_field LIKE
 > "%abc%' (lookup all str_filed which _contain_ "abc") using
 > Mnesia/Mnemosyne
 > 

It's not possible to make a match like that in mnesia (or mnemosyne),
you have to look at each record and do a search.

You can find all records which have a key that begins with "asd"
If you do mnesia:match_object({record_id, [$a, $s, $d | '_'], '_'}).

Matching in mnesia is implemented with the functionality provided 
by (d)ets, see erl -man ets

/Dan



More information about the erlang-questions mailing list