Chapter 12 Calling Jaguar Component Methods from PowerDynamo
When a Dynamo script calls a Jaguar component through Java, results are returned as Tabular ResultSets. Tabular ResultSets have different properties and methods than the Dynamo query object. Dynamo includes a script called javaqry.ssc that is installed in the system/utils folder of the Dynamo web site. This script implements a class called JavaQuery which takes as a parameter a TabularResults Set object sent by Jaguar and returns a class that has methods mimicking those of a Dynamo query object.
Scripts that call a Jaguar component through Java and do not make use of the JavaQuery class look something like this:
comp = java.CreateComponent( "SVU/SVUEnrollment" );
prequery = comp.getMajors();
query = java.CallStaticMethod( "com.sybase.CORBA.jdbc11.SQL","getResultSet",prequery );
received = query.next();
metadata = query.getMetaData();
columns = metadata.getColumnCount();
document.writeln( "There are " + columns + " columns" );
while( received ) {
fields = query.Fields;
for( j = 0; j < columns; j++ ) {
value = query.getString( j )
document.writeln( value );
}
received = query.next();
}
Using the JavaQuery class, you could use:
import ~/system/utils/javaqry.ssc;
comp = java.CreateComponent( "SVU/SVUEnrollment" );
// returns Tabular ResultSet object
query = comp.getMajors();
// wrap up the Tabular ResultSet to mimic a Dynamo query
//object
dynQuery = new JavaQuery( query );
columns = dynQuery.GetColumnCount();
document.writeln( "There are " + columns + " columns" );
while( dynQuery.MoveNext() ) {
for( j = 0; j <= columns; j++ ) {
value = dynQuery.GetValue(j);
document.writeln( value );
}
}
Copyright © 1999 Sybase, Inc. All rights reserved. |