This is documentation for Caché & Ensemble.

For information on converting to InterSystems IRIS, see the InterSystems IRIS Adoption Guide and the InterSystems IRIS In-Place Conversion Guide, both available on the WRC Distributions page (login required).

Home > Class Reference > ENSLIB namespace > EnsLib.SQL.Snapshot

EnsLib.SQL.Snapshot

persistent class EnsLib.SQL.Snapshot extends %Library.Persistent, %Library.IResultSet, %XML.Adaptor

SQL Table Name: EnsLib_SQL.Snapshot

This class is a specialized result set used with the EnsLib.SQL.OutboundAdapter Instances are returned as output from EnsLib.SQL.OutboundAdapter.ExecuteQuery(). The list of rows is a static snapshot as of the time when the query was executed

Property Inventory

Method Inventory

Properties

property %CurrentRow as %Integer [ InitialExpression = 0 , Transient ];
This is the index of the 'current' row in the Snapshot. Used by the Next(), Get(), GetData(), and Rewind() methods.
Property methods: %CurrentRowDisplayToLogical(), %CurrentRowGet(), %CurrentRowIsValid(), %CurrentRowLogicalToDisplay(), %CurrentRowNormalize(), %CurrentRowSet(), %CurrentRowXSDToLogical()
property %GblRef as %String (MAXLEN = 80) [ InitialExpression = $Name($$$EnsJobLocal($this)) ];
Location of the storage for the fields of this Snapshot.
Property methods: %GblRefDisplayToLogical(), %GblRefGet(), %GblRefGetStored(), %GblRefIsValid(), %GblRefLogicalToDisplay(), %GblRefLogicalToOdbc(), %GblRefNormalize(), %GblRefSet()
property %Message as %Library.String [ Transient ];
Property methods: %MessageDisplayToLogical(), %MessageGet(), %MessageIsValid(), %MessageLogicalToDisplay(), %MessageLogicalToOdbc(), %MessageNormalize(), %MessageSet()
property %PrivateTables as array of %XSQL.DS.TempTable [ Transient ];
Inherited description: %PrivateTables is an array of private temporary table orefs used by this result set subscripted by temp table name.
Property methods: %PrivateTablesBuildValueArray(), %PrivateTablesCollectionToDisplay(), %PrivateTablesCollectionToOdbc(), %PrivateTablesDisplayToCollection(), %PrivateTablesGet(), %PrivateTablesGetObject(), %PrivateTablesGetObjectId(), %PrivateTablesGetSwizzled(), %PrivateTablesIsValid(), %PrivateTablesOdbcToCollection(), %PrivateTablesSet(), %PrivateTablesSetObject(), %PrivateTablesSetObjectId()
property %ROWCOUNT as %Library.Integer [ Transient , ReadOnly ];
Property methods: %ROWCOUNTDisplayToLogical(), %ROWCOUNTGet(), %ROWCOUNTIsValid(), %ROWCOUNTLogicalToDisplay(), %ROWCOUNTNormalize(), %ROWCOUNTSet(), %ROWCOUNTXSDToLogical()
property %ROWID as %String) [ Transient ];
Property methods: %ROWIDDisplayToLogical(), %ROWIDGet(), %ROWIDIsValid(), %ROWIDLogicalToDisplay(), %ROWIDLogicalToOdbc(), %ROWIDNormalize(), %ROWIDSet()
property %ResultColumnCount as %Library.Integer [ Transient , ReadOnly ];
Inherited description: %ResultColumnCount is the number of columns in the result set. This value is always zero unless the current result is a RESULTSET object (instance of %SQL.IResultSet) or a procedure context object (instance of %Library.IProcedureContext). For a CALL statement result, this value represents the column count of the result set currently bound. For more information on result set sequences and dynamic result set binding refer to <>.
Property methods: %ResultColumnCountDisplayToLogical(), %ResultColumnCountGet(), %ResultColumnCountIsValid(), %ResultColumnCountLogicalToDisplay(), %ResultColumnCountNormalize(), %ResultColumnCountXSDToLogical()
property %SQLCODE as %Library.Integer [ Transient ];
Property methods: %SQLCODEDisplayToLogical(), %SQLCODEGet(), %SQLCODEIsValid(), %SQLCODELogicalToDisplay(), %SQLCODENormalize(), %SQLCODESet(), %SQLCODEXSDToLogical()
property AtEnd as %Boolean [ Calculated , Transient , ReadOnly ];
Are we at the last row?
Property methods: AtEndDisplayToLogical(), AtEndGet(), AtEndIsValid(), AtEndLogicalToDisplay(), AtEndLogicalToXSD(), AtEndNormalize(), AtEndXSDToLogical()
property ColCount as %Integer [ Calculated , Transient , ReadOnly ];
This holds the column count for this snapshot
Property methods: ColCountDisplayToLogical(), ColCountGet(), ColCountIsValid(), ColCountLogicalToDisplay(), ColCountNormalize(), ColCountXSDToLogical()
property FirstRow as %Integer [ InitialExpression = 1 ];
The index of the first row in this Snapshot. May be set on input when calling OutboundAdapter.ExecuteQuery() or ResultSet.GetSnapshot() to cause the first n-1 rows to be discarded before populating the Snapshot.
Property methods: FirstRowDisplayToLogical(), FirstRowGet(), FirstRowGetStored(), FirstRowIsValid(), FirstRowLogicalToDisplay(), FirstRowNormalize(), FirstRowSet(), FirstRowXSDToLogical()
property MaxRowsToGet as %Integer [ InitialExpression = 250 ];
The maximum number of rows to populate this Snapshot with. May be set on input to OutboundAdapter.ExecuteQuery() or ResultSet.GetSnapshot(). Set to -1 to get all rows no matter how many.
Property methods: MaxRowsToGetDisplayToLogical(), MaxRowsToGetGet(), MaxRowsToGetGetStored(), MaxRowsToGetIsValid(), MaxRowsToGetLogicalToDisplay(), MaxRowsToGetNormalize(), MaxRowsToGetSet(), MaxRowsToGetXSDToLogical()
property RowCount as %Integer [ Calculated , Transient , ReadOnly ];
This holds the row count
Property methods: RowCountDisplayToLogical(), RowCountGet(), RowCountIsValid(), RowCountLogicalToDisplay(), RowCountNormalize(), RowCountXSDToLogical()
property RuntimeMode as %String [ Transient ];
Property methods: RuntimeModeDisplayToLogical(), RuntimeModeGet(), RuntimeModeIsValid(), RuntimeModeLogicalToDisplay(), RuntimeModeLogicalToOdbc(), RuntimeModeNormalize(), RuntimeModeSet()

