[erlang-questions] Modifying all entries in a mnesia table

Evans, Matthew mevans@REDACTED
Thu Dec 2 17:10:27 CET 2010


Have a look at mnesia:transform_table/4

For example:

mnesia:transform_table(counter_table,
				fun(Rec) -> Rec#counter_table{counter = 0} end,
				record_info(counter_table), 
				counter_table).

-----Original Message-----
From: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] On Behalf Of Andre Nathan
Sent: Wednesday, December 01, 2010 10:01 PM
To: erlang-questions@REDACTED
Subject: [erlang-questions] Modifying all entries in a mnesia table

Hello

I have a mnesia table for a quota system. Quotas are specified as daily
values, so the counters should be reset to 0 every 24h. Is there
anything more efficient than traversing the table with
mnesia:{first/1,next/2} and issuing a write for each record?

Thanks
Andre


________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED



More information about the erlang-questions mailing list