Execute the select() method with the “where” clause specified if necessary.
The content of the input.getText() file may contain null, meaning it will not have a “where” clause or it can contain a “where” clause such as empno > 50.
Loop through the ResultSet using the next() method.
Process the return record within a while() loop.
For example:
package prjDB2_JCDjcdALL;
public class jcdTableSelect
{
public com.stc.codegen.logger.Logger logger;
public com.stc.codegen.alerter.Alerter alerter;
public com.stc.codegen.util.CollaborationContext collabContext;
public com.stc.codegen.util.TypeConverter typeConverter;
public void receive( com.stc.connector.appconn.file.FileTextMessage input,
dtd.otdOutputDTD1325973702.
B_Employee otdOutputDTD_DB_Employee_1, otdDB2.OtdDB2OTD otdDB2_1,
com.stc.connector.appconn.
file.FileApplication FileClient_1 )
throws Throwable
{
FileClient_1.setText( "Selectiong records from db_employee table via
Table Select........" );
FileClient_1.write();
otdDB2_1.getDb_employee().select( input.getText() );
while (otdDB2_1.getDb_employee().next()) {
otdOutputDTD_DB_Employee_1.setEmpNo( typeConverter.shortToString
( otdDB2_1.getDb_employee().getEMP_NO(),
"#", false, "" ) );
otdOutputDTD_DB_Employee_1.setLastname( otdDB2_1.getDb_employee().
getLAST_NAME() );
otdOutputDTD_DB_Employee_1.setFirstname( otdDB2_1.getDb_employee().
getFIRST_NAME() );
otdOutputDTD_DB_Employee_1.setRate( otdDB2_1.getDb_employee().
getRATE().toString() );
otdOutputDTD_DB_Employee_1.setLastDate( typeConverter.dateToString
( otdDB2_1.getDb_employee().
getLAST_UPDATE(), "yyyy-MM-dd hh:mm:ss", false, "" ) );
FileClient_1.setText( otdOutputDTD_DB_Employee_1.marshalToString() );
FileClient_1.write();
}
FileClient_1.setText( "Table Select Done." );
FileClient_1.write();
}
}
|