Home > Class Reference > ENSLIB namespace > %XSQL.StatementBatch
Private  Storage   


A statement batch is a stream of TSQL source statements. A %XSQL.StatementBatch instance can be executed dynamically and the results displayed on the current device and optionally written to a log device. Statement Batches are typically retrieved from an external file that may contain one or more batches, each terminated by a 'go' statement or by the end of file. This class does not manage multiple batches. That is the responsiblity of the caller. The inputStream property is expected to be a %Stream.Object that contains TSQL source that is executed as a single procedure.


Parameters Properties Methods Queries Indices ForeignKeys Triggers
10 7


dialect errorCount errorPause errors executeCount
inputStream lineCount log runtimeMode settings

%AddToSaveSet %ClassIsLatestVersion %ClassName %ConstructClone
%DispatchClassMethod %DispatchGetModified %DispatchGetProperty %DispatchMethod
%DispatchSetModified %DispatchSetMultidimProperty %DispatchSetProperty %Extends
%GetParameter %IsA %IsModified %New
%NormalizeObject %ObjectModified %OriginalNamespace %PackageName
%RemoveFromSaveSet %SerializeObject %SetModified %ValidateObject
createProc createTrigger execute reportError
reportSQLCode reportStatus reportZError


• property dialect as %String(VALUELIST=",MSSQL,Sybase");
dialect identifies which TSQL implementation to emulate. Most behavior is consistent but there are minor differences.
• property errorCount as %Integer;
The number of errors encountered during execution.
• property errorPause as %Integer;
errorPause is the number of seconds to pause when an error is encountered. Not all errors will pause.
• property errors as %Stream.GlobalCharacter;
A stream containing all errors encountered during execution.
• property executeCount as %Integer;
executeCount is the number of statement groups that were executed while processing the current statementBatch instance.
• property inputStream as %Stream.Object;
TSQL source input stream.
• property lineCount as %Integer;
lineCount is the number of lines read from the inputStream
• property log as %TSQL.sys.log;
The reference to the %TSQL.sys.log object. The log object has a file property and all log output is directed to that file.
• property runtimeMode as %String(DISPLAYLIST="<DEFAULT>,LOGICAL,ODBC,DISPLAY",VALUELIST=",0,1,2");
Use this property to set the SQL runtime mode for any SQL statements executed. Setting the runtime mode for this StatementBatch does not permanently change the $zu(115,5) value. Possible values are:
  • 0 for LOGICAL mode.
  • 1 for ODBC mode.
  • 2 for DISPLAY mode.
  • "" to use the process wide $zu(115,5) value.
• property settings as %CacheString [ MultiDimensional ];
settings is the array of runtime options that can be specified by the caller or by configuration.


• method createProc(sourceStream As %Stream.Object, compileErrorLog, stats=1) as %Status
CREATE PROCEDURE batch processing. This method creates a class method in a class that projects an SQL procedure. The implementation is the body of the CREATE PROC statement batch.
• method createTrigger(sourceStream As %Stream.Object, destination As %String(MAXLEN=250)) as %Status
CREATE TRIGGER batch processing. This method creates a trigger in a class that corresponds to the specified table. The implementation is the body of the CREATE TRIGGER statement batch.
• method execute(ByRef qstruct As %CacheString) as %Status
execute() Internal use only. This method prepares and executes a batch of dynamic TSQL statements contained in a stream.
• method reportError(error As %SYSTEM.Error)
• method reportSQLCode(sqlcode As %Integer, ByRef message As %CacheString)
• method reportStatus(status As %Status)
• method reportZError(zerror As %String)