Skip to main content

%XDBC.Gateway.JDBC.ResultSet

class %XDBC.Gateway.JDBC.ResultSet extends %XDBC.Gateway.ResultSet

FOR INTERNAL USE - do not invoke directly

Method Inventory

Methods

method %Display(pDelimiter As %String = $Char(9), colAlign As %Integer = 0)
method %Get(colName As %String) as %Boolean
method %GetData(colindex As %String) as %Boolean
method %Next() as %Boolean
method %OnNew(connection As %XDBC.Gateway.JDBC.Connection, externalResult As %ObjectHandle) as %Status
Inherited description: This callback method is invoked by the %New() method to provide notification that a new instance of an object is being created.

If this method returns an error then the object will not be created.

It is passed the arguments provided in the %New call. When customizing this method, override the arguments with whatever variables and types you expect to receive from %New(). For example, if you're going to call %New, passing 2 arguments, %OnNew's signature could be:

Method %OnNew(dob as %Date = "", name as %Name = "") as %Status If instead of returning a %Status code this returns an oref and this oref is a subclass of the current class then this oref will be the one returned to the caller of %New method.

method %Print(pDelimiter As %String = " ", colAlign As %Integer = 0, ByRef metadata As %ArrayOfObjects) 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
method BeforeFirst()
Position the cursor before the first row in the result set
method Close() as %Status
method Get(colindex As %RawString = "") as %Library.RawString
Returns the value of the column with the name colname in the current row of the result set.

If colname is not a valid column name, this method throws a error.

method GetBuffer(ByRef moreBuffers As %Boolean) as %List
Returns the current row buffer to the caller. This method will refuse to return the buffer if there result set is already being iterated over by cursor (if the cursor is not before the start of the result set) Returns 1 if more buffers exist, 0 if this is the last buffer
method GetData(colindex As %Integer) as %Library.RawString
method GetFetchSize() as %Integer
Retrieves the fetch size for this ResultSet object.
method GetMetaData() as %XDBC.Gateway.ResultSetMetaData
Return the result set metadata as a %SQL.StatementMetadata instance.
method GetObject(columnIndex As %Integer) as %ObjectHandle
Gets the value of the designated column in the current row of this ResultSet object as %ObjectHandle
method GetRow() as %Library.List
Inherited description: Advance to the next row in the result referenced by %ProcCursor. Returns 0 if the cursor is at the end of the result set. An optional argument contains a %Library.Status value on return. This %Status value indicates success or failure of the %GetRow() call. %SQLCODE is also set by %GetRow(). The row is returned in $List format by reference in the Row argument. If %SQLCODE'=0, Row will be null (""). This implementation is overridden by classes that implement the result set interface.
method GetRows(rowCount As %Library.Integer, ByRef rows As %Library.List, ByRef sc As %Library.Status = $$$OK) as %Library.Integer
Advance the next rowCount rows in the result. Returns 0 if the cursor is at the end of the result set. Note, when 0 is returned, it is likely there are rows returned in the rows array. An optional argument contains a %Library.Status value on return. This %Status value indicates success or failure of the %GetRows() call. %SQLCODE is also set by %GetRows. The rows are returned in an array of $List values in the Row array argument. If %SQLCODE'=0 for a row, that will be the end of the results.

For example, suppose rset.%GetRows(10,.tenrows,.sc) is called:
- If there are more then 10 rows remaining to be fetched from the result set, tenrows=10, tenrows(1)=$lb(first row's contents), ..., tenrows(10)=$lb(tenth row's contents), and %GetRows() will return 1.
- If there are 5 rows remaining to be fetched from the result set, tenrows=5, tenrows(1)=$lb(first row's contents), ..., tenrows(5)=$lb(fifth row's contents), and %GetRows() will return 0.
- If there are 0 rows remaining to be fetched from the result set, tenrows=0 and %GetRows() will return 0.

This implementation is overridden by classes that implement the result set interface. Signature/behavior here to match that of %SQL.StatementResult:%GetRows()

method GetString(columnIndex As %Integer) as %String
method IsBeforeFirst() as %Boolean
Getter method for the %isBeforeFirst property on this class, which tracks whether the IRIS-side result set is before the first row and may not match up with whether the Java-side result set is before the first row.
Inherited description: Advance to the next row in the result referenced by %ProcCursor. Returns 0 if the cursor is at the end of the result set. An optional argument contains a %Library.Status value on return. This %Status value indicates success or failure of the %Next call. %SQLCODE is also set by %Next. This implementation is overridden by classes that implement the result set interface.
method SetFetchSize(rowCount As %Integer)
Gives the driver a hint as to the number of rows that should be fetched from the database when more rows are needed for this ResultSet object.
method WasNull() as %Boolean
Reports whether the last column read had a value of SQL NULL.
classmethod getrsmd(externalMetadata As %List) as %SQL.StatementMetadata

Inherited Members

Inherited Properties

Inherited Methods

FeedbackOpens in a new tab