IRISLIB database
ScrollableResultSet Class Reference

This provides a scrollable resultset object that can also be saved and loaded It works by running the entire query when the first item of data is requested and storing the results in a global. More...

Inheritance diagram for ScrollableResultSet:
Collaboration diagram for ScrollableResultSet:

Public Member Functions

_.Library.Status OnClose ()
 This callback method is invoked by the <METHOD>Close</METHOD> method to. More...
 
_.Library.Integer Count ()
 Returns the number of rows contained in this ResultSet.
 
_.Library.RegisteredObject GetObject ()
 If this query contains an object Id then this method opens an object with this Id. More...
 
_.Library.Integer Next (_.Library.Status sc)
 Advance the result set cursor to the next row. More...
 
_.Library.Integer Previous (_.Library.Status sc)
 Advance the result set cursor to the previous row. More...
 
- Public Member Functions inherited from ResultSet
_.Library.Status Close ()
 Closes the current result set cursor.
 
_.Library.Integer ContainsId ()
 If the current query contains an object Id (based on the CONTAINSID parameter. More...
 
_.Library.Status Execute (args)
 Executes the current query. More...
 
_.Library.String Get (_.Library.String name)
 Returns the value of the column with the name name in the current row of the result set. More...
 
_.Library.Integer GetColumnCount ()
 Returns the number of columns in the result set.
 
_.Library.String GetColumnExtInfo (_.Library.Integer n)
 This method accepts the column number as an input parameter and will return a $list containing the class name and property. More...
 
_.Library.String GetColumnHeader (_.Library.Integer n)
 Returns the column header for column n in the result set.
 
_.Library.String GetColumnName (_.Library.Integer n)
 Returns the name of column n in the result set.
 
_.Library.Integer GetColumnType (_.Library.Integer n)
 Returns the type of column n in the result set where type is an integer associated with. More...
 
_.Library.String GetData (_.Library.Integer n)
 Returns the value of column n in the current row of the result set.
 
_.Library.String GetDataByName (_.Library.String name)
 Returns the value of the column with the name name in the current row of the result set. More...
 
_.Library.String GetExtent ()
 The name of the extent that this query will return Id values from (based on the EXTENT parameter. More...
 
_.Library.Integer GetParamCount ()
 Returns the number of input parameters for the current query.
 
_.Library.String GetParamName (_.Library.Integer n)
 Returns the name of input parameter n for the current query.
 
_.Library.String GetStatementType ()
 Returns the SQL statement type of the query if available. More...
 
_.Library.Status Prepare (args)
 Use this method with dynamic queries to provide the query to be. More...
 
_.Library.Integer QueryIsValid ()
 Returns true (1) if the ClassName and QueryName properties of this. More...
 
_.Library.Status SetIdInfo (_.Library.Integer idnumber, _.Library.String extent)
 Set the location of the ID in this query and the extent. More...
 
- Public Member Functions inherited from RegisteredObject
_.Library.Status OnAddToSaveSet (_.Library.Integer depth, _.Library.Integer insert, _.Library.Integer callcount)
 This callback method is invoked when the current object is added to the SaveSet,. More...
 
_.Library.Status OnConstructClone (_.Library.RegisteredObject object, _.Library.Boolean deep, _.Library.String cloned)
 This callback method is invoked by the <METHOD>ConstructClone</METHOD> method to. More...
 
_.Library.Status OnNew ()
 This callback method is invoked by the <METHOD>New</METHOD> method to. More...
 
_.Library.Status OnValidateObject ()
 This callback method is invoked by the <METHOD>ValidateObject</METHOD> method to. More...
 

Public Attributes

 CurrRow
 Number of current row in the temp table, you can set this property to. More...
 
 MaxRows
 This determines how many rows this query will load, the default '0' will load. More...
 
- Public Attributes inherited from ResultSet
 ClassName
 The name of the class containing the query to run. More...
 
 Data
 Used to store the data returned from the resultset by column name. More...
 
 QueryName
 The name of the query to run. More...
 
 RuntimeMode
 Use this property to set the SQL runtime mode for the query to be. More...
 
- Public Attributes inherited from AbstractResultSet
 Data
 Used to store the data returned from the resultset by column name. More...
 
 RuntimeMode
 Use this method to set the SQL runtime mode for the query to be. More...
 

Private Member Functions

_.Library.Status __PopulateData ()
 Executes the current query. More...
 

Private Attributes

 __IsSaved
 If true, the temp table has been saved and should not be. More...
 
 __TempIndex
 Index into temp global used to hold results. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ResultSet
 Test (_.Library.String ClassName, _.Library.String QueryName, args)
 This method is deprecated; use RunQuery.
 
- Static Public Member Functions inherited from AbstractResultSet
 RunQuery (_.Library.String ClassName, _.Library.String QueryName, args)
 This is a diagnostic function; it runs the specified query and prints the output to the console.
 
- Static Public Attributes inherited from RegisteredObject
 CAPTION = None
 Optional name used by the Form Wizard for a class when generating forms. More...
 
 JAVATYPE = None
 The Java type to be used when exported.
 
 PROPERTYVALIDATION = None
 This parameter controls the default validation behavior for the object. More...
 

Detailed Description

This provides a scrollable resultset object that can also be saved and loaded It works by running the entire query when the first item of data is requested and storing the results in a global.

Then you can move around the results by setting the <property>CurrRow</property> and you may also call <method>Previous</method> as well as the standard <method>Next</method>. In addition you may save this resultset and then load it potentially in a different process at a later date and continue reading from it, for example:

Set results=##class(ScrollableResultSet).New("Classname:QueryName") Do results.Execute() Do results.Next() Write results.Data("fieldname") Do results.Save() Set id=results.Id() Kill results Set results=##class(ScrollableResultSet).OpenId(id) Do results.Next() Write results.Data("fieldname")

Note that if you open a ScrollableResultSet and do not call Save on it then when you close this object the data stored in the global will be removed and so you will not be able to open this resultset again. So if you open a scrollable resultset and you wish to use this again call Save on it, but you must always make sure that when you are finished with it you do not call Save so the temporary global used is cleaned up when you are done. Alterntively you can call DeleteId passing the id to remove the saved data.

There is also a <method>Count</method> to find the total number of entries in this resultset. This will not work if running with a query against a remote linked table which returns stream data for a column because the remote linked table returns the stream as an oref and this class does not support persisting this oref.

Member Function Documentation

◆ OnClose()

_.Library.Status OnClose ( )

This callback method is invoked by the <METHOD>Close</METHOD> method to.

provide notification that the current object is being closed.

The return value of this method is ignored.

Reimplemented from ResultSet.

◆ GetObject()

If this query contains an object Id then this method opens an object with this Id.

and returns the object reference. Otherwise it returns a null object reference.

Reimplemented from ResultSet.

◆ Next()

Advance the result set cursor to the next row.

Returns 0 if the cursor is at the end of the

result set.

Reimplemented from ResultSet.

◆ __PopulateData()

_.Library.Status __PopulateData ( )
private

Executes the current query.

The arguments p1... supply the value of any parameters the query may have.

◆ Previous()

Advance the result set cursor to the previous row.

Returns 0 if the cursor is at the end of the

result set.

Member Data Documentation

◆ CurrRow

CurrRow

Number of current row in the temp table, you can set this property to.

move to a new location and also use this to check the current position. If you specify a value that is out of bounds then the row will not be moved. The first row is at CurrRow=1, so it is 1 based and not 0 based.  

◆ __IsSaved

__IsSaved
private

If true, the temp table has been saved and should not be.

automatically deleted.  

◆ MaxRows

MaxRows

This determines how many rows this query will load, the default '0' will load.

all the results, if you set it to 10,000 then it will only load the first 10,000 rows, which will mean you can not access any data beyond the 10,000th element. Also the actual stopping point may be slightly larger than MaxRows because of the way the data is imported, but it will be around this figure.  

◆ __TempIndex

__TempIndex
private

Index into temp global used to hold results.