Chapter 12 Calling Jaguar Component Methods from PowerDynamo
When a Dynamo script calls a Jaguar component through ActiveX and that component returns a result set, an ADO record set is returned. ADO record sets have different properties and methods than the Dynamo query object. Dynamo includes a script called adoqry.ssc that is installed in the system/utils folder of the Dynamo Web site. This script implements a class called ADOQuery which takes as a parameter an ADO record 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 ActiveX and do not make use of the ADOQuery class look something like this:
comp = CreateObject( "SVU.SVUEnrollment" );
comp.Initialize();
// returns ADO RecordSet-like object
query = comp.getMajors();
query.MoveFirst();
columns = query.Fields.Count;
document.writeln( "There are " + columns + " columns" );
while( !query.EOF ) {
fields = query.Fields;
for( j = 0; j < columns; j++ ) {
field = fields.Item(j);
value = field.Value;
document.writeln( value );
}
query.MoveNext();
}
With the ADOQuery class, you could instead do this:
import ~/system/utils/adoqry.ssc;
comp = CreateObject( "SVU.SVUEnrollment" );
comp.Initialize();
// returns ADO RecordSet-like object
query = comp.getMajors();
// wrap up the ADO RecordSet to mimic a Dynamo query
// object
dynQuery = new ADOQuery( query );
columns = dynQuery.GetColumnCount();
document.writeln( "There are " + columns + " columns" );
while( dynQuery.MoveNext() ) {
for( j = 1; j <= columns; j++ ) {
value = dynQuery.GetValue(j);
document.writeln( value );
}
}
Copyright © 1999 Sybase, Inc. All rights reserved. |