SqlMacroProcessor

Overview

The SqlMacroProcessor provides the base for classes that can process macros in SQL queries for different databases. It is part of the Macro Processor conception.

This class allows to use the following macros in SQL queries:

Date LowerCase
DateTime UpperCase
AddTime TrimLeft
FormatDateTime TrimRight
FormatDate Copy
Length NoLock

Location


 

constructor  protected

 

constructor(dateFormat: String; datetimeFormat: String; doubleQuoteStrings: Boolean; expressionGenerator: ISqlExpressionGenerator)

 

SqlMacroProcessor(String dateFormat, String datetimeFormat, Boolean doubleQuoteStrings, ISqlExpressionGenerator expressionGenerator)

 

Sub New(dateFormat As String, datetimeFormat As String, doubleQuoteStrings As Boolean, expressionGenerator As ISqlExpressionGenerator)

Parameters:

  • dateFormat:
  • datetimeFormat:
  • doubleQuoteStrings:
  • expressionGenerator:

AddVariable

 

method AddVariable(name: String): SqlMacroVariable

 

SqlMacroVariable AddVariable(String name)

 

Function AddVariable(name As String) As SqlMacroVariable

Parameters:

  • name:

ClearMacros

 

method ClearMacros

 

void ClearMacros()

 

Sub ClearMacros()

ClearVariables

 

method ClearVariables

 

void ClearVariables()

 

Sub ClearVariables()

CustomMacroHandler

 

property CustomMacroHandler: SqlMacroCallback read write;

 

SqlMacroCallback CustomMacroHandler { get; set; }

 

Property CustomMacroHandler() As SqlMacroCallback

DateFormat  protected

Gets the date format for the current database.

 

property DateFormat: String read;

 

String DateFormat { get; }

 

ReadOnly Property DateFormat() As String

DateTimeFormat  protected

Gets the datetime format for the current database.

 

property DateTimeFormat: String read;

 

String DateTimeFormat { get; }

 

ReadOnly Property DateTimeFormat() As String

DoubleQuoteStrings  protected

Gets the quote string for the date and datetime formats for the current database. If this property is true, the datetime format is represented as "datetime", otherwise as 'datetime'.

 

property DoubleQuoteStrings: Boolean read;

 

Boolean DoubleQuoteStrings { get; }

 

ReadOnly Property DoubleQuoteStrings() As Boolean

EvalToken

 

method EvalToken(source: String): String

 

String EvalToken(String source)

 

Function EvalToken(source As String) As String

Parameters:

  • source:

Evaluate

 

method Evaluate(source: String; delimiter: Char): String

 

String Evaluate(String source, Char delimiter)

 

Function Evaluate(source As String, delimiter As Char) As String

Parameters:

  • source:
  • delimiter:

FindVariable

 

method FindVariable(name: String): SqlMacroVariable

 

SqlMacroVariable FindVariable(String name)

 

Function FindVariable(name As String) As SqlMacroVariable

Parameters:

  • name:

GetNewInstance

 

method GetNewInstance: ISqlMacroProcessor

 

ISqlMacroProcessor GetNewInstance()

 

Function GetNewInstance() As ISqlMacroProcessor

RegisterMacro

 

method RegisterMacro(macro: SqlMacroProcedure)

 

void RegisterMacro(SqlMacroProcedure macro)

 

Sub RegisterMacro(macro As SqlMacroProcedure)

Parameters:

  • macro:

RegisterMacros  protected

Registers the existing standard macros:

  • Date
  • DateTime
  • AddTime
  • FormatDateTime
  • FormatDate
  • Length
  • LowerCase
  • UpperCase
  • TrimLeft
  • TrimRight
  • Copy
  • NoLock

 

method RegisterMacros

 

void RegisterMacros()

 

Sub RegisterMacros()

Session  protected

 

method Session(sessionValueName: String): String

 

String Session(String sessionValueName)

 

Function Session(sessionValueName As String) As String

Parameters:

  • sessionValueName:

SqlExpressionGenerator

 

property SqlExpressionGenerator: ISqlExpressionGenerator read;

 

ISqlExpressionGenerator SqlExpressionGenerator { get; }

 

ReadOnly Property SqlExpressionGenerator() As ISqlExpressionGenerator

TrimParametersProvider  protected

 

method TrimParametersProvider(args: IList<String>): IList<String>

 

