abstract class %XSQL.DS.IResultSet
extends %SQL.StatementResult
IResultSet
A result set is a collection of rows. Each row has some number of columns described by the result set's metadata.
A result set has an iterator that is initialized on instantiation to be before the first row. Invoking %Next() advances the
iterator to the next row. Column values from the current row can be accessed by name or position by invoking the %Get() and %GetData() methods.
method %CreateSnapshot(storageOffset As %Integer, ByRef lastRow As %Integer, ByRef pRuntimeMode As %Integer = "", pStatic As %ResultSet.Static = "")
as %Status
%CreateSnapshot(storageOffset,lastRow)
Copy all rows from the current position to the end of the cursor into a temporary
global. Fetch rowCount rows into a temporary global. If the rowCount is -1 then all rows are fetched
method %DispatchGetProperty(pProperty As %String(MAXLEN=255))
Dispatch Get calls when the does not exist
in the class descriptor. This implementation normalizes case and
attempts to dispatch to the correct property, effectively making properties
corresponding to column values case insensitive. Also, SQLCODE, ROWID and ROWCOUNT
are case-normalized and dispatched to the correct property.
abstract method %Get(colname As %String = "")
as %Library.String
Returns the value of the column with the name name in the current row of the result set.
If name is not a valid column name, this method returns an empty string.
abstract method %GetData(colnbr As %Integer = 0)
as %Library.String
Returns the value of column colnbr in the current row of the result set.
method %GetMetadata()
as %SQL.StatementMetadata
Return the result set metadata as a %SQL.StatementMetadata instance.
abstract method %Next(ByRef sc As %Library.Status = $$$OK)
as %Library.Integer
Advance the result set cursor to the next row. Returns 0 if the cursor is at the end of the
result set.
method %Print(pDelimiter As %String = " ")
as %Status
%Print()
Write the current row to the current device. An optional column delimiter can be
specified. No formatting is applied other than writing pDelimiter between
column values. This can be useful for exporting result set data to tab delimited files.
For example:
set sql = "select name,home_street,home_city,home_state,home_zip from sample.person"
set rset = ##class(%ResultSet.SQL).%Prepare(.sql,.err,"")
if '$Isobject(err) {
set file="c:\temp\names.asv"
open file:"WNS"
use file while rset.%Next() { do rset.%Print($char(9)) }
close file
}
Example data:
Cornell,Ezra M. | 340 Franklin Court | Sarasota | NY | 12866 |
Huff,Stephen A. | 548 Washington Blvd | Brownfield Center | MD | 53436 |
Sands,Jeep Q. | 7298 Washington Drive | Xavier | WY | 23685 |
abstract method %SendDelimitedRows(pMaxRows As %Integer = 0, pDelimiter As %String = "", ByRef pReturnCount As %Integer = 0)
as %Status
Fetch and send a series of rows for continuous query client. For internal use only.