|
Previous: table.index.column
Next: table.upsave.column
table.upsave
A table.upsave is one of the most flexible ways that Andromeda has to write values from one table to another, with lots of options for specifying when and how the operation occurs. Example
table table_id:
# An upsave will determine
upsave upsave_id:
# These two properties are required
table_id_dest: table_id # a foreign key to this table must
# be defined in the table definition
cascade_action: UPDATE # required for historical purposes
# At least one of these two must be present
afterins: Y/N
afterupd: Y/N
# These are optional
copysamecols: Y/N
column_id_flag: column_id
flag_reset: Y/N
onlychanged: Y/N
# These are explicit column assingments
column column_id: # the column in the parent table
retcol: column_id # ...gets the value of a child column
column column_id: # this time the column in the parent table
retval: hello! # ...gets a literal value, "hello!"
Propertiesupsave upsave_id. The first line of a table.upsave definition begins with the keyword 'upsave', a space, and then an upsave name that is unique within this table, (upsave_id) followed by a colon. table_id_dest. Names the parent table. An upsave definition is always made in a child table, and the child table definition must always contain a foreign key to the parent table being targetted by the upsave. cascade_action. This is required and always takes the value of UPDATE. In future revisions this requirement will be removed. afterins. If Y, the upsave will fire after inserts to the child table. The afterins and afterupd properties can both be set, and at least one of them must be set. afterupd. If Y, the upsave will fire after updates to the child table. The afterins and afterupd properties can both be set, and at least one of them must be set. copysamecols. If Y, the upsave willc opy values from parent to child for all columns that have the same name in both tables. column_id_flag. This is an optional setting. It names a column in the child table. The column must be of type cbool. If such a column is named, the upsave will only fire if the named column is 'Y'. flag_reset. Only relevant if column_id_flag is set. If the flag_reset property is Y, then the column_id_flag is reset to N after the upsave fires. onlychanged. Only changed values will be written to the parent table, unchanged values will not be written. Has no effect on inserts. column.retcol. Allows you to explicitly name a column in the parent table and have it get the value from a column in the child table. column.retval. Allows you to explicitly write a literal value to a column in the parent table.
Previous: table.index.column
Next: table.upsave.column
|