Methods

method %Get(pColName As %String, pRow As %Integer) as %String
alias for Get in new result set interface
method %GetData(pColumn As %Integer, pRow As %Integer) as %String
alias for GetData in new result set interface
method %Next(ByRef pSC As %Status) as %Integer
Inherited description: Advance the result set cursor to the next row. Returns 0 if the cursor is at the end of the result set.
classmethod %OnDelete(oid As %ObjectIdentity) as %Status
Inherited description: This callback method is invoked by the %Delete() method to provide notification that the object specified by oid is being deleted.

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

method %ROWCOUNTGet() as %Integer
method AddRow(pCol...) as %Status
method AtEndGet() as %Integer
method Clean() as %Status
method ColCountGet() as %Integer
classmethod CreateFromFile(pFilename As %String, pRowSeparator As %String, pColumnSeparator As %String, pColumnWidths As %String, pLineComment As %String, pStripPadChars As %String, pColNamesRow As %Integer, pFirstRow As %Integer, pMaxRowsToGet As %Integer, Output pStatus As %Status) as Snapshot
Creates a new Snapshot object and loads it with data from a table-formatted text file
classmethod CreateFromResultSet(pRS As %ResultSet, pLegacyMode As %Integer = 1, pODBCColumnType As %Boolean = 0, pFirstRow As %Integer, pMaxRowsToGet As %Integer, Output pStatus As %Status) as Snapshot
Creates a new Snapshot object and loads it with data from another resulset. See ImportFromResultSet() method.
classmethod CreateFromStream(pIOStream As %IO.I.CharacterStream, pRowSeparator As %String, pColumnSeparator As %String, pColumnWidths As %String, pLineComment As %String, pStripPadChars As %String, pColNamesRow As %Integer, pFirstRow As %Integer, pMaxRowsToGet As %Integer, Output pStatus As %Status) as Snapshot
Creates a new Snapshot object and loads it with data from a table-formatted character stream
classmethod FromResultset(pRS As %ResultSet) as %Status
Deprecated - use CreateFromResultSet() method
method GenerateIResultSetMetadata()
method Get(pColName As %String, pRow As %Integer = ..%CurrentRow) as %String
Returns the value of the column with the name 'pColName' in the current row of the result set Note: if the data exceeds the maximum string length then the return value will be the first 50 characters plus "..." and you should call GetStream() to get the full value.
method GetColumnCount() as %Integer
Returns the number of columns in the result set
method GetColumnExtInfo(n As %Integer) as %String
Returns the name of column n in the result set.
method GetColumnID(pColName As %String) as %Integer
method GetColumnIsBinary(pColumn As %Integer = 0) as %Boolean
Returns whether column 'pColumn' contains binary data.
method GetColumnIsLOB(pColumn As %Integer = 0) as %Boolean
Returns whether column 'pColumn' is a LOB (Stream) column.
method GetColumnLabelName(pColumn As %Integer = 0)
Returns the LabelName of column 'pColumn' in the result set.
method GetColumnName(pColumn As %Integer = 0) as %String
Returns the name of column 'pColumn' in the result set.
method GetColumnOptions(pColumn As %Integer = 0)
Returns the Options of column 'pColumn' in the result set.
method GetColumnQualifier(pColumn As %Integer = 0)
Returns the Qualifier of column 'pColumn' in the result set.
method GetColumnSQLType(pColumn As %Integer = 0) as %Integer
Returns the SQLtype integer of column 'pColumn' in the result set.
method GetColumnScale(pColumn As %Integer = 0)
Returns the scale of column 'pColumn' in the result set.
method GetColumnSchemaName(pColumn As %Integer = 0)
Returns the Schema name of column 'pColumn' in the result set.
method GetColumnSize(pColumn As %Integer = 0)
Returns the size of column 'pColumn' in the result set.
method GetColumnTableName(pColumn As %Integer = 0)
Returns the Table of column 'pColumn' in the result set.
method GetColumnType(pColumn As %Integer = 0) as %String
Returns the type name of column 'pColumn' in the result set.
method GetColumnisNullable(pColumn As %Integer = 0)
Returns the isNullable of column 'pColumn' in the result set.
method GetData(pColumn As %Integer, pRow As %Integer = ..%CurrentRow) as %String
Returns the value of column pColumn in the current row of the result set. Note: if the data exceeds the maximum string length then the return value will be the first 50 characters plus "..." and you should call GetDataStream() to get the full value.

