IRISLIB database
All Classes Namespaces Functions Variables Pages
IResultSet Class Reference
Inheritance diagram for IResultSet:
Collaboration diagram for IResultSet:

Public Member Functions

_.Library.Status CloseCursor ()
 This method is expected to be overridden by concrete subclasses.
 
_.Library.Status OnClose ()
 This callback method is invoked by the <METHOD>Close</METHOD> method to. 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...
 

Private Member Functions

_.Library.Status CreateSnapshot (_.Library.Integer storageOffset, _.Library.Integer lastRow, _.Library.Integer pRuntimeMode, _.ResultSet.Static pStatic)
 CreateSnapshot(storageOffset,lastRow) More...
 
 DispatchGetProperty (_.Library.String pProperty)
 Is used to get the value of an unknown property.
 
 DispatchMethod (_.Library.String pMethod, Args)
 Is used to implement an unknown method call. More...
 
_.Library.Status Display (_.Library.String pDelimiter)
 alias for Print, implement Display for new result set interface
 
 DisplayFormatted (_.Library.String pFormat, _.Library.String pFileName, _.SQL.Manager.Messages pMessages, _.Library.String pFilesUsed, _.Library.String pTranslateTable, _.Library.String pDelimiter)
 
_.Library.String Get (_.Library.String colname)
 Returns the value of the column with the name name in the current row of the result set. More...
 
_.Library.String GetData (_.Library.Integer colnbr)
 Returns the value of column colnbr in the current row of the result set.
 
_.Library.Integer Next (_.Library.Status sc)
 Advance the result set cursor to the next row. More...
 
_.Library.Status Print (_.Library.String pDelimiter)
 Print() More...
 
_.Library.Status SendDelimitedRows (_.Library.Integer pMaxRows, _.Library.String pDelimiter, _.Library.Integer pReturnCount)
 Fetch and send a series of rows for continuous query client. More...
 

Static Private Member Functions

_.Library.IResultSet Prepare (_.Library.String queryId, _, _.SYSTEM.Error returnError, _, _.Library.RawString importPackages, _, args)
 Prepare() More...
 
_.ResultSet.MetaData PrepareMetaData (_.Library.String queryId, _.SYSTEM.Error returnError, _.Library.RawString importPackages)
 <METHOD>PrepareMetaData</METHOD> is similar to <METHOD>Prepare</METHOD> except that no result set is instantiated. More...
 

Additional Inherited Members

- 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

Interface for result sets.

A result set is a type of result returned by executing either a SELECT statement or a CALL statement. Please refer to <class>SQL.Statement</class> and <class>SQL.StatementResult</class> for more information on how to prepare dynamic SQL statements and how to process the results the of executing them.

Member Function Documentation

◆ CreateSnapshot()

_.Library.Status CreateSnapshot ( _.Library.Integer  storageOffset,
_.Library.Integer  lastRow,
_.Library.Integer  pRuntimeMode,
_.ResultSet.Static  pStatic 
)
private

CreateSnapshot(storageOffset,lastRow)

Copy all rows from the current position to the end of the cursor into a temporary
global. Fetch <var>rowCount</var> rows into a temporary global. If the <var>rowCount</var> is -1 then all rows are fetched

◆ DispatchMethod()

DispatchMethod ( _.Library.String  Method,
  Args 
)
private

Is used to implement an unknown method call.

It is also used

to resolve an unknown multidimensional property reference (to get the value of a property) because that syntax is identical to a method call.

Reimplemented from SystemBase.

◆ DisplayFormatted()

DisplayFormatted ( _.Library.String  pFormat,
_.Library.String  pFileName,
_.SQL.Manager.Messages  pMessages,
_.Library.String  pFilesUsed,
_.Library.String  pTranslateTable,
_.Library.String  pDelimiter 
)
private

Display the contents of the result object. If formatted display is available then format the results

using the requested format and, if appropriate, open the formatted results using the host OS. The output is directed to one or more files and messages are placed in a result set object. All file names used are returned in an array.


Parameters


NameDescription
pFormat

The format applied to the result content. This parameter is also used to determine the file name extension.

Supported formats are:

-1Display() format
0XML
1HTML
2PDF (requires a renderer such as FOP)
99TXT
100CSV

If pFormat is specified as any number not listed above then it will default to TXT.

pFormat can also be specified as XML, HTML, PDF, TXT or CSV.

NOTE: pFormat of CSV/100 is not a true comma separated value, but instead uses TAB separated values.

pFileName

The base file name to be used to generate actual file names used for output. If no value is specified then a file name will be generated, using the TEMP folder defined for the InterSystems IRIS instance. This value is not expected to include an extension. An extension is added to this value to form the actual file used. Also, if nested results exist then a number is appended to the file name specified to produce a unique name for each result.

pMessages

