Creates a non modifiable SqlPathExpression object that represents the path specified by the path argument. Non modifiable means that the navigated path will not create path elements if they do not already exist. This function returns a pointer to the PathExpression object which is used as input to the functions that navigate the path, namely the cniSqlNavigatePath family.
There is an overhead involved in creating the expression so if the same path expression is to be used for every message then this function should be called once and the CciSqlPathExpression* that is returned should used in a call to niSqlNavigatec for each message. It is possible to use the CciSqlPathExpression* on a different thread than it was created.
CciSqlPathExpression* cniSqlCreateReadOnlyPathExpression( int* returnCode, CciNode* nodeObject, CciChar* dataSourceName, CciChar* path );
If successful, the address of the SQLPathExpression object is returned. If an error occurs, CCI_NULL_ADDR is returned and the return code parameter indicates the reason for the error. Once the SQLPathExpression is no longer needed, (typically when the node is deleted) it should be deleted by calling cniSqlDeletePathExpression.
The switch node sample shows how to navigate to a syntax element using functions like cniFirstChild. The following code could be used to achieve the same result.
In _Switch_createNodeContext function, we create the CciSqlPathExpression for use later.
{ CciChar ucsPathExpressionString[32]; char* mbPathExpressionString = "InputBody.Request.type"; /* convert our path string to unicode*/ cciMbsToUcs( NULL, mbPathExpressionString, ucsPathExpressionString, 32, BIP_DEF_COMP_CCSID); p->pathExpression = cniSqlCreateReadOnlyPathExpression( NULL, nodeObject, NULL, /*we do not reference Database*/ ucsPathExpressionString); }
We can then use that CciSqlPathExpression in the _Switch_evaluate function.
CciElement* targetElement = cniSqlNavigatePath( NULL, ((NODE_CONTEXT_ST *)context)->pathExpression, message, destinationList, exceptionList, NULL, /*we do not reference any output trees*/ NULL, NULL);
Notices |
Trademarks |
Downloads |
Library |
Support |
Feedback
![]() ![]() |
as08031_ |