company logo

Property :: primaryKey - Extract identifying key value

The function extracts the key value for the primary or identifying key as being defined in the type definition of the property handle.

The function extracts the key from the currently selected instance. When an instance is located in the property handle but no instance has been selected, the function will select the instance located before extracting the key value.

When no instance could be selected, the function throws an exception.

When applying the function on weak-typed collections, the function returns the key value for the primary key as being defined for the base type of the collection. This might differ from primary key defined for the type of the currently selected instance. To extract the correct primary key for the instance currently selected, currentKey() might be called.

Return value:  Primary key value ( odaba::Key  )

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

Implementation overview

Implementation details

  1. Provide primary key value
    odaba::Key Property  :: primaryKey (  )

    The function extracts the primary key from the currently selected instance. When an instance is located in the property handle but no instance has been selected, the function will select the instance located before extracting the key value.

    When no instance could be selected, the function throws an exception.

  2. to list
  3. Set primary key value
    odaba::Key Property  :: primaryKey ( odaba::Key vPrimaryKey )

    The passed key value is stored to the component attributes of the property's primary key in the currently selected instance of the property handle.

    For weak-typed collections, where the primary key may change with different instance data types, the currentKey() set function can be called, instead.

    When no instance is selected or when no primary key is defined for the structure the function throws an exception.

    • vPrimaryKey - 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

  4. to list