wiki:FdoExpressionType

Version 4 (modified by gregboone, 17 years ago) ( diff )

--

FDO Expression and Filter GetType Support

Overview

There are a number of places in the core FDO API and the various Provider implementation code, where we need to know the correct FDO expression type. At this time, only dynamic cast can be used, which is not very efficient.

Data values are essentially encapsulated in the FdoDataValue class and its derivations. There is a derivation for each data type supported by FDO. Data types include various integer types (8bit, 16bit, 32bit, 64bit), string, datetime, etc. By implementing this change, developers will be able to clearly and effectively determine the encapsulated type contained in the FdoDataValue object.

There are also instances where developers need to make a distinction between FdoComputedIdentifier, FdoIdentifier, FdoFunction and FdoDataValue objects.

There are a few classes which will benefit of this change. For example, the filter processor classes. With the proposed change, developers wil be able to remove calls to dynamic_cast and replace them with a simple call to a GetType function.

API Changes

Retrieving the expression type will be supported by adding GetExpressionType() (for FdoExpression) functions to each class derived from FdoExpression and GetFilterType() (for FdoFilter) functions to each class derived from FdoFilter. The functions will not have any parameters and will simply return the type of expression or filter.

To support such a change, the FDO API will need to define two enumerations which will contain all types of expression and filters.

The name of the filter enumeration will be FdoFilterClassType.
The name of the expression enumeration will be FdoExpressionClassType.

GetExpressionClassType

FDO_API virtual FdoExpressionClassType FdoExpression::GetExpressionType() = 0;
FDO_API virtual FdoExpressionClassType FdoBinaryExpression::GetExpressionType();
FDO_API virtual FdoExpressionClassType FdoUnaryExpression::GetExpressionType();
FDO_API virtual FdoExpressionClassType FdoParameter::GetExpressionType();
FDO_API virtual FdoExpressionClassType FdoIdentifier::GetExpressionType();
FDO_API virtual FdoExpressionClassType FdoComputedIdentifier::GetExpressionType();
FDO_API virtual FdoExpressionClassType FdoFunction::GetExpressionType();
FDO_API virtual FdoExpressionClassType FdoDateTimeValue::GetExpressionType();
FDO_API virtual FdoExpressionClassType FdoDecimalValue::GetExpressionType();
FDO_API virtual FdoExpressionClassType FdoBooleanValue::GetExpressionType();
FDO_API virtual FdoExpressionClassType FdoByteValue::GetExpressionType();
FDO_API virtual FdoExpressionClassType FdoCLOBValue::GetExpressionType();
FDO_API virtual FdoExpressionClassType FdoBLOBValue::GetExpressionType();
FDO_API virtual FdoExpressionClassType FdoDoubleValue::GetExpressionType();
FDO_API virtual FdoExpressionClassType FdoGeometryValue::GetExpressionType();
FDO_API virtual FdoExpressionClassType FdoInt16Value::GetExpressionType();
FDO_API virtual FdoExpressionClassType FdoInt32Value::GetExpressionType();
FDO_API virtual FdoExpressionClassType FdoInt64Value::GetExpressionType();
FDO_API virtual FdoExpressionClassType FdoSingleValue::GetExpressionType();
FDO_API virtual FdoExpressionClassType FdoStringValue::GetExpressionType();

where:

FdoExpressionClassType – type of the FDO Expression

enum FdoExpressionClassType{
    FdoExpressionClassType_Binary,
    FdoExpressionClassType_UnaryExpression,
    FdoExpressionClassType_ComputedIdentifier,
    FdoExpressionClassType_Identifier,
    FdoExpressionClassType_Parameter,
    FdoExpressionClassType_Function,
    FdoExpressionClassType_Byte,
    FdoExpressionClassType_Boolean,
    FdoExpressionClassType_Int16,
    FdoExpressionClassType_Int32,
    FdoExpressionClassType_Int64,
    FdoExpressionClassType_Single,
    FdoExpressionClassType_Double,
    FdoExpressionClassType_Decimal,
    FdoExpressionClassType_String,
    FdoExpressionClassType_DateTime,
    FdoExpressionClassType_Geometry,
    FdoExpressionClassType_BLOB,
    FdoExpressionClassType_CLOB
};

FdoFilterClassType

FDO_API virtual FdoFilterClassType FdoFilter::GetFilterType() = 0;
FDO_API virtual FdoFilterClassType FdoBinaryLogicalOperator::GetFilterType();
FDO_API virtual FdoFilterClassType FdoUnaryLogicalOperator::GetFilterType();
FDO_API virtual FdoFilterClassType FdoComparisonCondition::GetFilterType();
FDO_API virtual FdoFilterClassType FdoInCondition::GetFilterType();
FDO_API virtual FdoFilterClassType FdoNullCondition::GetFilterType();
FDO_API virtual FdoFilterClassType FdoDistanceCondition::GetFilterType();
FDO_API virtual FdoFilterClassType FdoSpatialCondition::GetFilterType();

where:

FdoFilterClassType – type of the FDO Filter

enum FdoFilterClassType{
    FdoFilterClassType_BinaryLogicalOperator,
    FdoFilterClassType_UnaryLogicalOperator,
    FdoFilterClassType_ComparisonCondition,
    FdoFilterClassType_InCondition,
    FdoFilterClassType_NullCondition,
    FdoFilterClassType_DistanceCondition,
    FdoFilterClassType_SpatialCondition
};
Note: See TracWiki for help on using the wiki.