[erlang-questions] How to the a ets table is exists or not ?

Rapsey rapsey@REDACTED
Sat Mar 15 06:57:46 CET 2008


>From ets module documentation:

info(Tab) -> [{Item, Value}] | undefined

Returns information about the table Tab as a list of {Item, Value} tuples.
If Tab has the correct type for a table identifier, but does not refer to an
existing ETS table, undefined is returned. If Tab is not of the correct
type, this function fails with reason badarg.

That should work.



2008/3/15 tatezhou@REDACTED <tatezhou@REDACTED>:

>  Greets:
>
> I need to create a ets table if it is not exists, how to code it ?  I have
> check the online docs of chapter "ets", there is not function to handle this
> .
>
>
> Current solution is to get all the ets tables and check if the table i
> want in the list. but i  don't think this is a good idea.
>
>
>
> code:
>
>
> Ret = ets:new(client_cmd_hooks, [named_table]),
>
>
> thanks.
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080315/889491b9/attachment.htm>


More information about the erlang-questions mailing list