%XSQL.StatementBatch

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.

Property Inventory

Method Inventory

Properties

property dialect as %String (VALUELIST = ",MSSQL,Sybase");
dialect identifies which TSQL implementation to emulate. Most behavior is consistent but there are minor differences.
Property methods: dialectDisplayToLogical(), dialectGet(), dialectIsValid(), dialectLogicalToDisplay(), dialectLogicalToOdbc(), dialectNormalize(), dialectSet()
property errorCount as %Integer;
The number of errors encountered during execution.
Property methods: errorCountDisplayToLogical(), errorCountGet(), errorCountIsValid(), errorCountLogicalToDisplay(), errorCountNormalize(), errorCountSet()
property errorPause as %Integer;
errorPause is the number of seconds to pause when an error is encountered. Not all errors will pause.
Property methods: errorPauseDisplayToLogical(), errorPauseGet(), errorPauseIsValid(), errorPauseLogicalToDisplay(), errorPauseNormalize(), errorPauseSet()
property errors as %Stream.GlobalCharacter;
A stream containing all errors encountered during execution.
Property methods: errorsDelete(), errorsGet(), errorsGetObject(), errorsGetObjectId(), errorsGetSwizzled(), errorsIsValid(), errorsNewObject(), errorsOid(), errorsOpen(), errorsSet(), errorsSetObject(), errorsSetObjectId(), errorsUnSwizzle()
property executeCount as %Integer;
executeCount is the number of statement groups that were executed while processing the current statementBatch instance.
Property methods: executeCountDisplayToLogical(), executeCountGet(), executeCountIsValid(), executeCountLogicalToDisplay(), executeCountNormalize(), executeCountSet()
property inputStream as %Stream.Object;
TSQL source input stream.
Property methods: inputStreamDelete(), inputStreamGet(), inputStreamGetObject(), inputStreamGetObjectId(), inputStreamGetSwizzled(), inputStreamIsValid(), inputStreamNewObject(), inputStreamOid(), inputStreamOpen(), inputStreamSet(), inputStreamSetObject(), inputStreamSetObjectId(), inputStreamUnSwizzle()
property lineCount as %Integer;
lineCount is the number of lines read from the inputStream
Property methods: lineCountDisplayToLogical(), lineCountGet(), lineCountIsValid(), lineCountLogicalToDisplay(), lineCountNormalize(), lineCountSet()
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 methods: logGet(), logGetSwizzled(), logIsValid(), logNewObject(), logSet()
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 methods: runtimeModeDisplayToLogical(), runtimeModeGet(), runtimeModeIsValid(), runtimeModeLogicalToDisplay(), runtimeModeLogicalToOdbc(), runtimeModeNormalize(), runtimeModeSet()
property settings as %CacheString [ MultiDimensional ];
settings is the array of runtime options that can be specified by the caller or by configuration.
Property methods: settingsGet(), settingsIsValid(), settingsSet()

Methods

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)

Inherited Members

Inherited Methods