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

Scott Lystig Fritchie fritchie@REDACTED
Sat May 31 07:03:48 CEST 2014


Garrett Smith <g@REDACTED> 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