company logo

Value :: assign - Assign Value

The function can be called in order to change an attribute value. The value passed in the right operand (parameter) is converted into the data type of the left operand.

Assigning values depends much on the value types on the left and the right side. In general, the right value (parameter) will be converted to the type of the left value before assigning the value.

An instance has to be be selected in both value handles. When the target value is part of a persistent instance, the function checks, whether the value is going to be changed, i.e. whether it differs from the original value. When this is the case, the function marks the instance as modified (modified()). When the access mode for the value is Read, setting the value is denied, except false is passed in bCheckUpdate.

When conversion is not supported or no instance is selected in the property handle, the function throws an exception.

Return value:  Value handle ( odaba::Value & )

A value handle refers to a (usually) opened value. Invalid value handles may cause an exception.

Implementation details

  1. Assign big integer value
    odaba::Value & Value  :: assign ( int64 i64Value, bool bCheckUpdate )

    The function assigns an int64 value. int64 values cannot be stored into MEMO, BLOB and DateTime values. Trying to assign an integer value to one of those types will throw an exception.

    • i64Value - Big integer value

      Big integer values are 64 bit integer values.

    • bCheckUpdate - Check update

      When this option is set to true, the function checks, whether the property can be updated or not. Otherwise, the value is set without checking.

  2. to list
  3. Assign binary data block
    odaba::Value & Value  :: assign ( odaba::Binary &cBinary, bool bCheckUpdate )

    The function may be used for storing data to a BLOB value. The function works similar to the write() function, i.e. it completely replaces the data in the BLOB value instance.

    When the value is not accessible or in not a BLOB instance, the function throws an exception.

    • cBinary - Binary data block handle

      Constant reference to a binary data block handle, which may contain binary data up to 2 GB.

    • bCheckUpdate - Check update

      When this option is set to true, the function checks, whether the property can be updated or not. Otherwise, the value is set without checking.

  4. to list
  5. Assign Boolean value
    odaba::Value & Value  :: assign ( bool bValue, bool bCheckUpdate )

    The function stores a bool value. bool values cannot be stored into into Date, Time, MEMO, BLOB or DateTime values. Trying to assign a Boolean value to one of those types will throw an exception.

    • bValue - Boolean value

      Valid values for Boolean values are true and false.

    • bCheckUpdate - Check update

      When this option is set to true, the function checks, whether the property can be updated or not. Otherwise, the value is set without checking.

  6. to list
  7. Assign date value
    odaba::Value & Value  :: assign ( odaba::Date &cDate, bool bCheckUpdate )

    The function assigns a Date value. Date values cannot be stored intoTime, MEMO, BLOB and REAL (double) values. Trying to assign a date value to one of those types will throw an exception.

    • cDate - Date

      The date contains day, month and year, but not the time.

    • bCheckUpdate - Check update

      When this option is set to true, the function checks, whether the property can be updated or not. Otherwise, the value is set without checking.

  8. to list
  9. Assign timestamp value
    odaba::Value & Value  :: assign ( odaba::DateTime &cDateTime, bool bCheckUpdate )

    The function assigns a DateTime value. DateTime values cannot be stored intoINT, MEMO, BLOB and REAL (double) properties. Trying to assign a timestamp value to one of those types will throw an exception.

    • cDateTime - Time stamp

      A time stamp combines date and time

    • bCheckUpdate - Check update

      When this option is set to true, the function checks, whether the property can be updated or not. Otherwise, the value is set without checking.

  10. to list
  11. Assign double value
    odaba::Value & Value  :: assign ( double vDouble, bool bCheckUpdate )

    The function assigns a double value. double values cannot be stored into MEMO, BLOB, Time, Date and DateTime values. Trying to assign a double value to one of those types will throw an exception.

    Float conversion is not supported explicitly, but float values, usually are converted into double values automatically (by compiler), before calling the assignment function.

    • vDouble - Double value
    • bCheckUpdate - Check update

      When this option is set to true, the function checks, whether the property can be updated or not. Otherwise, the value is set without checking.

  12. to list
  13. Assign integer value to property
    odaba::Value & Value  :: assign ( int32 iValue, bool bCheckUpdate )

    The function assigns an int32 value. int32 values cannot be stored into MEMO, BLOB and DateTime values. Trying to assign an integer value to one of those types will throw an exception.

    • iValue - Integer value

      The value is passed as platform independent 32-bit integer value.

    • bCheckUpdate - Check update

      When this option is set to true, the function checks, whether the property can be updated or not. Otherwise, the value is set without checking.

  14. to list
  15. Set normalized numeric value in attribute
    odaba::Value & Value  :: assign ( int32 iValue, bool bCheckUpdate, bool bNormalize )

    The function can be used in order to store integer values with decimal precisions in INT or unsigned INT attribute values. When defining a a number with two decimals (INT(10,2)), assigning 1 will result internally into 100 (1.00). Assigning the value calling assign(number,true,true) will result in 1 (0.01).

    When no instance is selected in the value handle or when the value handle does not refer to an integer value, the function will throw an exception.

    • iValue - Integer value

      The value is passed as platform independent 32-bit integer value.

    • bCheckUpdate - Check update

      When this option is set to true, the function checks, whether the property can be updated or not. Otherwise, the value is set without checking.

    • bNormalize - Normalize integer or string
  16. to list
  17. Assign string value
    odaba::Value & Value  :: assign ( odaba::String &sString, bool bCheckUpdate, bool bConvert )

    The function assigns a String value. String values cannot be stored into BLOB values. Trying to assign a string value into a BLOB value will throw an exception.

    In order to convert control sequences as '\n'or '\t' into control characters, true has to be passed for bConvert.

    • sString - String value
    • bCheckUpdate - Check update

      When this option is set to true, the function checks, whether the property can be updated or not. Otherwise, the value is set without checking.

    • bConvert - Conversion option

      In order to allow data conversion, the value must be set to true. In order to suppress data conversion false should be passed.

  18. to list
  19. Assign time value
    odaba::Value & Value  :: assign ( odaba::Time &cTime, bool bCheckUpdate )

    The function assigns a Time value. Time values cannot be stored into Date, MEMO, BLOB and REAL (double) properties. Trying to assign a time value to one of those types will throw an exception.

    • cTime - Time value

      The time value is passed in the ODABA Interface::Time format and provides time in 1/100th seconds.

    • bCheckUpdate - Check update

      When this option is set to true, the function checks, whether the property can be updated or not. Otherwise, the value is set without checking.

  20. to list
  21. Assign instance to value
    odaba::Value & Value  :: assign ( odaba::Instance &cInstance )

    The function assigns instance data to the value. The function expects a complex data type in the value.

    When type definitions for instance and value are different, attributes of the complex data type are copied by name, i.e. only those attributes are copied, which are member of both type definitions.

    Notes:

    The function does not check, whether all attributes have been assigned, i.e. assignments might be incomplete.

    • cInstance - Instance

      The instance is passed as String, which is structured as ESDF data (object interchange format).

  22. to list
  23. Assign key to value
    odaba::Value & Value  :: assign ( odaba::Key &cKey )

    The function assigns key data to the value. The function expects a complex data type in the value.

    When type definitions for key and value are different, attributes of the complex data type are copied by name, i.e. only those attributes are copied, which are member of both type definitions.

    Notes:

    The function does not check, whether all attributes have been assigned, i.e. assignments might be incomplete.

    • cKey - Key value

      A key value is the key definition and a value for the key. The key value is typically provided in ESDF format. Other formats might be set (OIF, XML)

  24. to list
  25. Store value passed in property
    odaba::Value & Value  :: assign ( odaba::Value &cValue, bool bCheckUpdate )

    The function stores the value passed in cValue. cValue must refer to a value property with an instance selected. Conversion between data types must be supported. Otherwise, an exception is thrown.

    • cValue - Value handle

      A value handle refers to a (usually) opened value. Invalid value handles may cause an exception.

    • bCheckUpdate - Check update

      When this option is set to true, the function checks, whether the property can be updated or not. Otherwise, the value is set without checking.

  26. to list