company logo

Operation paths

Keywords:  operation path

An operation path in ODABA is a path, which contains method calls usually in combination with other access path elements. An operation path can be executed in order to produce a result. After executing the path, the result can be accessed as being a derived (calculated) property. Selecting an instance or changing selection in an operation path means changing the selection in the result property.

An operation path can be defined relatively to a parent property. In this case the selection in the parent property determines the result of the operation path, i.e. the operation path needs to recalculate the result, when the selection in the parent handle changes.

Often, operation path refer to elementary values (as Person.GetCount). In this case, the first and only instance is selected after being evaluated. When the result returns a collection, the application has to select instance in the result explicitly.

Path types

The way an operation path operates depends on the path definition. Operation paths containing iterator elements will iterate, i.e. one may call Get() or Position() in order to select the next instance in the path

Executing an operation path

An operation path can be executed explicitly by the application by calling the Property::execute() function. After executing an operation path, the result has been created and can be accessed. In case of of a single instance result, the instance is selected immediately after execution.

When no result collection has been provided, the operation path is automatically executed, when the an instance selection is requested by the application. This may also happen implicitly when calling property handle functions like toString().

The result will be reset, when the selection in the parent handle changes. Usually, the result will be calculated once and only once for each instance in the parent property, except the application calls Execute() several times.

Property        pc(dbhandle,'Persons.count',PI_Read);

char            *value;

  if ( !pc.execute() ) // no error returned from Execute

    value = pc.toString();

Result types

The way results are provided in an operation path depends on the path definition.