skip to main content
OpenAccess SDK SQL Engine Core Functions API : Function Reference : dam_add_scalarEx2
 

dam_add_scalarEx2

This function is called by the IP to add information, including the qualifier name, about each custom scalar function. Use this function when the SDK calls OAIP_init_scalar to register the custom scalar functions that your IP has implemented. The length, precision, and scale of the result of the scalar functions can be explicitly defined or set to DAM_NOT_SET to use the defaults. The qualifier of the scalar function can be explicitly defined or set to null. Default values are indicated in the description of the arguments in the following table. For details on setting the length, precision, and scale, refer to the corresponding fields in the OA_COLUMNS table in the "Schema Definition and Management" section of the OpenAccess SDK SQL Engine Programmer's Guide.
int dam_add_scalarEx2(
XM_Tree * pMemTree,
DAM_HSCALAR_LIST pList,
char * sQualifierName,
char * sName,
int iMapAsColumn,
int iConstantFunc,
int iResXoType,
int iLength,
int iPrecision,
int iScale,
int iNumInputParams,
dam_scalar_func_type pfScalarFunc)
Table 63. Parameters for dam_add_scalarEx2
Parameter
Type
Description
IN
pMemTree
XM_Tree *
The tree to use for allocating items with xm_allocItem calls.
pList
DAM_HSCALAR_LIST
The list to which scalar function information is to be added.
sQualifierName
char *
The name of the function qualifier.
sName
char *
The name of the scalar function.
iMapAsColumn
int
Map function as column.
Set it to 0 for normal scalar functions.
1 - map function as column.
0 - map function as normal scalar function.
iConstantFunc
int
Indicates if the function has constant output or not.
1 - indicates that the function is a constant scalar function and is evaluated only once per query if all its arguments are literal values.
0 - indicates that the function is a variable scalar function and therefore should be evaluated once per record during the dam_isTargetRow call, regardless of the input.
iResXoType
int
The type of the result value of the scalar function.
iLength
int
Length of the result value of the scalar function. Set to DAM_NOT_SET to accept the following default values:
CHAR, BINARY: 256
WVARCHAR: 2048
VARCHAR, VARBINARY: 1024
LONGVARCHAR, LONGVARBINARY: 1000000
WLONGVARCHAR: 1000000
NUMERIC: 34
Other types: Default values as specified in OA_COLUMNS
iPrecision
int
Precision of the result value of the scalar function. Set to DAM_NOT_Set to accept the following default values:
CHAR, WCHAR, BINARY: 255
VARCHAR, WVARCHAR, VARBINARY: 1024
LONGVARCHAR, WLONGVARCHAR, LONGVARBINARY: 1000000
NUMERIC: 32
Other types: Default values as specified in OA_COLUMNS
iScale
int
Scale of the result value of the scalar function. Set to DAM_NOT_SET to accept the following default value:
NUMERIC: 5
Other types: Default values as specified in OA_COLUMNS
iNumInputParams
int
The number of arguments expected by the function.
>=0 to allow fixed argument list
< 0 to allow variable argument list with a maximum of |args|
pfScalarFunc
dam_scalar_func_type
The function in the IP that can execute the scalar function. All scalar functions must be exported to allow the OpenAccess SDK SQL engine to call them.
RETURN
int
DAM_SUCCESS - on success
DAM_FAILURE - on failure

See also

*dam_isTargetRow
*dam_add_scalarEx