Changes between Version 6 and Version 7 of FDORfc30
- Timestamp:
- 11/19/08 06:26:05 (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
FDORfc30
v6 v7 50 50 It 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. 51 51 52 Application 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 52 60 == Proposed Solution == 53 61 … … 153 161 ''false'': throw an exception. 154 162 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 155 165 '''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: 156 166 … … 183 193 ''false'': convert 0 to false and 1 to true. Throw an exception for other values 184 194 185 See the chart in the attached document for information on which pairs of types are compatible and which are incompatible.186 187 195 === Supporting Functions === 188 196 … … 203 211 == Implications == 204 212 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.213 All 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. 206 214 207 215 == Test Plan == 208 216 209 How the proposed change will be tested, if applicable. New unit tests should be detailed here??? 217 A unit test suite will be added to test the API defined above. 210 218 211 219 == Funding/Resources == 212 220 213 T his 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.221 To be determined