| Interstage Shunsaku Data Manager Application Development Guide - Microsoft(R) Windows(R) 2000/ Microsoft(R) Windows Server(TM) 2003 - - UNIX - |
Contents
Index
![]()
|
| Part 1 The Basic for Developing Application | > Chapter 6 Direct Access Function | > 6.4 Searching Data by Direct Access Key |
The searchByKey method is used in the direct search for Java API.
The following figure shows a flow of the direct search for Java API.

Sample Code
ShunConnection con = new ShunConnection();
ShunPreparedKey preSkey = con.prepareSearchKey("key1", "/"); (1)
preSkey.add("20061101,00000001"); (2)
preSkey.add("20061101,00000002"); (2)
preSkey.add("20061101,00000003"); (2)
preSkey.setSearchType(ShunPreparedKey.SHUN_KEY_COMPLETE_MATCH);
ShunResultSet rs = preSkey.searchByKey(); (3)
System.out.println("[Number of results] = " + rs.getReturnCount());
while (rs.next()) {
System.out.println("[Result] = " + rs.getString());
}
rs.close();
preSkey.close(); (4)
con.close(); |
(1) Create a ShunPreparedKey ObjectCreate a ShunPreparedKey object by specifying a direct access key and a return expression as parameters of the prepareSearchKey method.
(2) Set the direct access keySet the direct access key using the add method.
Multiple direct access keys can be set by using add method.

Specify multiple direct access keys with the Add method to obtain multiple XML documents at a time.
(3) Execute the Search (Create a ShunResultSet Object)Execute the search using the searchByKey method. A ShunResultSet object will be created to hold the results of the search.
(4) Release the ShunPreparedKey ObjectUse the close method of the ShunPreparedKey object to release the object when it is no longer required.

Refer to F.3.2 Searching Data Using Direct Access Key for the sample program of the direct process.
Contents
Index
![]()
|