Oid for Mnesia

Luke Gorrie luke@REDACTED
Sat Oct 16 01:42:17 CEST 1999

What I see most commonly used for this is to just change your record
so that both components of the key are put in the same attribute:

-record(placed_on, {id, path}).

where id is a {Procedure, Platform} tuple, accessed as in

  {Procedure, Platform} = Rec#placed_on.id

or, depending on your taste, id can be a record in its own right:

-record(id, {procedure, platform}).

accessed as in

  Procedure = (Rec#placed_on.id)#id.procedure

But there might be a better way to do this that I don't know about.

Hector Garza <hgarza@REDACTED> writes:

> I'm defining a table in which the primary key is formed of two
> attributes, not just one (relation-2 foreign keys).
>     The thing is that when I try to initialize the table, I get the
> message that I have a bad record definition, which points to  the first
> element of the record (./cf.hrl:39: bad record field).
> These are the record definitions I've tried>
> -record(placed_on,   { [id_procedure,id_plataform],
>                                      path}).
> -record(placed_on,   { {id_procedure,id_plataform},
>                                      path} ).
> As you see, I tried first to define the first element as a list, and
> then as a tuple, but none of those ways work.
> Any of you guys could help me on this...
> thanks
> hector garza>

"Time flies like an arrow; fruit-flies like a banana." -Groucho Marx

More information about the erlang-questions mailing list