company logo

TypeDefinition :: keyDefinition - Get type definition for key

Key definitions are provided as type definitions for complex data types. Key definitions can be provided by position or by key name, which is considered as type name in the scope of the defined complex data type. Key definitions are internal type definitions, which provide only a subset of functionality of ordinary database type definitions. Several type definition functions called with key definitions may fail (e.g. baseTypeCount()).

The function returns the requested key definition. When no key definition could be provided the function throws an exception. When calling the function with an invalid type definition or when the type definition does not refer to a complex data type, the function throws an exception.

Return value:  Type definition ( odaba::TypeDefinition  )

Type definition refers to a type descriptor for a complex data type (structure), view or enumeration.

Implementation overview

Implementation details

  1. Get type definition for key
    const odaba::TypeDefinition TypeDefinition  :: keyDefinition ( odaba::String &sPropertyName )

    The function returns a type definition for the key with the name passed at by position. Any number of keys might be defined for a type definition. Keys are also defined for enumerations in order to arrange enumerators by type (sk_type), code (ik_code), name (ik_name) etc.

    // fragment

    ... function ( TypeDefinition &td) {

      TypeDefinition   keyDef;

      if ( !(keyDef = td.keyDefinition('ik')).IsValid() )

        output("Key 'ik' not defined");

    };

    • sPropertyName - Property name

      The property name may contain a property path that consists of a sequence of property names. Not allowed are operation paths or path properties, i.e. the property name must consist of identifiers separated by dots (.), only.

      In order to pass no property name, an empty string ( String() ) has to be passed.

  2. to list
  3. Get key definition by position
    const odaba::TypeDefinition TypeDefinition  :: keyDefinition ( int32 iPosition )

    The function returns a type definition for the key with the name passed at by position. Any number of keys might be defined for a type definition. Keys are also defined for enumerations in order to arrange enumerators by type, code, name etc.

    // fragment

    ... function ( TypeDefinition &td) {

      TypeDefinition   keyDef;

      int              indx0 = 0;

      while ( (keyDef = td.keyDefinition(++indx0)).IsValid() )

        printf("Key name: %s\n", keyDef.name());

    };

    • iPosition - Position in collection

      The position of an element in a collection is beginning with 0 for the first element.

  4. to list
  5. - internal feature (not documented)
    const odaba::TypeDefinition TypeDefinition  :: keyDefinition (  )
  6. to list