rdbms-1.0 user contribution

Dan Gudmundsson dgud@REDACTED
Wed Jan 13 15:41:19 CET 1999


Hi Ulf 

You want to create a table with some initial user_properties in one
atomic transaction.  The simplest way (unfortunately this is
undocumented) to do this is:

  mnesia:create_table(foo, [{user_properties, Props}]).

The patch of mnesia_schema is unnecessary.

When it comes to nested schema transactions, you said 
"..it is not well documented in mnesia how to perform a series of
schema operations within one schema transaction".  This is true and
the simple reason for not documenting that is that nested schema
transactions is not a part of the public API. We do not want to
encourage our customers to use our internal functions.


Regards 
Dan, Håkan

Ulf Wiger writes:
 > I've contributed a data dictionary to mnesia (see
 > http://www.erlang.org/user.html)
 > 
 > The dictionary provides:
 > - type checks
 > - boundary checks
 > - verification triggers
 > - referential integrity
 > - a select-type access method
 > - compound attributes
 > - a type conversion utility (strings to specified types)
 > - a data import tool which performs integrity checks
 > 
 > ...and some other things.
 > 
 > 
 > One thing I've noticed when playing with it is that it is not well
 > documented in mnesia how to perform a series of schema operations within
 > one schema transaction.
 > 
 > This is obviously something that I wanted to do, since I add user
 > properties to a table in order to support integrity checks.
 > 
 > Here's how I've done it:
 > 
 > create_table(Tab, MnesiaProps, UserProps) ->
 >     F = fun() ->
 >                 mnesia_schema:do_create_table(Tab, MnesiaProps),
 >                 rdbms:do_add_properties(UserProps)
 >         end,
 >     mnesia_schema:schema_transaction(F).
 > 
 > Also note that I've patched mnesia_schema.erl in order to support adding
 > multiple user properties within one transaction. The patch is included
 > in the rdbms-1.0 package.
 > 
 > 
 > /Uffe
 > 
 > -- 
 > Ulf Wiger, Chief Designer AXD 301     <ulf.wiger@REDACTED>
 > Ericsson Telecom AB                          tfn: +46  8 719 81 95
 > Varuvägen 9, Älvsjö                          mob: +46 70 519 81 95
 > S-126 25 Stockholm, Sweden                   fax: +46  8 719 43 44
 > 

-- 
Dan Gudmundsson               Project:    Mnesia, Erlang/OTP
Ericsson Telecom AB	      Phone:      +46 8 719 7185
ETX/DN/SP                     Fax:        +46 8 719 9101
S-126 25 Stockholm            Visit addr: Götlandsv. 218, Älvsjö




More information about the erlang-questions mailing list