You can use your mouse to drag and drop the Column data of the ResultSets from their OTD nodes to the Business Rules. Below is a code snippet that can be generated by the Collaboration Editor:
// resultsAvailable() true if there’s an update count and/or a result set available. // note, it should not be called indiscriminantly because each time the results pointer is advanced via getMoreResults() call. while (getSPIn().getSpS_multi().resultsAvailable()) { // check if there’s an update count if (getSPIn().getSpS_multi().getUpdateCount() > 0) { logger.info("Updated "+getSPIn().getSpS_multi().getUpdateCount()+" rows"); } // each result set node has an available() method (similar to OTD’s) that tells the // user whether this particular result set is available. note, JDBC does support access // to more than one result set at a time, i.e., cannot drag from two distinct result // sets simultaneously if (getSPIn().getSpS_multi().getNormRS().available()) { while (getSPIn().getSpS_multi().getNormRS().next()) { logger.info("Customer Id = "+getSPIn().getSpS_multi().getNormRS().getCustomerId()); logger.info("Customer Name = "+getSPIn().getSpS_multi().getNormRS(). getCustomerName()); } if (getSPIn().getSpS_multi().getDbEmployee().available()) { while (getSPIn().getSpS_multi().getDbEmployee().next()) { logger.info("EMPNO = "+getSPIn().getSpS_multi().getDbEmployee().getEMPNO()); logger.info("ENAME = "+getSPIn().getSpS_multi().getDbEmployee().getENAME()); logger.info("JOB = "+getSPIn().getSpS_multi().getDbEmployee().getJOB()); logger.info("MGR = "+getSPIn().getSpS_multi().getDbEmployee().getMGR()); logger.info("HIREDATE = "+getSPIn().getSpS_multi().getDbEmployee().getHIREDATE()); logger.info("SAL = "+getSPIn().getSpS_multi().getDbEmployee().getSAL()); logger.info("COMM = "+getSPIn().getSpS_multi().getDbEmployee().getCOMM()); logger.info("DEPTNO = "+getSPIn().getSpS_multi().getDbEmployee().getDEPTNO()); } } |
resultsAvailable() and available() cannot be indiscriminately called because each time they move ResultSet pointers to the appropriate locations.
Once the "resultsAvailable()" method has been called, the next result (if available) can be either a ResultSet or an UpdateCount, if the default "enableResultSetsAndUpdateCount()" was used.
Because of limitations imposed by some DBMSs, SeeBeyond recommends that for maximum portability, all of the results in a ResultSet object should be retrieved before OUT parameters are retrieved. Therefore, you must retrieve all ResultSet(s) and update counts first, followed by retrieving the OUT type parameters and return values.
The following list includes specific ResultSet behavior that you may encounter:
The method resultsAvailable() implicitly calls getMoreResults() when it is called more than once. Do not call both methods in your Java code. If you do, there may be skipped data from one of the ResultSets when more than one ResultSet is present.
The methods available() and getResultSet() cannot be used when mulitple ResultSets are open at the same time. Attempting to open more the one ResultSet at the same time closes the previous ResultSet. The recommended working pattern is:
Open one Result Set, ResultSet_1 and work with the data until you have completed your modifications and updates. Open ResultSet_2, (ResultSet_1 is now closed) and modify. When you have completed your work in ResultSet_2, open any additional ResultSets or close ResultSet_2.
If you modify the ResultSet generated by the Execute mode of the Database Wizard, you need to make sure that the indexes match the stored procedure; if you do this, your ResultSet indexes are preserved.
Generally, you do not need to call getMoreResults; you need to call it only if you do not want to use our enhanced methods and you want to follow the traditional JDBC calls on your own.