company logo

Property :: comparePrimaryKey - Compare two identifying key values

The function compares two key values according to the primary key definition of the property handle ( primaryKey option). Keys are compared according to the data types of its components.

The function returns -1 when the the value for the first key ( vIdentKey1 ) is lower than the value for the second key ( vIdentKey2 ). The function returns 1 when the the first value is higher than the second one. The function returns 0 when the keys are are equal.

The function throws an exception when values are not comparable, i.e. when no primary key has been defined or when the property handle is invalid. The functions ignores key definitions, set for the parameters vIdentKey1 and vIdentKey2 .

Return value:  Compare result ( int32  )

The result of a comparison is an integer value with the following meaning:

  • 0: both operands have the same value
  • 1: the calling operand is greater than the passed operand
  • -1: the calling operand is smaller than the passed operand

Implementation details

int32 Property  :: comparePrimaryKey ( odaba::Key vPrimaryKey1, odaba::Key vPrimaryKey2 )

The function compares the keys passed according to the definition of the primary or identifying key of the complex data type of the property handle.

Notes:

When the property handle handles a weak-typed collection, the complex data type of the property is the data type of the instance currently selected in the property handel. When no instance is selected, it is the data type of the collection.

  • vPrimaryKey1 - Primary key value

    The key value for a primary key is provided as typed string in ESDF or CSV format. Key components can be separated by '|' or ';'.

    In order to pass no key value, an empty string ( String() ) can be passed.

    // key: name;first_name

    Miller;Paul          // simple positioned CSV key

    "Miller";"Paul Mary" // special characters must be quoted

  • vPrimaryKey2 - Primary key value

    The key value for a primary key is provided as typed string in ESDF or CSV format. Key components can be separated by '|' or ';'.

    In order to pass no key value, an empty string ( String() ) can be passed.

    // key: name;first_name

    Miller;Paul          // simple positioned CSV key

    "Miller";"Paul Mary" // special characters must be quoted