Skip to main content

%XSQL.DS.IResultSet

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.

Property Inventory

Method Inventory

Properties

property %Metadata as %Library.String);
Property methods: %MetadataDisplayToLogical(), %MetadataGet(), %MetadataIsValid(), %MetadataLogicalToDisplay(), %MetadataLogicalToOdbc(), %MetadataNormalize(), %MetadataSet()

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))
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
Inherited description: 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 CourtSarasotaNY12866
Huff,Stephen A.548 Washington BlvdBrownfield CenterMD53436
Sands,Jeep Q.7298 Washington DriveXavierWY23685
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.

Inherited Members

Inherited Properties

Inherited Methods

FeedbackOpens in a new tab