[erlang-questions] How to return all records in dets

lloyd <>
Sat May 31 16:21:58 CEST 2014


Nice tip!

Thank you.

Lloyd

-----Original Message-----
From: "Scott Lystig Fritchie" <>
Sent: Saturday, May 31, 2014 1:03am
To: "Garrett Smith" <>
Cc: "Lloyd Prentice" <>, "erlang questions" <>
Subject: Re: [erlang-questions] How to return all records in dets

Garrett Smith <> wrote:

gs> The trick here is to *never* make a mistake in the shell :)

Or, prepend your commands at the shell CLI with "catch".  Something
like:

    Bad = "yo, I cause pain".
    {ok, D} = dets:open_file(...).
    catch dets:lookup(Bad, my_key).
    catch dets:lookup(D, my_key).

... would prevent using the bad DETS table name from a cascade that
kills the shell CLI process than then closes the DETS table so that the
second lookup() attempt also fails.

-Scott





More information about the erlang-questions mailing list