[erlang-questions] Mnesia create a table with a auto increase id?

Andreas Hillqvist andreas.hillqvist@REDACTED
Tue Mar 17 09:50:04 CET 2009


To auto increased uid you could use:
mnesia:dirty_update_counter/3
(http://www.erlang.org/doc/man/mnesia.html#dirty_update_counter-3)

Kind regards
Andreas Hillqvist

2009/3/17 fei wang <fei@REDACTED>:
> I am now using mnesia database, and I have a user table with record
> #users{
>           uid,
>           username,
>           password
>           }
> Problem one is if a username is already in the table, it would not be
> inserted into the table. Should I first query the table to see if there is a
> same name in it?  Any other good methods?
> Problem tow is the uid should be auto increased each insert time, I have no
> idea about this... Should I change the type of table to ordered-set, and
> query the last record's uid value, increase it by myself?
> If anyone have some good idea, or something about mnesia which I don't know,
> please tell me, thanks.
>
> Oizys
> --
> --
>
> ---------------
>> 礼!
>
>
> 王飞
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list