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 |
In general, Web applications do not display all the search results on a single page, but limit the number of items shown on each page.
In order to control the number of items of data that will be obtained, specify the reply start number and the number of items to return per request as arguments of the ShunSearch function.
The following diagram shows the process for obtaining search results according to the number of data items.
SHUNHSTMT StmtH; /* Allocate data manipulation handle */ ShunAllocHandle(ConH, &StmtH); (1) /* Execute search */ ShunSearch(StmtH, 11, NULL, 0, 5, "/document/base/prefecture == 'Sydney'", "/document/base/name, /document/base/price", NULL, &Hit_Cnt, &Return_Cnt, &Returnable_Cnt, &Rec_Id_Out, &Data, &First_Pos, &Last_Pos); (2) /* Extract search results */ printf("Number of hits = %d\n", Hit_Cnt); (3) if(Hit_Cnt > 0) { for (i = 0; i < Return_Cnt; i++) { printf("[Result] Item No. %d= %s\n", i+1, Data[i].Data); } } /* Release data manipulation handle */ ShunFreeHandle(StmtH); (4) |
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, the data acquisition location (acquisition start position or acquisition end position), the maximum number of data items, the search expression and the return expression as parameters of the ShunSearch function and then execute the search.
The ShunSearch function returns the address of the search results.
Search results consist of arrays of structures, so data is extracted from these arrays.
Together with the search results, the ShunSearch function also returns a record ID (conductor control information and a reply record identifier) that uniquely identifies an XML document. The record ID is used to extract, delete, and update the entire XML document that corresponds to it.
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
![]() ![]() |