IList<String> TrimParametersProvider(IList<String> args)

 

Function TrimParametersProvider(args As IList<String>) As IList<String>

Parameters:

  • args:

 

CustomMacroHandler

 

property CustomMacroHandler: SqlMacroCallback read write;

 

SqlMacroCallback CustomMacroHandler { get; set; }

 

Property CustomMacroHandler() As SqlMacroCallback

DateFormat  protected

Gets the date format for the current database.

 

property DateFormat: String read;

 

String DateFormat { get; }

 

ReadOnly Property DateFormat() As String

DateTimeFormat  protected

Gets the datetime format for the current database.

 

property DateTimeFormat: String read;

 

String DateTimeFormat { get; }

 

ReadOnly Property DateTimeFormat() As String

DoubleQuoteStrings  protected

Gets the quote string for the date and datetime formats for the current database. If this property is true, the datetime format is represented as "datetime", otherwise as 'datetime'.

 

property DoubleQuoteStrings: Boolean read;

 

Boolean DoubleQuoteStrings { get; }

 

ReadOnly Property DoubleQuoteStrings() As Boolean

SqlExpressionGenerator

 

property SqlExpressionGenerator: ISqlExpressionGenerator read;

 

ISqlExpressionGenerator SqlExpressionGenerator { get; }

 

ReadOnly Property SqlExpressionGenerator() As ISqlExpressionGenerator

 

constructor  protected

 

constructor(dateFormat: String; datetimeFormat: String; doubleQuoteStrings: Boolean; expressionGenerator: ISqlExpressionGenerator)

 

SqlMacroProcessor(String dateFormat, String datetimeFormat, Boolean doubleQuoteStrings, ISqlExpressionGenerator expressionGenerator)

 

Sub New(dateFormat As String, datetimeFormat As String, doubleQuoteStrings As Boolean, expressionGenerator As ISqlExpressionGenerator)

Parameters:

  • dateFormat:
  • datetimeFormat:
  • doubleQuoteStrings:
  • expressionGenerator:

AddVariable

 

method AddVariable(name: String): SqlMacroVariable

 

SqlMacroVariable AddVariable(String name)

 

Function AddVariable(name As String) As SqlMacroVariable

Parameters:

  • name:

ClearMacros

 

method ClearMacros

 

void ClearMacros()

 

Sub ClearMacros()

ClearVariables

 

method ClearVariables

 

void ClearVariables()

 

Sub ClearVariables()

EvalToken

 

method EvalToken(source: String): String

 

String EvalToken(String source)

 

Function EvalToken(source As String) As String

Parameters:

  • source:

Evaluate

 

method Evaluate(source: String; delimiter: Char): String

 

String Evaluate(String source, Char delimiter)

 

Function Evaluate(source As String, delimiter As Char) As String

Parameters:

  • source:
  • delimiter:

FindVariable

 

method FindVariable(name: String): SqlMacroVariable

 

SqlMacroVariable FindVariable(String name)

 

Function FindVariable(name As String) As SqlMacroVariable

Parameters:

  • name:

GetNewInstance

 

method GetNewInstance: ISqlMacroProcessor

 

ISqlMacroProcessor GetNewInstance()

 

Function GetNewInstance() As ISqlMacroProcessor

RegisterMacro

 

method RegisterMacro(macro: SqlMacroProcedure)

 

void RegisterMacro(SqlMacroProcedure macro)

 

Sub RegisterMacro(macro As SqlMacroProcedure)

Parameters:

  • macro:

RegisterMacros  protected

Registers the existing standard macros:

  • Date
  • DateTime
  • AddTime
  • FormatDateTime
  • FormatDate
  • Length
  • LowerCase
  • UpperCase
  • TrimLeft
  • TrimRight
  • Copy
  • NoLock

 

method RegisterMacros

 

void RegisterMacros()

 

Sub RegisterMacros()

Session  protected

 

method Session(sessionValueName: String): String

 

String Session(String sessionValueName)

 

Function Session(sessionValueName As String) As String

Parameters:

  • sessionValueName:

TrimParametersProvider  protected

 

method TrimParametersProvider(args: IList<String>): IList<String>

 

IList<String> TrimParametersProvider(IList<String> args)

 

Function TrimParametersProvider(args As IList<String>) As IList<String>

Parameters:

  • args: