Mnesia request

Michal Slaski michal@REDACTED
Sat Mar 25 13:30:21 CET 2006

Eric Shun wrote:
> I'm just starting to learn how to use Mnesia and I can't find how to select
> every rows in a table, which contain at least one field undefined...
> How can I do that?

    Keys = mnesia:dirty_all_keys(tablename),
    [ Rec ||
        Key <- Keys,
        Rec <- mnesia:dirty_read(tablename, Key),
        lists:member(undefined, tuple_to_list(Rec))].

Will return a list of records ("rows") with at least one field == undefined.

Michal Slaski

More information about the erlang-questions mailing list