xflminterface IF_QueryValFunc : public XF_RefCount
This class represents a query function. XFLAIM does not provide an implementation of this interface. It is up to the application to provide an implementation. It is a way for an application to insert application defined functions into a query expression. These functions return values which may be compared to other operands or used as application-defined predicates. A function may have one or zero parameters. If it has a parameter, it must be an XPATH that evaluates to a DOM node. The node specified by the XPATH will be passed into the function.
Method Summary |
|
RCODE | getValue - Return function's value. |
RCODE | cloneSelf - Create a new function object, and copy the information from this function object into the new node source object. |
Method Detail |
RCODE getValue(
IF_Db * pDb,
IF_DOMNode * pContextNode,
ValIterator eValueToGet,
eValTypes * peValType
FLMBOOL * pbLastValue,
void * pvVal
IF_DynaBuf * pDynaBuf = NULL);
Return the value for a function. This method will be called by XFLAIM during query evaluation when it needs to retrieve the value of an application defined function.
Parameters In:
IF_Db* pDb Pointer to database object being used during optimization. IF_DOMNode pContextNode If the function takes a single parameter, it will be an XPATH expression that specifies a DOM node. This is a pointer to the DOM node that was found by the XPATH expression. If the function does not take any parameters, this parameter will be NULL. ValIterator eValueToGet Functions are like XPATHs in that they may result in a set of values. This parameter specifies which value in the set is to be returned: first, last, next, or previous. Implied in the need to return next and previous is the fact that the function object should remember the last value that was returned and return the "next" or "previous" value from that one. If the "next" value is requested, but no prior calls have been made, this method should return the "first" value in the set. If the "previous" value is requested, but no prior calls have been made, this method should return the "last" value in the set. NOTE: This method should return NE_XFLM_EOF_HIT if there are no more values and XFLAIM is requesting the "first" or "next" value. It should return NE_XFLM_BOF_HIT if there are no more values and XFLAIM is requesting the "last" or "previous" value.
Parameters Out
eValTypes * peValType Type of value that is being returned. FLMBOOL * pbLastValue Should return TRUE if this is the "last" value that can be returned. If requesting the "next" value, and this is the "last" value, this should be set to TRUE. If requesting the "previous" value, and this is the "first" value, this should also be set to TRUE. If there is only one value in the set, this should always be set to TRUE. void * pvVal Number values are returned here. This should NOT be used to return binary or string data - only numeric data. For binary and string values, use the dynamic buffer (pDynaBuf). This buffer is only big enough to hold a 64 bit number. IF_DynaBuf * pDynaBuf Dynamic buffer to be used for returning binary and string values. String values should always be returned as UTF8 strings.
RCODE cloneSelf(
IF_QueryValFunc ** ppNewObj);
Create another IF_QueryValFunc object and copy the information from this object into it. All information from this function object should be copied into the new function object. The new function object should be able to be independent of this function object. In other words, it should be possible to free this function object without affecting the new function object. XFLAIM calls the copy method whenever it clones a query object. If a query object contains a function object in one or more places in its query criteria, it is necessary to have complete and independent copies of those function objects inside the query criteria of the cloned query object.
Parameters In: none
Parameters Out:
IF_QueryValFunc * ppNewObj Newly created function object object is returned here.