method GetDataByName(pColName As %String) as %String
Deprecated - use Get() method
method GetDataStream(pColumn As %Integer, ByRef pStream As %Stream.Object = $$$NULLOREF, pRow As %Integer = ..%CurrentRow) as %Stream.Object
Returns as a Stream the full value of column pColumn in the current row of the result set. If you pass a stream object in pStream, the data will be appended to that stream; otherwise the data will be returned in a new %Stream.GlobalCharacter stream object. Note that if this method creates a Stream object for you, the Stream data is already on disk and you are responsible for calling stream.%Delete(stream.%Oid()) to delete the persistent storage for the new stream object
method GetODBCInfo(ByRef colinfo As %List, ByRef parminfo As %List) as %Status
method GetRowList() as %String
method GetStream(pColName As %String, ByRef pStream As %Stream.Object = $$$NULLOREF, pRow As %Integer = ..%CurrentRow) as %Stream.Object
Returns as a Stream the full value of the column with the name 'pColName' in the current row of the result set. If you pass a stream object in pStream, the data will be appended to that stream; otherwise the data will be returned in a new %Stream.GlobalCharacter stream object. Note that if this method creates a Stream object for you, the Stream data is already on disk and you are responsible for calling stream.%Delete(stream.%Oid()) to delete the persistent storage for the new stream object
method HasDataStream(pColumn As %Integer, pRow As %Integer = ..%CurrentRow) as %Boolean
Returns true if the given field in the current row contains stream data. In this case the complete value for the field can only be retrieved using the GetStream() or GetDataStream() method. Otherwise the field contains simple string data that can be retrieved completely using the Get() or GetData() method.
method HasStream(pColName As %String, pRow As %Integer = ..%CurrentRow) as %Boolean
Returns true if the named column in the current row contains stream data. In this case the complete value for the field can only be retrieved using the GetStream() or GetDataStream() method. Otherwise the field contains simple string data that can be retrieved completely using the Get() or GetData() method.
method ImportFile(pFilename As %String, pRowSeparator As %String = $C(10), pColumnSeparator As %String = $C(9), pColumnWidths As %String = "", pLineComment As %String = "", pStripPadChars As %String = " "_$C(9), pColNamesRow As %Integer = 0) as %Status
method ImportFromResultSet(pRS As %ResultSet, pLegacyMode As %Integer = 1, pODBCColumnType As %Boolean = 0) as %Status
Import a result set into a Snapshot ResultSet classes supported: EnsLib.SQL.GatewayResultSet, %Library.ResultSet, %ResultSet.* (%Library.IResultSet) as well as the result sets in %SQL package such as %SQL.StatementResult and %SQL.ISelectResult (%SQL.IResult) If pLegacyMode is specified as 0 then attempt first to use %GetMetadata leading to different source of meta data for legacy ResultSet class Default is 1 which maintains previous behavior while still supporting %SQL.* and %ResultSet.* classes. If pODBCColumnType is set to 1 then ColumntType text is set to the ODBC type column type text and not the clientType.
method ImportFromStream(pIOStream As %IO.I.CharacterStream, pRowSeparator As %String = $C(10), pColumnSeparator As %String = $C(9), pColumnWidths As %String = "", pLineComment As %String = "", pStripPadChars As %String = " "_$C(9), pColNamesRow As %Integer = 0) as %Status
Imports data from a table-formatted text file - negative pRowSeparator means row length - zero or negative pColumnSeparator means positional columns; negative pColumnSeparator gives # char columns to skip - pColumnWidths means comma-separated list of char counts if positional, or integer column count if using column separator. - pLineComment means a string after which the rest of a row should be ignored - pStripPadChars means characters to strip from the beginning and end of a field - pColNamesRow means the index of a row that contains column names.
Advance the result set cursor to the next row. Returns 0 if the cursor is at the end of the result set.
method QueryIsValid() as %Integer
Returns true (1) if the ClassName and QueryName properties of this %ResultSet object refer to a valid class query. Otherwise it returns false (0).
method Rewind() as %Status
method RowCountGet() as %Integer
method SetColLabelName(pCollabel...) as %Status
method SetColNames(pColName...) as %Status
method SetColOptions(pColoptions...) as %Status
method SetColQualifier(pColqualifier...) as %Status
method SetColScales(pColScale...) as %Status
method SetColSchemaName(pColschema...) as %Status
method SetColSizes(pColSize...) as %Status
method SetColTableName(pColtable...) as %Status
method SetColTypes(pColType...) as %Status
method SetColisNullable(pColisNul...) as %Status
method XMLExportInternal() as %Status
Inherited description: XMLExportInternal is internal method used by XMLExport
method XMLImportInternal() as %Status
Inherited description: XMLImportInternal is internal method used by XMLImport

Triggers

trigger OnDelete (BEFORE event DELETE);

Inherited Members

Inherited Properties

Inherited Methods

Storage

Storage Model: CacheStorage (EnsLib.SQL.Snapshot)

^EnsLib.S.SnapshotD(ID)
=
%%CLASSNAME
%Dummy
%GblRef
FirstRow
MaxRowsToGet
FeedbackOpens in a new window