span8
span4
span8
span4
FME 2014 introduces support for null attributes on features.Plug-ins that currently or would like to work with null values require code changes.Other plug-ins are largely unaffected.
For example,a reader/writer plug-in supporting a database format might provide a way to:
The central issue is how FME deals with the concept of "no data".An attribute may have a concrete value (e.g.,the number 5 or the string "hello"),or it may represent a lack of data in one of three ways: it can bemissing(not present),empty(i.e.,a string with no text),ornull(a database concept meaning "unknown").These three "no data" concepts can be found in various forms in many data formats and systems.
Prior to FME 2014,the convention was to represent null values in external data as missing attributes in FME.However,the situation was ambiguous: sometimes nulls became empty strings instead,and many missing attributes were missing for reasons other than being null.
(1) In FME 2014,null attributes exist.
In FME 2013 and before,null values were often represented as missing attributes.A request to get a missing attribute as a string fails.A request to list the attributes on a feature will not return missing attributes.
In FME 2014,null values are represented as null;they exist.A request to get a null attribute as a string will succeed,returning the empty string.A request to list the attributes on a feature will include null attributes.
As some plug-ins will receive null attributes where they previously used to receive missing attributes (e.g.,features coming from a database reader),there may be some changes in behavior.These plug-ins will generally see the null values as empty strings.For example,plug-ins that fail on empty attributes but skip over missing ones will be affected.
(2) FME 2014 supports null values of all the primitive types.
Each attribute in FME has a type.It can be a string,a 32-bit integer,etc.In FME 2014,an attribute can have any of the normal types,whether or not it is null.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Feature Type: `attr_test_LOGGED' Attribute(boolean) : `boo' has value `Yes' Attribute(boolean) : `boo_null' isAttribute(encoded: utf-16) : `enc' has value `Hello World!' Attribute(encoded: utf-16) : `enc_null' is Attribute(string) : `fme_feature_type' has value `attr_test' Attribute(string) : `fme_type' has value `fme_no_geom' Attribute(32 bit real) : `r32' has value `123.456' Attribute(32 bit real) : `r32_null' is Attribute(64 bit real) : `r64' has value `1234567890.12345' Attribute(64 bit real) : `r64_null' is Attribute(8 bit integer) : `s08' has value `100' Attribute(8 bit integer) : `s08_null' is Attribute(16 bit integer) : `s16' has value `30000' Attribute(16 bit integer) : `s16_null' is Attribute(32 bit integer) : `s32' has value `2000000000' Attribute(32 bit integer) : `s32_null' is Attribute(64 bit integer) : `s64' has value `9000000000000000000' Attribute(64 bit integer) : `s64_null' is Attribute(string) : `str' has value `Hello World!' Attribute(string) : `str_null' is Attribute(8 bit unsigned integer) : `u08' has value `200' Attribute(8 bit unsigned integer) : `u08_null' is Attribute(16 bit unsigned integer): `u16' has value `60000' Attribute(16 bit unsigned integer): `u16_null' is Attribute(32 bit unsigned integer): `u32' has value `4000000000' Attribute(32 bit unsigned integer): `u32_null' is Attribute(64 bit unsigned integer): `u64' has value `10000000000000000000' Attribute(64 bit unsigned integer): `u64_null' is Geometry Type: Unknown (0) ===========================================================================
… the getAttribute call will fail for null attributes (undetected) and not set the return value.This means subsequent code may operate on an uninitialized,default,or unexpected value.
As noted above,the previous convention was to represent null values in external data as missing attributes in FME.In FME 2014,those null values are now represented as null.
Examples of the previous behavior:
The corresponding FME 2014 behavior for each of the above is as follows:
Developers of existing plug-ins with explicit support for null values should do the following:
The first of these is the most important.Plug-ins that are not updated may experience backwards compatibility breaks,because they may begin to receive null attributes where they previously received missing attributes.This might lead to failures,or nulls being handled as empty strings.
As plug-ins are modified to deal with more kinds of "no data" (i.e.,missing,empty,and null attributes),it can be challenging to track the different states.This is most pronounced for plug-ins that store and extensively manipulate attribute values as strings.In the future,we hope to offer additional tools to assist with these challenges.
virtual void IFMEFeature::setAttributeNullWithType( const char * attrName,const FME_AttributeType attrType )
virtual void IFMEFeature::getAttributeNullMissingAndType ( const char * attrName,FME_Boolean & isNull,FME_Boolean & isMissing,FME_AttributeType & attrType ) const
virtual void setTraitNullWithType( const IFMEString& traitName,const FME_AttributeType traitType)
virtual void IFMEGeometry::getTraitNullMissingAndType ( const IFMEString & traitName,FME_Boolean & isNull,FME_Boolean & isMissing,FME_AttributeType & traitType ) const
The sample TFS reader and writer have been extended to include support for null attributes.
When retrieving attributes from features (e.g.,in a writer plug-in),we recommend that you minimize the number of calls to IFMEFeature to maximize performance.This is why we provided the hybrid getAttributeNullMissingAndType() method.Our expectation is that most plug-ins will be able to make one call to this method,potentially followed by one call to getAttribute() or similar.
Additional keywords: pluginbuilder,integration
Using the FME Plug-in SDK to import/export from an application
Creating a new FME transformer
Developing a new transformer using the FME Plug-in SDK
Developing a new format reader/writer with the FME Plug-in SDK
Porting a 32-bit plug-in to 64-bit
When should I use FME Objects?
Does FME support backwards compatibility for FME Objects?
Installing the FME Plug-in SDK
© 2019 亚搏在线Safe Software Inc |Legal