Class Reference
IRIS for UNIX 2019.2
InterSystems: The power behind what matters   
Documentation  Search
  [ENSLIB] >  [%Library] >  [ProcedureContext]
Private  Storage   

class %Library.ProcedureContext extends %Library.IProcedureContext

Stored procedure context


Parameters Properties Methods Queries Indices ForeignKeys Triggers
7 13


%CurrentResult %LTT %Message %OutputColumnCount
%OutputValues %ROWCOUNT %ROWID %ResultColumnCount
%SQLCODE %StatementType %StatementTypeName %routine
CurrentResult Error PTT TTNI
cursors static

%%OIDGet %AddToSaveSet %BindExport %BuildObjectGraph
%ClassIsLatestVersion %ClassName %Close %ConstructClone
%DispatchClassMethod %DispatchGetModified %DispatchGetProperty %DispatchMethod
%DispatchSetModified %DispatchSetMultidimProperty %DispatchSetProperty %Display
%DisplayFormatted %Extends %Get %GetData
%GetMetadata %GetParameter %IncrementCount %IsA
%IsModified %MoreResults %New %Next
%NextOutputValue %NextResult %NormalizeObject %ObjectModified
%OriginalNamespace %PackageName %Print %ProcCursorGet
%RemoveFromSaveSet %ResultColumnCountGet %SendDelimitedRows %SendODBC
%SendObjects %SerializeObject %SetModified %ValidateObject
AddContext AddPrivateTable AddResultSet CloseCurrentResult
CurrentResultGet CurrentResultSet DumpResults ErrorSet
NewResultSet NextResult Prepare RemovePrivateTable
ReplaceResultSet Reset ResolveTableName



• property %LTT as %RawString [ MultiDimensional ];
%LTT is an array of temporary table storage indexes subscripted by temp table name.
• property PTT as %RawString [ MultiDimensional ];
PTT is an array of private temporary table orefs subscripted by temp table name. Private Temporary Table to OREF index.
• property Results as %RawString [ Private,MultiDimensional ];
Results is a MD-style collection of result objects. This repository is private and not meant for direct access. It is exposed through the interface. A result can be added by calling AddResultSet or AddContext. The %CurrentResult property is set to the result currently available to the client. The next result becomes the current result by calling %NextResult().
• property TTNI as %RawString [ MultiDimensional ];
TTNI is an array of private temporary table names subscripted by UPPERCASE source language temporary tablename. This property is used to resolve a source language table reference to a private temporary table name. TTNI = temporary table name index
• property context as %RawString [ Private ];
• property cursors as %String(MAXLEN="") [ MultiDimensional ];
cursors is a multidimensional array of cursor objects, subscripted by cursor name (case sensitive) The value of the cursor is the cursor object reference (oref).
• property static as %Boolean [ InitialExpression = 0 ];


• method %NextResult() as %RegisteredObject
Called to return the next resultset object. This also removes the reference to the existing object so it can cleanup and close itself
• method AddContext(pContext As %Library.IProcedureContext, propagateerror As %Boolean = 1) as %Library.Status
AddContext() is for nesting procedure context objects. If one procedure invokes another procedure and the results of calling the nested procedure are to be returned to the caller of the outer procedure then simply invoke AddContext on the context object of the outer procedure, passing the context object of the inner procedure as an argument, pContext. If the propagateerror argument is true then any error encountered by the nested procedure will be reported as an error to the caller of the outer procedure.
• method AddPrivateTable(pTable As %XSQL.DS.TempTable)
AddPrivateTable() This method will register a temporary table object. Only registered table objects are usable by dSQL. The TTNI property is the to index and is not set up here since the actual table (referenced by pTable) has no clue as to the source language table name. That must be done by the source language.
• method AddResultSet(rs As %Library.IResultSet)
AddResultSet() - add a new result object to the context object. Results are accessible by callers of the procedure through the %NextResult/%CurrentResult interface.
• method CloseCurrentResult() as %Status
Close the current resultset object, used to allow the cleanup code to run and the cursor to close
• method DumpResults(pDelimiter As %String = " ")
DumpResults() This method writes all of the results to the current device. The pDelimiter parameter is passed to the result set's %Print() method.
• method NewResultSet(rs As %Library.IResultSet, error As %SYSTEM.Error)
Used internally only, do not call directly.
• method NextResult() as %RegisteredObject
Called to return the next resultset object. This also removes the reference to the existing object so it can cleanup and close itself
• method Prepare(sqlquery As %String(MAXLEN=""), args...) as %Library.IResultSet
Used internally only, do not call directly.
• method RemovePrivateTable(pTableName As %String(MAXLEN=""))
RemovePrivateTable() will remove the private table name from the current context object or the process context object. The storage offset information remains to that any existing result sets will still be valid. However, If another instance of a private table with the same name is created any result sets against the prior private table may become invalid.
• method ReplaceResultSet(pResultSet As %Library.IResultSet = "")
Used internally only, do not call directly.
• method Reset() as %Status
• method ResolveTableName(pTableName As %String(MAXLEN=""), ByRef pContext As %Library.ProcedureContext = "", pDDLFlag As %Integer = 0) as %String
ResolveTableName will locate a temporary table registered in either the current object (usually equates to %sqlcontext) or in the process context object (%processcontext). The temporary table name passed into this method is the host language name such as #my_temp in TSQL or a normal temporary table name in Informix. This name is the one bound to the actual name in the TTNI (temporary table name index) by the host language procedure. If the table name is not found in TTNI, either local(current object) or global (%processcontext) then the name submitted is returned an no context is returned in the byref pContext argument.

Copyright (c) 2019 by InterSystems Corporation. Cambridge, Massachusetts, U.S.A. All rights reserved. Confidential property of InterSystems Corporation.