MySQLMacroProcessor

Overview

The MySQLMacroProcessor class provides MySQL SQL specific definitions for SQL functions defined in the SqlMacroProcessor class.

The MySQLMacroProcessor class is used to process macros in Schema statements that have their ConnectionType set to MySql. Consider the following statement:

SELECT
  *
FROM
  Orders 
WHERE
  order_date = {Date()}

will be converted to

SELECT
  *
FROM
  Orders 
WHERE
  order_date = CURDATE()

Note how the {DATE()} macros was converted into MySQL specific SQL construction.

Note: You can find more about macro processors and macro functions in this article.

Location


 

constructor

Creates a new instance of the MySQLMacroProcessor class.

 

constructor

 

MySQLMacroProcessor()

 

init()

 

Sub New()

constructor (String, String, Boolean, ISqlExpressionGenerator)  protected    (declared in SqlMacroProcessor)

 

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

 

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

 

init(_ dateFormat: String, _ datetimeFormat: String, _ doubleQuoteStrings: Boolean, _ expressionGenerator: ISqlExpressionGenerator)

 

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

Parameters:

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

AddVariable    (declared in SqlMacroProcessor)

 

method AddVariable(name: String): SqlMacroVariable

 

SqlMacroVariable AddVariable(String name)

 

func AddVariable(_ name: String) -> SqlMacroVariable

 

Function AddVariable(name As String) As SqlMacroVariable

Parameters:

  • name:

ClearMacros    (declared in SqlMacroProcessor)

 

method ClearMacros

 

void ClearMacros()

 

func ClearMacros()

 

Sub ClearMacros()

ClearVariables    (declared in SqlMacroProcessor)

 

method ClearVariables

 

void ClearVariables()

 

func ClearVariables()

 

Sub ClearVariables()

CustomMacroHandler    (declared in SqlMacroProcessor)

 

property CustomMacroHandler: SqlMacroCallback read write;

 

SqlMacroCallback CustomMacroHandler { get; set; }

 

var CustomMacroHandler: SqlMacroCallback { get{} set{} }

 

Property CustomMacroHandler() As SqlMacroCallback

DateFormat  protected    (declared in SqlMacroProcessor)

Gets the date format for the current database.

 

property DateFormat: String read;

 

String DateFormat { get; }

 

var DateFormat: String { get{} }

 

ReadOnly Property DateFormat() As String

DateTimeFormat  protected    (declared in SqlMacroProcessor)

Gets the datetime format for the current database.

 

property DateTimeFormat: String read;

 

String DateTimeFormat { get; }

 

var DateTimeFormat: String { get{} }

 

ReadOnly Property DateTimeFormat() As String

DoubleQuoteStrings  protected    (declared in SqlMacroProcessor)

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; }

 

var DoubleQuoteStrings: Boolean { get{} }

 

ReadOnly Property DoubleQuoteStrings() As Boolean

EvalToken    (declared in SqlMacroProcessor)

 

method EvalToken(source: String): String

 

String EvalToken(String source)

 

func EvalToken(_ source: String) -> String

 

Function EvalToken(source As String) As String

Parameters:

  • source:

Evaluate    (declared in SqlMacroProcessor)

 

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

 