Instance of a system result set class. If no value is passed then the system message result class is instantiated. This parameter is passed by reference. It is up to the caller to process the result set oref that is returned. pMessages.Count() returns the number of messages contained in the result set. pMessages.Display() will display the messages on the current device. pMessages.DisplayFormatted() is also implemented and can be used to display the messages using the selected format.

pFilesUsed

This pass-by-reference parameter will contain the number of files used to display the result content and the name of each file. pFilesUsed is the number of files and pFilesUsed(file_number) is the name of the file. The sequence of the files is the same sequence as the results are processed. For simple result objects, there is a single file. For context objects that can contain result set sequences, the results are output in the order they are returned and the files used are present in pFilesUsed in that same order.

pTranslateTable

This is the translate table used for the output files when the format is CSV or TXT. This parameter is optional.

pDelimiter

The delimiter to use between columns in the export file. This parameter is optional and defaults to tab character if not specified.


◆ Get()

_.Library.String Get ( _.Library.String  colname)
private

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.

Reimplemented in ResultSet, ResultSet, AbstractResultSet, AbstractResultSet, JGWResultSet, and GTWResultSet.

◆ Next()

_.Library.Integer Next ( _.Library.Status  sc)
private

Advance the result set cursor to the next row.

Returns 0 if the cursor is at the end of the

result set.

Reimplemented in ScrollableResultSet, ResultSet, ResultSet, JGWResultSet, GTWResultSet, AbstractResultSet, and AbstractResultSet.

◆ 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 RegisteredObject.

Reimplemented in Static, ScrollableResultSet, ResultSet, JGWResultSet, and GTWResultSet.

◆ Prepare()

_.Library.IResultSet Prepare ( _.Library.String  queryId,
  _,
_.SYSTEM.Error  returnError,
  _,
_.Library.RawString  importPackages,
  _,
  args 
)
staticprivate

Prepare()

This method is different for each type of result set class. This method has two tasks. First, instantiate the correct concrete result set class. Think of the first parameter, queryId, as being an "index key value" that is used to lookup the correct query implementation. For non-cached (static) queries this is simply the name of the class that implements the query, i.e. the IResultSet interface. The second task is to prepare the resulting object for data retrieval by the caller.

queryId

can be the concrete subclass of <CLASS>IResultSet</CLASS> that implements the desired query. For dynamic cached results this value is generally the query text that can be parsed, a hashed value computed and the cached result implementation class looked up in the query cache index.

queryId can also be a <className><colon><queryName> or <className><colon><methodName>. If it is a <queryName> then the result set returned is an instance of Library.ResultSet that is bound to that query. If it is the name of a method Then that method is called, passing args... to the method, and the first result set found in the context object (sqlcontext) is returned.

returnError

an error occurs this is returned by reference and is a <CLASS>SYSTEM.Error</CLASS> object with properties set to describe information about the error. returnError.Status contains the <CLASS>Status</CLASS> value.

importPackages This is a comma delimited list of packages to import. This is only relevant if the result set implementation is generated and the query source might include unqualified names. The import packages list is used to resolve package/schema names for unqualified names.

args...

values to be passed to the query/method/class <METHOD>Execute</METHOD>() method. Zero, one or more argument values can be passed.

◆ PrepareMetaData()

_.ResultSet.MetaData PrepareMetaData ( _.Library.String  queryId,
_.SYSTEM.Error  returnError,
_.Library.RawString  importPackages 
)
staticprivate

<METHOD>PrepareMetaData</METHOD> is similar to <METHOD>Prepare</METHOD> except that no result set is instantiated.

This

method returns an instance of <CLASS>ResultSet.MetaData</CLASS>. Be aware that the implementation of this method might cause the result set to be instantiated but that is up to the result set class itself and no result set is actually returned by this method - only metadata.

queryId

can be the concrete subclass of <CLASS>IResultSet</CLASS> that implements the desired query. For dynamic cached results this value is generally the query text that can be parsed, a hashed value computed and the cached result implementation class looked up in the query cache index.

queryId can also be a <className><colon><queryName> or <className><colon><methodName>. If it is a <queryName> then the metadata is retrieved from the compiled query. If it is the name of a method then no metadata can be prepared since it requires the method to be executed.

returnError

an error occurs this is returned by reference and is a <CLASS>SYSTEM.Error</CLASS> object with properties set to describe information about the error. returnError.Status contains the <CLASS>Status</CLASS> value.

importPackages This is a comma delimited list of packages to import. This is only relevant if the result set implementation is generated and the query source might include unqualified names. The import packages list is used to resolve package/schema names for unqualified names.

Reimplemented in ResultSet.

◆ Print()

_.Library.Status Print ( _.Library.String  pDelimiter)
private

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

◆ SendDelimitedRows()

_.Library.Status SendDelimitedRows ( _.Library.Integer  pMaxRows,
_.Library.String  pDelimiter,
_.Library.Integer  pReturnCount 
)
private

Fetch and send a series of rows for continuous query client.

For internal use only.

Reimplemented in ResultSet.