public interface EsqlPrepareHandler_n
Here is a sample class that replaces SYSIBM.SYSDUMMY1 with DUAL in order to move prepared ESQL written for DB2 to Oracle:
import com.iscobol.types_n.CobolVar;
import com.iscobol.rts_n.EsqlPrepareHandler_n;
public class ChangeQuery implements EsqlPrepareHandler_n {
public void queryDecoder(CobolVar query) {
String db2Query = query.toString();
System.out.println(db2Query);
String oraQuery = db2Query.replaceAll("(?i)sysibm\\.sysdummy1", "dual");
System.out.println(oraQuery);
query.set(oraQuery);
}
}
To install this class in your runtime session, you will set:
iscobol.esql.prepare_handler=ChangeQuery
| Modifier and Type | Method and Description |
|---|---|
void |
queryDecoder(CobolVar query)
Receives the query text and allows you to change this text.
This method is invoked automatically between an EXEC SQL PREPARE and the next EXEC SQL EXECUTE as well as during an EXEC SQL EXECUTE IMMEDIATE |
void queryDecoder(CobolVar query)
query - the query that was prepared and is about to be executed