Changes between Initial Version and Version 1 of FDORfc8


Ignore:
Timestamp:
Aug 3, 2007, 12:11:41 PM (17 years ago)
Author:
thomasknoell
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • FDORfc8

    v1 v1  
     1
     2
     3= FDO RFC 5 -  Modify Fdo API !FdoFunctionDefinition =
     4
     5This page contains a request for comments document (RFC) for the FDO Open Source project. 
     6More FDO RFCs can be found on the [wiki:FDORfcs RFCs] page.
     7
     8== Status ==
     9 
     10||RFC Template Version||(1.0)||
     11||Submission Date||Aug 03, 2007||
     12||Last Modified||Thomas Knoell [[Timestamp]]||
     13||Author||Thomas Knoell||
     14||RFC Status||Draft||
     15||Implementation Status ||Under Development||
     16||Proposed Milestone||3.3.0.0||
     17||Assigned PSC guide(s)||Greg Boone||
     18||'''Voting History'''||  ||
     19||+1||||
     20||+0||||
     21||-0||||
     22||-1||||
     23 
     24== Overview ==
     25
     26Providers currently can support any number of functions used in the expressions passed to them. Capability methods are available to advertise which functions are supported and their parameters. This RFC adds a set of functions to a number of the current FDO providers using a standard set of names, parameters, parameter types and return types. These functions are commonly used functions in a number of domains and include standard string and numeric type functions. This will allow application developers to start using standard function names knowing that a large number of providers will be supporting those functions. It is hoped that other provider developers will consider adding support for these functions to other FDO providers.
     27
     28The list of supported functions and their signatures will be defined with the Expression Engine. The Expression Engine will also have a default implementation of those functions. Any provider can retrieve the list of supported functions and their signatures by executing the FDO interface GetWellKnownFunctions. Once the list is retrieved a provider can either enhance the list to add provider-specific functions or remove functions and/or signatures if the provider does not support them.
     29
     30The following sections list all newly added functions only. Functions already supported (like Max, Min, Sum) are not listed.
     31
     32
     33=== Aggregate Function ===
     34
     35'''Median''':
     36Represents an inverse distribution function that assumes a continuous distribution model. It takes a numeric value and returns the middle value or an interpolated value that would be the middle value once the values are sorted.
     37
     38'''Stddev''':
     39Returns the sample standard deviation of a provided expression
     40
     41
     42=== Conversion Functions ===
     43
     44'''!NullValue''': Evaluates two expressions and returns the first one if it does not evaluate to NULL, the second otherwise.
     45
     46'''!ToDate''': Converts a string with date information into a date.
     47
     48'''!ToDouble''': Converts a numeric or string expression to a double.
     49
     50'''!ToFloat''':Converts a numeric or string expression to a float.
     51
     52'''!ToInt32''': Converts a numeric or string expression to an int32.
     53
     54'''!ToInt64''': Converts a numeric or string expression to an int64.
     55
     56'''!ToString''': Converts a numeric or date expression to a string.
     57
     58
     59=== Date Functions ===
     60
     61'''!AddMonths''': Adds a specified number of months to a given date.
     62
     63'''!CurrentDate''':Returns the current date.
     64
     65'''Extract''': Extracts a specified part of a date.
     66
     67'''!MonthsBetween''': Calculates the number of months between two given dates.
     68
     69
     70=== Mathematical Functions ===
     71
     72'''Abs''': Returns the absolute value of a numeric expression.
     73
     74'''Acos''': Returns the arc cosine of a numeric expression.
     75
     76'''Asin''': Returns the arc sine of a numeric expression.
     77
     78'''Atan''': Returns the arc tangent of a numeric expression.
     79
     80'''Atan2''': Returns the arc tangent based on two numeric expressions.
     81
     82'''Cos''': Returns the cosine of a numeric expression.
     83
     84'''Exp''': Returns e raised to the power of a numeric expression.
     85
     86'''Ln''':  Returns the natural logarithm of a numeric expression.
     87
     88'''Log''': Returns the logarithm of a numeric expression using the provided base.
     89
     90'''Mod''': Returns the remainder of the division of two numeric expressions.
     91
     92'''Power''': Returns the result of one numeric expression raised to the power of a second numeric expression.
     93
     94'''Remainder''': Returns the remainder of the division of two numeric expressions. In contrast to the function Mod, this routine uses a different calculation algorithm.
     95
     96'''Sin''': Returns the sine of a numeric expression.
     97
     98'''Sqrt''': Returns the square root of a numeric expression.
     99
     100'''Tan''': Returns the tangent of a numeric expression.
     101
     102
     103=== Numeric Functions ===
     104
     105'''Round''': Returns the rounded value of a numeric expression.
     106
     107'''Sign''': Returns the sign of a numeric expression.
     108
     109'''Trunc''': Truncates a numeric or date expression.
     110
     111
     112=== String Functions ===
     113
     114'''Instr''': Returns the position of a substring in a given string.
     115
     116'''Length''': Returns the length of a string.
     117
     118'''Lpad''': Pads a string to the left to a defined string length using the provided pading string.
     119
     120'''Ltrim''': Removes leading blanks from a string.
     121
     122'''Rpad''': Pads a string to the right to a defined string length using the provided pading string.
     123
     124'''Rtrim''': Removes trailing blanks from a string.
     125
     126'''Soundex''': Returns the phonetic representation of a string.
     127
     128'''Substr''': Extracts a substring from a given string.
     129
     130'''Translate''': Replaces a subset of characters in a string with the corresponding value in a set of replacement characters.
     131
     132'''Trim''':  Removes leading and/or trailing blanks from a string.
     133
     134
     135== Affected Providers ==
     136
     137This enhancement will affect the following providers: ArcSDE, MySQL, ODBC, SDF, SHP and SQL Server. For the supported signatures and function return values please refer to the attached document.
     138
     139
     140== Required FDO Enhancements ==
     141
     142Some of the functions take parameters for which values have to come from a pre-defined set of values. For example, the function TRIM takes a string to be processed and a parameter to identify whether the leading, trailing or leading and trailing blanks should be removed. The FDO argument definition class does not allow the specification of such an argument value list. Therefore, to properly implement the function signatures this RFC proposes to enhance the class FdoArgumentDefinition to allow for the specification of argument value list data. This enhancement will introduce a new property and two functions to the named class. None of the existing functions - constructors included - will be changed. The enhancement will take advantage of already existing FDO classes to define value lists. By default, the argument value list will be set to NULL hence providing backward compatibility. No changes in any provider are required unless the provider wants to use this feature.
     143
     144Under no circumstances should this enhancement be seen as an implementation of general argument constraints capabilities.
     145
     146
     147=== Proposed Solution ===
     148
     149This section outlines the necessary code changes in the managed and unmanaged part of FDO.
     150
     151==== Unmanaged Code ====
     152
     153The following outlines the necessary changes in the unmanaged code:
     154
     155{{{
     156class FdoArgumentDefinition : public FdoIDisposable
     157{
     158  …
     159  public:
     160      /// \brief
     161      /// Returns the argument value list for the current argument
     162      ///
     163      /// \return
     164      /// Returns the argument value list for the current argument
     165      FDO_API FdoPropertyValueConstraintList *GetArgumentValueList ();
     166
     167      /// \brief
     168      /// Sets the argument value list for the current argument
     169      FDO_API void SetArgumentValueList (FdoPropertyValueConstraintList *argumentValueList);
     170  …
     171  protected:
     172  …
     173      FdoPropertyValueConstraintList *m_argumentValueList;
     174  …
     175}
     176}}}
     177
     178
     179==== Managed Code ====
     180
     181The following outlines the necessary changes in the managed code:
     182
     183{{{
     184public __gc class ArgumentDefinition : public NAMESPACE_OSGEO_RUNTIME::Disposable
     185{
     186  public:
     187      /// \brief
     188      /// Returns the argument value list for the current argument
     189      ///
     190      /// \return
     191      /// Returns the argument value list for the current argument
     192      __property NAMESPACE_OSGEO_FDO_SCHEMA::PropertyValueConstraintList Get_ArgumentValueList ();
     193
     194      /// \brief
     195      /// Sets the argument value list for the current argument
     196      __property System::Void set_ArgumentValueList (NAMESPACE_OSGEO_FDO_SCHEMA::PropertyValueConstraintList *argumentValueList);
     197  …
     198  protected:
     199  …
     200      FdoPropertyValueConstraintList *m_argumentValueList;
     201  …
     202}
     203}}}
     204
     205
     206=== Example ===
     207
     208The following code example shows how the argument value list enhancement will be used. In this case, it demonstrates the creation of the function definition for the Expression Engine function TRIM. As previously mentioned, one of the arguments identifies what needs to be done. The value of the argument can be either BOTH (in which case leading and trailing blanks are removed from a given string), LEADING (only leading blanks are removed) or TRAILING (only trailing blanks are removed). Please note that the example does not externalize public names and descriptions.
     209
     210{{{
     211    FdoPtr<FdoPropertyValueConstraintList> argumentValueList = FdoPropertyValueConstraintList::Create();
     212    FdoPtr<FdoDataValueCollection> values = argumentValueList->GetConstraintList();
     213    values->Add( FdoStringValue::Create(L"BOTH") );
     214    values->Add( FdoStringValue::Create(L"LEADING") );
     215    values->Add( FdoStringValue::Create(L"TRAILING") );
     216
     217    FdoPtr<FdoArgumentDefinition> arg1 =
     218                 FdoArgumentDefinition::Create(L"parameter_1", L”String to be trimmed”, FdoDataType_String);
     219    FdoPtr<FdoArgumentDefinition> arg2 =
     220                  FdoArgumentDefinition::Create(L"trim_operation", L”Trim operation to be executed”, FdoDataType_String);
     221    arg2->SetArgumentValueList(argumentValueList);
     222
     223    FdoPtr<FdoArgumentDefinitionCollection>trimParameters1 = FdoArgumentDefinitionCollection::Create();
     224    FdoPtr<FdoArgumentDefinitionCollection>trimParameters2 = FdoArgumentDefinitionCollection::Create();
     225
     226    trimParameters1->Add(arg1);
     227    trimParameters2->Add(arg1);
     228    trimParameters2->Add(arg2);
     229
     230    FdoPtr<FdoSignatureDefinition> trimSignature;
     231    FdoPtr<FdoSignatureDefinitionCollection> trimSignatures = FdoSignatureDefinitionCollection::Create();
     232
     233    trimSignature = FdoSignatureDefinition::Create(FdoDataType_String, trimParameters1);
     234    trimSignatures->Add(trimSignature);
     235    trimSignature = FdoSignatureDefinition::Create(FdoDataType_String, trimParameters2);
     236    trimSignatures->Add(ltrimSignature);
     237
     238    FdoPtr<FdoFunctionDefinition> func =
     239                  FdoFunctionDefinition::Create(L”TRIM”, L”Trims leading and/or trailing blanks”, false, trimSignatures);
     240}}}
     241
     242
     243== Implications ==
     244
     245This change will not cause any side-effects, nor any compatibility problems. No existing provider needs to change unless the provider wants to use the new feature.
     246
     247== Test Plan ==
     248
     249Existing unit tests will be enhanced to test those changes.
     250
     251== Funding/Resources ==
     252
     253Autodesk to provide resource / funding to update FDO core and the ArcSDE, MySQL, ODBC, SDF, SHP and SQL Server Providers.
     254