Interstage Shunsaku Data Manager Application Development Guide - Microsoft(R) Windows(R) 2000/ Microsoft(R) Windows Server(TM) 2003 - - UNIX - |
Contents
Index
![]() ![]() |
Part 2 Developing Applications by APIs | > Chapter 11 Developing C Applications | > 11.2 How to Use C APIs | > 11.2.2 Data Searches |
Sometimes it is desirable to obtain the number of items that match specific criteria before extracting the actual data.
In such cases, specify the conditional expression as the argument of the ShunGetHitCount function and obtain the number of matching items only.
The following diagram shows the process for obtaining the number of XML documents that match specified conditions.
SHUNHSTMT StmtH; /* Allocate data manipulation handle */ ShunAllocHandle(ConH, &StmtH); (1) /* Specify the search expression and obtain the number of hits */ ShunGetHitCount(StmtH, "/document/base/city == 'Sydney'", &Hit_Cnt); (2) /* Extract number of hits */ printf("Number of hits = %d\n", Hit_Cnt); /* Release data manipulation handle */ ShunFreeHandle(StmtH); (3) |
Allocate the data manipulation handle in advance by specifying the connection handle to be used as the parent handle in the ShunAllocHandle function.
Specify the data manipulation handle and the search expression as parameters of the ShunGetHitCount function and execute the search. Only the number of hits will be returned.
After the data search has been performed and the results have been extracted, use the ShunFreeHandle function to release the data manipulation handle.
Contents
Index
![]() ![]() |