Skip to main content

%TSQL.Impl

class %TSQL.Impl extends %Library.RegisteredObject

Implementation of TSQL scalar and other functions not supported by SQL

Method Inventory

Methods

classmethod CHARINDEX(ToFind As %String, FindIn As %String, StartAt As %Integer = 1) as %String [ SQLProc = CHARINDEX ]
Projected as the stored procedure: CHARINDEX

Implement CHARINDEX(tofind,findin[,startat])

classmethod DATALENGTH(Item) as %Integer [ SQLProc = DATALENGTH ]
Projected as the stored procedure: DATALENGTH

Implement DATALENGTH(item)

classmethod FLOOR(Number As %String) as %Numeric

Implement FLOOR for COS context

classmethod Find(LookIn As %String, LookFor As %String, StartLook As %Integer = 1)

Look for LookIn in LookFor starting at StartLook (defaults to 1)

If the string isn't found then 0 is returned

If the string is found then the 1-based offset to the start of LookFor in LookIn is returned

classmethod IFNULL(Expr1 As %String, Expr2 As %String, Expr3 As %String = "") as %String [ SQLProc = IFNULL ]
Projected as the stored procedure: IFNULL

Implement IFNULL(expr1,expr2[,expr3])

classmethod IsStream(Value As %String, ByRef StreamOref) as %Boolean

Is the given value a stream id?

- if so: return 1 and set StreamOref

- otherwise: return 0 and set StreamOref to $$$NULLOREF

classmethod LEN(Str As %String) as %Integer

Implement LEN for COS context

classmethod REPLACE(Expr As %String, Old As %String, New As %String) as %String [ SQLProc = REPLACE ]
Projected as the stored procedure: REPLACE

Implement REPLACE(expr,old,new)

classmethod ROUND(Number As %Numeric, Length As %Integer, Function As %Integer) as %String [ SQLProc = ROUND ]
Projected as the stored procedure: ROUND

Implement ROUND(number,length,function)

classmethod STUFF(SourceString As %String, StartPos As %Integer, ReplaceLength As %Integer, ReplaceString As %String) as %String [ SQLProc = STUFF ]
Projected as the stored procedure: STUFF

Implement STUFF(sourcestring,startpos,replacelength,replacestring)

classmethod SUBSTRING(Item, Start, Length) as %String [ SQLProc = SUBSTRING ]
Projected as the stored procedure: SUBSTRING

Implement SUBSTRING(item, start, length)

classmethod ZBITWISEAND(A, B) as %Integer [ SQLProc = ZBITWISEAND ]
Projected as the stored procedure: ZBITWISEAND

Implement bitwiseAND

classmethod ZBITWISEOR(A, B) as %Integer [ SQLProc = ZBITWISEOR ]
Projected as the stored procedure: ZBITWISEOR

Implement bitwiseOR

classmethod ZBITWISEXOR(A, B) as %Integer [ SQLProc = ZBITWISEXOR ]
Projected as the stored procedure: ZBITWISEXOR

Implement bitwiseXOR

classmethod ZCONVERRFROMTSQL(A) as %Integer [ SQLProc = ZCONVERRFROMTSQL ]
Projected as the stored procedure: ZCONVERRFROMTSQL

Translate a TSQL error code to a SQLCODE

classmethod ZFORMATMESSAGE(Message, Args...) [ SQLProc = ZFORMATMESSAGE ]
Projected as the stored procedure: ZFORMATMESSAGE

Format a RAISERROR message with the given arguments

classmethod ZLIKETOCOSPATTERN(LikePattern As %String, LikeEscape As %String = "") as %String

Given a LIKE pattern and optional LIKE ESCAPE, return the corresponding COS pattern (non-SQL strings)

classmethod ZLIKETOCOSPATTERNS(LikePattern As %String, LikeEscape As %String = "") as %String [ SQLProc = ZLIKETOCOSPATTERNS ]
Projected as the stored procedure: ZLIKETOCOSPATTERNS

Given a LIKE pattern and optional LIKE ESCAPE, return the corresponding COS pattern (SQL strings)