String Evaluate(String source, Char delimiter = ')

 

func Evaluate(_ source: String, _ delimiter: Char = ') -> String

 

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

Parameters:

  • source:
  • delimiter:

FindVariable    (declared in SqlMacroProcessor)

 

method FindVariable(name: String): SqlMacroVariable

 

SqlMacroVariable FindVariable(String name)

 

func FindVariable(_ name: String) -> SqlMacroVariable

 

Function FindVariable(name As String) As SqlMacroVariable

Parameters:

  • name:

GetNewInstance

Creates a new instance of the MySQLMacroProcessor class.

 

method GetNewInstance: ISqlMacroProcessor

 

ISqlMacroProcessor GetNewInstance()

 

func GetNewInstance() -> ISqlMacroProcessor

 

Function GetNewInstance() As ISqlMacroProcessor

RegisterMacro    (declared in SqlMacroProcessor)

 

method RegisterMacro(macro: SqlMacroProcedure)

 

void RegisterMacro(SqlMacroProcedure macro)

 

func RegisterMacro(_ macro: SqlMacroProcedure)

 

Sub RegisterMacro(macro As SqlMacroProcedure)

Parameters:

  • macro:

RegisterMacros  protected    (declared in SqlMacroProcessor)

Registers the existing standard macros:

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

 

method RegisterMacros

 

void RegisterMacros()

 

func RegisterMacros()

 

Sub RegisterMacros()

Session  protected    (declared in SqlMacroProcessor)

 

method Session(sessionValueName: String): String

 

String Session(String sessionValueName)

 

func Session(_ sessionValueName: String) -> String

 

Function Session(sessionValueName As String) As String

Parameters:

  • sessionValueName:

SqlExpressionGenerator    (declared in SqlMacroProcessor)

 

property SqlExpressionGenerator: ISqlExpressionGenerator read;

 

ISqlExpressionGenerator SqlExpressionGenerator { get; }

 

var SqlExpressionGenerator: ISqlExpressionGenerator { get{} }

 

ReadOnly Property SqlExpressionGenerator() As ISqlExpressionGenerator

TrimParametersProvider  protected    (declared in SqlMacroProcessor)

 

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

 

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

 

func TrimParametersProvider(_ args: IList<String>) -> IList<String>

 

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

Parameters:

  • args:

 

CustomMacroHandler    (declared in SqlMacroProcessor)

 

property CustomMacroHandler: SqlMacroCallback read write;

 

SqlMacroCallback CustomMacroHandler { get; set; }

 

var CustomMacroHandler: SqlMacroCallback { get{} set{} }

 

Property CustomMacroHandler() As SqlMacroCallback

DateFormat  protected    (declared in SqlMacroProcessor)

Gets the date format for the current database.

 

property DateFormat: String read;

 

String DateFormat { get; }

 

var DateFormat: String { get{} }

 

ReadOnly Property DateFormat() As String

DateTimeFormat  protected    (declared in SqlMacroProcessor)

Gets the datetime format for the current database.

 

property DateTimeFormat: String read;

 

String DateTimeFormat { get; }

 

var DateTimeFormat: String { get{} }

 

ReadOnly Property DateTimeFormat() As String

DoubleQuoteStrings  protected    (declared in SqlMacroProcessor)

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; }

 

var DoubleQuoteStrings: Boolean { get{} }

 

ReadOnly Property DoubleQuoteStrings() As Boolean

SqlExpressionGenerator    (declared in SqlMacroProcessor)

 

property SqlExpressionGenerator: ISqlExpressionGenerator read;

 

ISqlExpressionGenerator SqlExpressionGenerator { get; }

 

var SqlExpressionGenerator: ISqlExpressionGenerator { get{} }

 

ReadOnly Property SqlExpressionGenerator() As ISqlExpressionGenerator

 

constructor

Creates a new instance of the MySQLMacroProcessor class.

 

constructor

 

MySQLMacroProcessor()

 

init()

 

Sub New()

constructor (String, String, Boolean, ISqlExpressionGenerator)  protected    (declared in SqlMacroProcessor)

 

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

 

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

 

init(_ dateFormat: String, _ datetimeFormat: String, _ doubleQuoteStrings: Boolean, _ expressionGenerator: ISqlExpressionGenerator)

 

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

Parameters:

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

AddVariable    (declared in SqlMacroProcessor)

 

method AddVariable(name: String): SqlMacroVariable

 

SqlMacroVariable AddVariable(String name)

 

func AddVariable(_ name: String) -> SqlMacroVariable

 

Function AddVariable(name As String) As SqlMacroVariable

Parameters:

  • name:

ClearMacros    (declared in SqlMacroProcessor)

 

method ClearMacros

 

void ClearMacros()

 

func ClearMacros()

 

Sub ClearMacros()

ClearVariables    (declared in SqlMacroProcessor)

 

method ClearVariables

 

void ClearVariables()

 

func ClearVariables()

 

Sub ClearVariables()

EvalToken    (declared in SqlMacroProcessor)

 

method EvalToken(source: String): String

 

String EvalToken(String source)

 

func EvalToken(_ source: String) -> String

 

Function EvalToken(source As String) As String

Parameters:

  • source:

Evaluate    (declared in SqlMacroProcessor)

 

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

 

String Evaluate(String source, Char delimiter = ')

 

func Evaluate(_ source: String, _ delimiter: Char = ') -> String

 

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

Parameters:

  • source:
  • delimiter:

FindVariable    (declared in SqlMacroProcessor)

 

method FindVariable(name: String): SqlMacroVariable

 

SqlMacroVariable FindVariable(String name)

 

func FindVariable(_ name: String) -> SqlMacroVariable

 

Function FindVariable(name As String) As SqlMacroVariable

Parameters:

  • name:

GetNewInstance

Creates a new instance of the MySQLMacroProcessor class.

 

method GetNewInstance: ISqlMacroProcessor

 

ISqlMacroProcessor GetNewInstance()

 

func GetNewInstance() -> ISqlMacroProcessor

 

Function GetNewInstance() As ISqlMacroProcessor

RegisterMacro    (declared in SqlMacroProcessor)

 

method RegisterMacro(macro: SqlMacroProcedure)

 

void RegisterMacro(SqlMacroProcedure macro)

 

func RegisterMacro(_ macro: SqlMacroProcedure)

 

Sub RegisterMacro(macro As SqlMacroProcedure)

Parameters:

  • macro:

RegisterMacros  protected    (declared in SqlMacroProcessor)

Registers the existing standard macros:

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

 

method RegisterMacros

 

void RegisterMacros()

 

func RegisterMacros()

 

Sub RegisterMacros()

Session  protected    (declared in SqlMacroProcessor)

 

method Session(sessionValueName: String): String

 

String Session(String sessionValueName)

 

func Session(_ sessionValueName: String) -> String

 

Function Session(sessionValueName As String) As String

Parameters:

  • sessionValueName:

TrimParametersProvider  protected    (declared in SqlMacroProcessor)

 

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

 

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

 

func TrimParametersProvider(_ args: IList<String>) -> IList<String>

 

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

Parameters:

  • args: