Skip to main content

%ISQL.Transformer

Transform ISQL source code to COS

Property Inventory

Method Inventory

Properties

property BinDir as %String;

The directory for IRISISQL.DLL.

Defaults to the Bin directory for the instance - change it if you want to debug a different version of the DLL.

Property methods: BinDirDisplayToLogical(), BinDirGet(), BinDirIsValid(), BinDirLogicalToDisplay(), BinDirLogicalToOdbc(), BinDirNormalize(), BinDirSet()
property DLLCallMode as %Integer [ InitialExpression = 3 ];

How we call the DLL

Takes one of the following values :-

1 - use $ZF(-3) ... handy for debugging the DLL because it doesn't stay loaded

2 - use $ZF(-4)/$ZF(-5) ... to cache the DLL handle

3 - use $ZF(-4)/$ZF(-6) ... the default - there's normally no reason to change it

Initialised to 3

Property methods: DLLCallModeDisplayToLogical(), DLLCallModeGet(), DLLCallModeIsValid(), DLLCallModeLogicalToDisplay(), DLLCallModeNormalize(), DLLCallModeSet()
property DLLHandle as %Integer [ InitialExpression = 0 ];

The cached DLLHandle (used only when DLLCallMode=2)

Property methods: DLLHandleDisplayToLogical(), DLLHandleGet(), DLLHandleIsValid(), DLLHandleLogicalToDisplay(), DLLHandleNormalize(), DLLHandleSet()
property DLLResultCode as %String;

Set to a result code string

Mainly of use to Intersystems support.

Property methods: DLLResultCodeDisplayToLogical(), DLLResultCodeGet(), DLLResultCodeIsValid(), DLLResultCodeLogicalToDisplay(), DLLResultCodeLogicalToOdbc(), DLLResultCodeNormalize(), DLLResultCodeSet()

Methods

method %OnClose() as %Status
Inherited description: This callback method is invoked by the %Close() method to provide notification that the current object is being closed.

The return value of this method is ignored.

classmethod CacheTypeToISQL(TypeName As %String) as %String
classmethod CompilerParameters(CacheArgs As %String) as %String

Convert a comma-delimited list of arg:cachetype to @arg:sqltype

classmethod ConvertCompilerParameter(Par As %String) as %String
classmethod ExecuteStringAsISQL(Code As %String, Settings As %String) as %Status [ SQLProc = Transformer_ExecuteStringAsISQL ]
Projected as the stored procedure: Transformer_ExecuteStringAsISQL
compile and execute a fragment of ISQL code uses existing %isqlspcontext if it is defined - otherwise purges temporary tables and such like and uses a locally created %isqlspcontext
classmethod GetCacheType(IsqlType As %String) as %String

Returns the ObjectScript type corresponding to the given ISQL type

Returned string has the format "error!" or "!result"

Empty result part (i.e. "!") means the type was not found

classmethod GetSynonym(Synonym As %String) as %String

Returns TableOrViewName, or "" if not found

classmethod GetSysType(TypeName As %String) as %String

Returns PhysType, or "" if not found

classmethod GetTableFieldType(SchemaAndTableName As %String, FieldName As %String) as %String

Called by the DLL during compilation

classmethod PathToDLL() as %String

Return the path to the DLL

classmethod SQLExpression(arg As %String) as %String [ SQLProc = Transformer_SQLExpression ]
Projected as the stored procedure: Transformer_SQLExpression
used by the ISQL compiler for generation of SQL expression code in COS context (never actually called)
method Transform(SourceStream As %Stream.Object, GenStream As %Stream.Object, ProcsStream As %Stream.Object, ErrorsStream As %Stream.Object, Settings As %String = "", ByRef ColoringErrors As %Boolean, SPInfo, FormalSpec) as %Boolean

Convert the given ISQL source code to COS.

* SourceStream is a stream containing the source code

* GenStream is a stream to which the generated code is written

* ProcsStream is a stream to which names of required procedures are written (one per line)

* ErrorsStream is a stream to which any error messages are written

* Settings is a string of settings separated by commas. Each

setting has the format key or key=value

The DELIMIDENT setting enables parsing of double-quoted literals as delimited names

- the default is to parse them as string literals

* ColoringErrors is returned as 1 if there were syntax errors in the source

* SPInfo identifies the stored procedure: $LB(class,method)

* FormalSpec is $LB("formal,formal,..",return)

See the help in the ISQL shell for details of supported settings.

The return code is 1 on success, 0 on failure. See the

DLLResultCode property for information about failure.

IRISISQL.DLL must be in the directory given by the

BinDir property. By default this points to the Bin

directory for the instance.


In the example below SourceIn, GenOut and ErrorsOut are all streams.

SourceIn supplies the source code, GenOut receives the generated code

and ErrorsOut receives any error messages.

  Set TT=##class(%ISQL.Transformer).%New()
  Set Ret=TT.Transform(.Source,.Gen,.Errors,"") // "" is a flags string reserved for future use
  If 'Ret ZT // this indicates a fatal error
  

Inherited Members

Inherited Methods

FeedbackOpens in a new tab