classmethod ZPATINDEXFB(CosPattern As %String, Expr As %String) as %Integer [ SQLProc = ZPATINDEXFB ]
Projected as the stored procedure: ZPATINDEXFB

PATINDEX for anything that isn't covered above (FB=fallback) - returns 0/1

- will not give the correct result for a pattern beginning with "%"

classmethod ZPATINDEXL(LiteralPart As %String, Expr As %String) as %Integer [ SQLProc = ZPATINDEXL ]
Projected as the stored procedure: ZPATINDEXL

PATINDEX for: literal - returns 0/1

classmethod ZPATINDEXLR(LiteralPart As %String, CosPattern As %String, Expr As %String) as %Integer [ SQLProc = ZPATINDEXLR ]
Projected as the stored procedure: ZPATINDEXLR

PATINDEX for: literal rest - returns 0/1

classmethod ZPATINDEXPL(LiteralPart As %String, Expr As %String) as %Integer [ SQLProc = ZPATINDEXPL ]
Projected as the stored procedure: ZPATINDEXPL

PATINDEX for: percent literal - returns 0/position of literal

classmethod ZPATINDEXPLR(LiteralPart As %String, CosPattern As %String, Expr As %String) as %Integer [ SQLProc = ZPATINDEXPLR ]
Projected as the stored procedure: ZPATINDEXPLR

PATINDEX for: percent literal rest - 0/returns position of literal

classmethod ZPATINDEXPN(CosPattern As %String, Expr As %String) as %Integer [ SQLProc = ZPATINDEXPN ]
Projected as the stored procedure: ZPATINDEXPN

PATINDEX for: percent non-literal - returns 0/position of non-literal

classmethod ZPATINDEXU(UnderlineCount As %Integer, Expr As %String) as %Integer [ SQLProc = ZPATINDEXU ]
Projected as the stored procedure: ZPATINDEXU

PATINDEX for: underline(s) - returns 0/1

classmethod ZPATINDEXUL(UnderlineCount As %Integer, LiteralPart As %String, Expr As %String) as %Integer [ SQLProc = ZPATINDEXUL ]
Projected as the stored procedure: ZPATINDEXUL

PATINDEX for: underline(s) literal - returns 0/1

classmethod ZPATINDEXULR(UnderlineCount As %Integer, LiteralPart As %String, CosPattern As %String, Expr As %String) as %Integer [ SQLProc = ZPATINDEXULR ]
Projected as the stored procedure: ZPATINDEXULR

PATINDEX for: underline(s) literal rest - returns 0/1

classmethod ZPATTERNMATCH(Expr As %String, CosPattern As %String) as %Integer [ SQLProc = ZPATTERNMATCH ]
Projected as the stored procedure: ZPATTERNMATCH
classmethod ZRAND(ScaleFactor As %Integer) as %Float [ SQLProc = ZRAND ]
Projected as the stored procedure: ZRAND

Implement ZRAND(scalefactor)

classmethod ZREMAMPM(Item) as %String [ SQLProc = ZREMAMPM ]
Projected as the stored procedure: ZREMAMPM

Implement ZREMAMPM(item) to remove the "AM" or "PM" if necessary

classmethod ZRPATINDEX(TsqlPattern As %String, Expr As %String) as %Integer [ SQLProc = ZRPATINDEX ]
Projected as the stored procedure: ZRPATINDEX

PATINDEX for non-literal patterns

classmethod ZRPATINDEXPLP(TsqlInnerPattern As %String, Expr As %String) as %Integer [ SQLProc = ZRPATINDEXPLP ]
Projected as the stored procedure: ZRPATINDEXPLP

PATINDEX for "%"+XXX+"%" patterns

classmethod ZWITHDATETIME(Item As %String) as %String [ SQLProc = ZWITHDATETIME ]
Projected as the stored procedure: ZWITHDATETIME

Implement ZWITHDATETIME(item) to append a date of 1/1/1900 and/or a time of midnight to the item if necessary

Inherited Members

Inherited Methods

FeedbackOpens in a new tab