company logo

Using OSI access schemata for hierarchical data access

As well as in other programming languages, access schemata are supported in OSI. The situation in OSI, however, differs from the situation in an programming environment, since OSI does not require property handle objects, but refers to database variables directly. This provides very comfortable data access, but there are some specific conventions, one should consider when using database variables in OSI expressions.

The important rule is, that variables referring to specific selections or filter conditions will always create a new variable instance. Each time when referring to a database variable in an expression, this is, indeed, the same variable. Thus, one may refer in a Person expression many times to the children variable without any problem. As soon, as defining path variables (e.g. children (0) or children . Where(age > 10)), a variable copy will be created internally in order to avoid side effects to the original database variable. Unfortunately, this is not only true for extended variable definitions as children (0) or children ["Paul"], but also for access paths containing Where , Having or OrderBy clauses.

Once, a variable copy has been created, all subsequent database variables are subordinated to the copy of the variable, i.e. those are copies as well.

When referring to long access paths in an expression, it is often more comfortable, implicitly or explicitly defining access hierarchies.

// access paths in a person expression

  while ( children.Next ) { // all three children variables

    Print(children.age);    // refer to the same database variable

    Print(children.name);

    // calculates age distance between first and other children

    // children(0).age creates a copy of the children variable

    Print(children(0).age - children.age)

  }