Element: dbstructure.key_member

Type

string

Description

The name of the key-member of a dbstructure or dbstructure object. This corresponds to the value of the -mem switch at dbstructure definition time.

The key-member is only used when the dbstructure object is a member of a more complex parent structure, e.g. a structure, compound or gstructure. It links the search criteria dbstructure.key to one of the parent structure’s values to facilitate dynamic database look-up.

To illustrate, consider a dbstructure definition:

dbstructure ~test.node,~global.net,'nodes',-mem='tname'

and a gstructure definition:

gstructure ~test.town {
    string tname
    ~test.node node
}

and a gstructure object:

~test.town mytown
mytown.tname = 'Halifax'

Because of the -mem switch in the definition of ~test.node, the look-up key of all objects of type ~test.node is

tname = <string>

where <string> is evaluated dynamically. In our example, the look up key for mytown therefore becomes

tname = "Halifax".

The values of ~test.node.key_member and mytown.node.key_member are 'tname'.

This key assignment using the key-member is automatic unless the dbstructure.key element for an object is set specifically, in which case the key-member evaluation is suppressed. If the key is set and a dynamic parameter $ is used, then the key-member value would be used but not its name, e.g.

mytown.node.key = 'city = "$"'

would be evaluated as city = 'Halifax'

If a dbstructure object is not a member of a parent structure the key_member element is not used.

This element is read-only and cannot be changed.