[erlang-questions] How do you transform a record properly?
Rob Charlton
rob.charlton@REDACTED
Wed Mar 25 16:19:44 CET 2009
Actually, disregard that - I ended up with a table full of
#rate_dest_new records, so I had to do another transform back to #rate_dest!
I agree with Bengt - you're doing it the right way :)
Cheers
Rob
Rob Charlton wrote:
> Hi,
>
> I don't think mnesia minds, because it treats the table name
> differently from the record name used to access it. I just added a new
> field using the example from here:
> http://erlang.org/doc/apps/mnesia/Mnesia_chap3.html#3.1.1
>
> In my own example, the table name and original record name was
> "rate_dest". The new record name was "rate_dest_new" which was
> identical apart from one extra field. After running the transform, I
> just added the new field to record rate_dest and deleted the
> definition of rate_dest_new.
>
> Cheers
>
> Rob
>
> Bengt Kleberg wrote:
>> Greetings,
>>
>> You are doing it the right way.
>>
>> Unless you change the name of the tuple when you change the contents.
>> But that would perhaps be a problem for mnesia.
>>
>>
>> bengt
>>
>> On Mon, 2009-03-23 at 20:18 -0700, ryeguy wrote:
>>
>>> How would you add a field to a table using mnesia:table_transform? I
>>> got it to work by just using a raw tuple in the function header, but
>>> how do you match the old record, then output the new record with just
>>> the new field added/changed?
>>> _______________________________________________
>>> erlang-questions mailing list
>>> erlang-questions@REDACTED
>>> http://www.erlang.org/mailman/listinfo/erlang-questions
>>>
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://www.erlang.org/mailman/listinfo/erlang-questions
>>
>
>
--
Rob Charlton
Savage Minds Ltd
+44 20 79210521
rob.charlton@REDACTED
skype: chocolatetpot
www.savageminds.com
More information about the erlang-questions
mailing list