Table functions : Providing schema information to OpenAccess SDK
Providing schema information to OpenAccess SDK
The following steps demonstrate how the IP provides the schema information of table functions to the OpenAccess SDK.
To provide schema information to the OpenAccess SDK:
1. Return the name of the table function when the schema object type is DAMOBJ_TYPE_TABLE. Before adding the object, the dam_ isSchemaTableFunction() function must be used to check whether the schema object is a table function or a table. Your IP must use DAM ADDSCHEMAOBJ functions to add a table function schema object. In addition, the type of the table object must be set to TABLEFUNCTION. If the schema object passed is a table function, dam_isSchemaTableFunction() returns DAM_TRUE. Otherwise, it returns DAM_FALSE.
The following code snippet illustrates how dam_ isSchemaTableFunction() is used to check whether the object passed is a table or a table function.
if(dam_isSchemaTableFunctionW(pSearchTableObj)) /* Table Function */
{
if (xxx_is_matching_tableW(pSearchTableObj, XXX_QUALIFIER_NAME_W, XXX_USER_NAME_W,
2. Return columns for table functions when the schema object type is DAMOBJ_TYPE_COLUMN. The IP must use the DAM ADDSCHEMAOBJ functions to add a table function column schema object. The IP can check the table function arguments to decide the columns for table function. The IP must use the search column object to check whether the column belongs to a table or a table function. The search column object is NOT NULL only for table functions whereas, for tables, it is set to NULL.
To obtain table function’s parameter list, pass the table function object that comes with the search object to the dam_getTableFunctionArgList() function. To iterate through the list of parameters, pass the object to the functions dam_getFirstValExp () and dam_getNextValExp ().
The following code snippet illustrates how to iterate through the list of parameters.
• The IP returns schema only for the result columns of a table function. OpenAccess SDK SQL Engine does not validate the input arguments of a table function. The IP must check the input arguments and report in case of an error.
dam_add_damobj_proc_column, dam_add_damobj_stat, and dam_add_damobj_table.
.NET and Java:
dam_add_schemaobj
3. Return the index information for table functions when the schema object type is DAMOBJ_TYPE_STAT. The IP must use a search statistic object to check whether the statistics belongs to a table or a table Function. The search statistic object is NOT NULL only for table functions; for tables, it is set to NULL.