Changes between Version 6 and Version 7 of FDORfc30


Ignore:
Timestamp:
11/19/08 06:26:05 (16 years ago)
Author:
brentrobinson
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • FDORfc30

    v6 v7  
    5050It is also possible to convert between various numeric types through simple casting. However, this leads to source code with sizeable switch statements when converting between two arbitrary data types.
    5151
     52Application and Provider developers also need a certain amount of control over how the conversion is performed, in regards to:
     53
     54 Truncation - how to handle values that are too large for the destination type (e.g. convert 100000 to int16). In most cases, the conversion should fail but there are some cases where truncation is ok. For example, if 100000 is the inclusive maximum for a range constraint, then converting it to max int16 would be ok.
     55
     56 Shifting - how to handle values that lose precision when converted (e.g. convert 1.9 to int32). In some cases, rounding the value is ok. However, if it is a value parsed from an FDO filter string (e.g "ID = 1.9"), then rounding it is not ok since that changes the filter to "ID = 2".
     57
     58 Error Handling - the simplest way to handle errors is to throw an exception. However, there are cases where the caller might just want to test whether the conversion can be done, without generating an error. In these cases, trapping and discarding the exception each time would be cumbersome.
     59
    5260== Proposed Solution ==
    5361
     
    153161  ''false'': throw an exception.
    154162
     163 See the chart in [http://trac.osgeo.org/fdo/attachment/wiki/FdoDataValueTypeConversion/FDO%20DataValue%20Conversion%20Compatibility.pdf FDO DataValue Conversion Compatibility] for information on which pairs of types are compatible and which are incompatible.
     164
    155165 '''shift''' – determines what happens if conversion would cause the value to change. This can happen when converting between numeric types and the destination type does not have enough precision to hold the value as is (e.g convert 1.9 from Double to Int32 ). Applicable only when both source and destination types are one of Byte, Decimal, Double, Int16, Int32, Int64 or Single:
    156166
     
    183193  ''false'': convert 0 to false and 1 to true. Throw an exception for other values
    184194
    185  See the chart in the attached document for information on which pairs of types are compatible and which are incompatible.
    186 
    187195=== Supporting Functions ===
    188196
     
    203211== Implications ==
    204212
    205 This section allows discussion of the repercussions of the change, such as whether there will be any breakage in backwards compatibility, if documentation will need to be updated, etc.
     213All of the proposed changes are additions to the FDO API so there are no backward compatibility issues. The new functions will need to be included in FDO API documentation.
    206214
    207215== Test Plan ==
    208216
    209 How the proposed change will be tested, if applicable.  New unit tests should be detailed here???
     217A unit test suite will be added to test the API defined above.
    210218
    211219== Funding/Resources ==
    212220
    213 This section will confirm that the proposed feature has enough support to proceed.  This would typically mean that the entity making the changes would put forward the RFC, but a non-developer could act as an RFC author if they are sure they have the funding to cover the change.
     221To be determined