SybaseAdvantageMacroProcessor

Overview

The SybaseAdvantageMacroProcessor class provides Sybase Advantage SQL specific definitions for SQL functions defined in the SqlMacroProcessor class.

The SybaseAdvantageMacroProcessor class is used to process macros in Schema statements that have their ConnectionType set to Advantage. For example the following statement:

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

will be converted to

SELECT
  *
FROM
  Orders 
WHERE
  order_date = CURRENT_DATE()

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

Location

 

constructor

Creates a new instance of the SybaseAdvantageMacroProcessor class.

 

constructor

 

SybaseAdvantageMacroProcessor()

 

Sub New

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

 

constructor(dateFormat: String; datetimeFormat: String; doubleQuoteStrings: Boolean; parameterPrefix: String)

 

SybaseAdvantageMacroProcessor(String dateFormat, String datetimeFormat, Boolean doubleQuoteStrings, String parameterPrefix)

 

Sub New (dateFormat As String, datetimeFormat As String, doubleQuoteStrings As Boolean, parameterPrefix As String)

Parameters:

  • dateFormat:
  • datetimeFormat:
  • doubleQuoteStrings:
  • parameterPrefix:

AddTime  protected

Returns Sybase-specific implementation of the AddTime(date, interval, interval_type) macro.

 

method AddTime(parameters: array of String): String

 

String AddTime(String[] parameters)

 

Function AddTime(parameters As array of String) As String

Parameters:

  • parameters: Parameters of the macro call

AddVariable    (declared in MacroParser)

Creates a new macro variable and adds it to the internal macro variables list.

 

method AddVariable(aName: String): MacroVariable

 

MacroVariable AddVariable(String aName)

 

Function AddVariable(aName As String) As MacroVariable

Parameters:

  • aName:

ClassSuffix    (declared in SqlMacroProcessor)

 

const ClassSuffix: String = "MacroProcessor";

 

const String ClassSuffix = "MacroProcessor"

 

Dim ClassSuffix As String = "MacroProcessor"

ClearMacros    (declared in MacroParser)

 

method ClearMacros

 

void ClearMacros()

 

Sub ClearMacros

ClearVariables    (declared in MacroParser)

Clears the internal list of registered macro variables.

 

method ClearVariables

 

void ClearVariables()

 

Sub ClearVariables

ComposeDatePartCall    (declared in SqlMacroProcessor)

 

method ComposeDatePartCall(value: String; datePart: String): String

 

String ComposeDatePartCall(String value, String datePart)

 

Function ComposeDatePartCall(value As String, datePart As String) As String

Parameters:

  • value:
  • datePart:

ComposeLengthCall    (declared in SqlMacroProcessor)

 

method ComposeLengthCall(argument: String): String

 

String ComposeLengthCall(String argument)

 

Function ComposeLengthCall(argument As String) As String

Parameters:

  • argument:

ComposeToLowerCall    (declared in SqlMacroProcessor)

 

method ComposeToLowerCall(argument: String): String

 

String ComposeToLowerCall(String argument)

 

Function ComposeToLowerCall(argument As String) As String

Parameters:

  • argument:

ComposeToUpperCall    (declared in SqlMacroProcessor)

 

method ComposeToUpperCall(argument: String): String

 

String ComposeToUpperCall(String argument)

 

Function ComposeToUpperCall(argument As String) As String

Parameters:

  • argument:

Copy  protected

Returns Sybase-specific implementation of the Copy(string, index, count) macro.

 

method Copy(parameters: array of String): String

 

String Copy(String[] parameters)

 

Function Copy(parameters As array of String) As String

Parameters:

  • parameters: Parameters of the macro call

CustomMacroHandler    (declared in MacroParser)

 

property CustomMacroHandler: CustomMacroCallback read write;

 

CustomMacroCallback CustomMacroHandler { get; set; }

 

Property CustomMacroHandler As CustomMacroCallback

Date  protected

Returns Sybase-specific implementation of the Date() macro.

 

method Date(parameters: array of String): String

 

String Date(String[] parameters)

 

Function Date(parameters As array of String) As String

Parameters:

  • parameters: Parameters of the macro call

DateFormat    (declared in SqlMacroProcessor)

Gets the date format for the current database.

 

property DateFormat: String read;

 

String DateFormat { get; }

 

Property ReadOnly DateFormat As String

DatePart  protected

 

method DatePart(parameters: array of String): String

 

String DatePart(String[] parameters)

 

Function DatePart(parameters As array of String) As String

Parameters:

  • parameters:

DateTime  protected

Returns Sybase-specific implementation of the DateTime() macro.

 

method DateTime(parameters: array of String): String

 

String DateTime(String[] parameters)

 

Function DateTime(parameters As array of String) As String

Parameters:

  • parameters: Parameters of the macro call

DateTimeFormat    (declared in SqlMacroProcessor)

Gets the datetime format for the current database.

 

property DateTimeFormat: String read;

 

String DateTimeFormat { get; }

 

Property ReadOnly DateTimeFormat As String

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

 

Property ReadOnly DoubleQuoteStrings As Boolean

Eval    (declared in MacroParser)

Evaluates the given expression, substituting macro tags with specific variable values or macro function results.

String constants within provided expressions can be delimited using the TextDelimiter char.

 

method Eval(Text: String; TextDelimiter: Char): String

 

String Eval(String Text, Char TextDelimiter)

 

Function Eval(Text As String, TextDelimiter As Char) As String

Parameters:

  • Text: Expression to process
  • TextDelimiter: String constants delimiter

EvalToken    (declared in MacroParser)

Evaluates the provided macro token. This method calls the macro function or replaces the macro variable placeholder with its value.

 

method EvalToken(Text: String): String

 

String EvalToken(String Text)

 

Function EvalToken(Text As String) As String

Parameters:

  • Text: Macro expression token

FindVariable    (declared in MacroParser)

Gets the macro variable with the specified name from the registered variables. Search is not case-sensitive.

If there is no variable with the provided name, null is returned.

 

method FindVariable(aName: String): MacroVariable

 

MacroVariable FindVariable(String aName)

 

Function FindVariable(aName As String) As MacroVariable

Parameters:

  • aName: Variable name

FormatDate  protected

Returns Sybase-specific implementation of the FormatDate(date) macro.

 

method FormatDate(parameters: array of String): String

 

String FormatDate(String[] parameters)

 

Function FormatDate(parameters As array of String) As String

Parameters:

  • parameters: Parameters of the macro call

FormatDateTime  protected

Returns Sybase-specific implementation of the FormatDateTime(date) macro.

 

method FormatDateTime(parameters: array of String): String

 

String FormatDateTime(String[] parameters)

 

Function FormatDateTime(parameters As array of String) As String

Parameters:

  • parameters: Parameters of the macro call

GetNewInstance

Fabric method that returns a new instance of the SybaseAdvantageMacroProcessor class.

 

method GetNewInstance: SqlMacroProcessor

 

SqlMacroProcessor GetNewInstance()

 

Function GetNewInstance As SqlMacroProcessor

Length  protected

Returns Sybase-specific implementation of the Length(string) macro.

 

method Length(parameters: array of String): String

 

String Length(String[] parameters)

 

Function Length(parameters As array of String) As String

Parameters:

  • parameters: Parameters of the macro call

LowerCase  protected

Returns Sybase-specific implementation of the LowerCase(string) macro.

 

method LowerCase(parameters: array of String): String

 

String LowerCase(String[] parameters)

 

Function LowerCase(parameters As array of String) As String

Parameters:

  • parameters: Parameters of the macro call

NoLock  protected    (declared in SqlMacroProcessor)

 

method NoLock(parameters: array of String): String

 

String NoLock(String[] parameters)

 

Function NoLock(parameters As array of String) As String

Parameters:

  • parameters:

RegisterMacro    (declared in MacroParser)

 

method RegisterMacro(name: String; callback: Func<array of String, String>; paramCount: Int32)

 

void RegisterMacro(String name, Func<String[], String> callback, Int32 paramCount)

 

Sub RegisterMacro(name As String, callback As Func<array of String, String>, paramCount As Int32)

Parameters:

  • name:
  • callback:
  • paramCount:

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()

 

Sub RegisterMacros

Session  protected    (declared in SqlMacroProcessor)

 

method Session(parameters: array of String): String

 

String Session(String[] parameters)

 

Function Session(parameters As array of String) As String

Parameters:

  • parameters:

StoredProcedurePrefix    (declared in SqlMacroProcessor)

Gets the prefix for stored procedures for the current database.

 

property StoredProcedurePrefix: String read;

 

String StoredProcedurePrefix { get; }

 

Property ReadOnly StoredProcedurePrefix As String

StoredProcParamPrefix    (declared in SqlMacroProcessor)

Gets the prefix for stored procedure params for the current database.

 

property StoredProcParamPrefix: String read;

 

String StoredProcParamPrefix { get; }

 

Property ReadOnly StoredProcParamPrefix As String

Time  protected

Returns Sybase-specific implementation of the Time() macro.

 

method Time(parameters: array of String): String

 

String Time(String[] parameters)

 

Function Time(parameters As array of String) As String

Parameters:

  • parameters: Parameters of the macro call

TrimLeft  protected

Returns Sybase-specific implementation of the TrimLeft(string) macro.

 

method TrimLeft(parameters: array of String): String

 

String TrimLeft(String[] parameters)

 

Function TrimLeft(parameters As array of String) As String

Parameters:

  • parameters: Parameters of the macro call

TrimRight  protected

Returns Sybase-specific implementation of the TrimRight(string) macro.

 

method TrimRight(parameters: array of String): String

 

String TrimRight(String[] parameters)

 

Function TrimRight(parameters As array of String) As String

Parameters:

  • parameters: Parameters of the macro call

UpperCase  protected

Returns Sybase-specific implementation of the UpperCase(string) macro.

 

method UpperCase(parameters: array of String): String

 

String UpperCase(String[] parameters)

 

Function UpperCase(parameters As array of String) As String

Parameters:

  • parameters: Parameters of the macro call

 

ClassSuffix    (declared in SqlMacroProcessor)

 

const ClassSuffix: String = "MacroProcessor";

 

const String ClassSuffix = "MacroProcessor"

 

Dim ClassSuffix As String = "MacroProcessor"

 

CustomMacroHandler    (declared in MacroParser)

 

property CustomMacroHandler: CustomMacroCallback read write;

 

CustomMacroCallback CustomMacroHandler { get; set; }

 

Property CustomMacroHandler As CustomMacroCallback

DateFormat    (declared in SqlMacroProcessor)

Gets the date format for the current database.

 

property DateFormat: String read;

 

String DateFormat { get; }

 

Property ReadOnly DateFormat As String

DateTimeFormat    (declared in SqlMacroProcessor)

Gets the datetime format for the current database.

 

property DateTimeFormat: String read;

 

String DateTimeFormat { get; }

 

Property ReadOnly DateTimeFormat As String

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

 

Property ReadOnly DoubleQuoteStrings As Boolean

StoredProcedurePrefix    (declared in SqlMacroProcessor)

Gets the prefix for stored procedures for the current database.

 

property StoredProcedurePrefix: String read;

 

String StoredProcedurePrefix { get; }

 

Property ReadOnly StoredProcedurePrefix As String

StoredProcParamPrefix    (declared in SqlMacroProcessor)

Gets the prefix for stored procedure params for the current database.

 

property StoredProcParamPrefix: String read;

 

String StoredProcParamPrefix { get; }

 

Property ReadOnly StoredProcParamPrefix As String

 

constructor

Creates a new instance of the SybaseAdvantageMacroProcessor class.

 

constructor

 

SybaseAdvantageMacroProcessor()

 

Sub New

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

 

constructor(dateFormat: String; datetimeFormat: String; doubleQuoteStrings: Boolean; parameterPrefix: String)

 

SybaseAdvantageMacroProcessor(String dateFormat, String datetimeFormat, Boolean doubleQuoteStrings, String parameterPrefix)

 

Sub New (dateFormat As String, datetimeFormat As String, doubleQuoteStrings As Boolean, parameterPrefix As String)

Parameters:

  • dateFormat:
  • datetimeFormat:
  • doubleQuoteStrings:
  • parameterPrefix:

AddTime  protected

Returns Sybase-specific implementation of the AddTime(date, interval, interval_type) macro.

 

method AddTime(parameters: array of String): String

 

String AddTime(String[] parameters)

 

Function AddTime(parameters As array of String) As String

Parameters:

  • parameters: Parameters of the macro call

AddVariable    (declared in MacroParser)

Creates a new macro variable and adds it to the internal macro variables list.

 

method AddVariable(aName: String): MacroVariable

 

MacroVariable AddVariable(String aName)

 

Function AddVariable(aName As String) As MacroVariable

Parameters:

  • aName:

ClearMacros    (declared in MacroParser)

 

method ClearMacros

 

void ClearMacros()

 

Sub ClearMacros

ClearVariables    (declared in MacroParser)

Clears the internal list of registered macro variables.

 

method ClearVariables

 

void ClearVariables()

 

Sub ClearVariables

ComposeDatePartCall    (declared in SqlMacroProcessor)

 

method ComposeDatePartCall(value: String; datePart: String): String

 

String ComposeDatePartCall(String value, String datePart)

 

Function ComposeDatePartCall(value As String, datePart As String) As String

Parameters:

  • value:
  • datePart:

ComposeLengthCall    (declared in SqlMacroProcessor)

 

method ComposeLengthCall(argument: String): String

 

String ComposeLengthCall(String argument)

 

Function ComposeLengthCall(argument As String) As String

Parameters:

  • argument:

ComposeToLowerCall    (declared in SqlMacroProcessor)

 

method ComposeToLowerCall(argument: String): String

 

String ComposeToLowerCall(String argument)

 

Function ComposeToLowerCall(argument As String) As String

Parameters:

  • argument:

ComposeToUpperCall    (declared in SqlMacroProcessor)

 

method ComposeToUpperCall(argument: String): String

 

String ComposeToUpperCall(String argument)

 

Function ComposeToUpperCall(argument As String) As String

Parameters:

  • argument:

Copy  protected

Returns Sybase-specific implementation of the Copy(string, index, count) macro.

 

method Copy(parameters: array of String): String

 

String Copy(String[] parameters)

 

Function Copy(parameters As array of String) As String

Parameters:

  • parameters: Parameters of the macro call

Date  protected

Returns Sybase-specific implementation of the Date() macro.

 

method Date(parameters: array of String): String

 

String Date(String[] parameters)

 

Function Date(parameters As array of String) As String

Parameters:

  • parameters: Parameters of the macro call

DatePart  protected

 

method DatePart(parameters: array of String): String

 

String DatePart(String[] parameters)

 

Function DatePart(parameters As array of String) As String

Parameters:

  • parameters:

DateTime  protected

Returns Sybase-specific implementation of the DateTime() macro.

 

method DateTime(parameters: array of String): String

 

String DateTime(String[] parameters)

 

Function DateTime(parameters As array of String) As String

Parameters:

  • parameters: Parameters of the macro call

Eval    (declared in MacroParser)

Evaluates the given expression, substituting macro tags with specific variable values or macro function results.

String constants within provided expressions can be delimited using the TextDelimiter char.

 

method Eval(Text: String; TextDelimiter: Char): String

 

String Eval(String Text, Char TextDelimiter)

 

Function Eval(Text As String, TextDelimiter As Char) As String

Parameters:

  • Text: Expression to process
  • TextDelimiter: String constants delimiter

EvalToken    (declared in MacroParser)

Evaluates the provided macro token. This method calls the macro function or replaces the macro variable placeholder with its value.

 

method EvalToken(Text: String): String

 

String EvalToken(String Text)

 

Function EvalToken(Text As String) As String

Parameters:

  • Text: Macro expression token

FindVariable    (declared in MacroParser)

Gets the macro variable with the specified name from the registered variables. Search is not case-sensitive.

If there is no variable with the provided name, null is returned.

 

method FindVariable(aName: String): MacroVariable

 

MacroVariable FindVariable(String aName)

 

Function FindVariable(aName As String) As MacroVariable

Parameters:

  • aName: Variable name

FormatDate  protected

Returns Sybase-specific implementation of the FormatDate(date) macro.

 

method FormatDate(parameters: array of String): String

 

String FormatDate(String[] parameters)

 

Function FormatDate(parameters As array of String) As String

Parameters:

  • parameters: Parameters of the macro call

FormatDateTime  protected

Returns Sybase-specific implementation of the FormatDateTime(date) macro.

 

method FormatDateTime(parameters: array of String): String

 

String FormatDateTime(String[] parameters)

 

Function FormatDateTime(parameters As array of String) As String

Parameters:

  • parameters: Parameters of the macro call

GetNewInstance

Fabric method that returns a new instance of the SybaseAdvantageMacroProcessor class.

 

method GetNewInstance: SqlMacroProcessor

 

SqlMacroProcessor GetNewInstance()

 

Function GetNewInstance As SqlMacroProcessor

Length  protected

Returns Sybase-specific implementation of the Length(string) macro.

 

method Length(parameters: array of String): String

 

String Length(String[] parameters)

 

Function Length(parameters As array of String) As String

Parameters:

  • parameters: Parameters of the macro call

LowerCase  protected

Returns Sybase-specific implementation of the LowerCase(string) macro.

 

method LowerCase(parameters: array of String): String

 

String LowerCase(String[] parameters)

 

Function LowerCase(parameters As array of String) As String

Parameters:

  • parameters: Parameters of the macro call

NoLock  protected    (declared in SqlMacroProcessor)

 

method NoLock(parameters: array of String): String

 

String NoLock(String[] parameters)

 

Function NoLock(parameters As array of String) As String

Parameters:

  • parameters:

RegisterMacro    (declared in MacroParser)

 

method RegisterMacro(name: String; callback: Func<array of String, String>; paramCount: Int32)

 

void RegisterMacro(String name, Func<String[], String> callback, Int32 paramCount)

 

Sub RegisterMacro(name As String, callback As Func<array of String, String>, paramCount As Int32)

Parameters:

  • name:
  • callback:
  • paramCount:

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()

 

Sub RegisterMacros

Session  protected    (declared in SqlMacroProcessor)

 

method Session(parameters: array of String): String

 

String Session(String[] parameters)

 

Function Session(parameters As array of String) As String

Parameters:

  • parameters:

Time  protected

Returns Sybase-specific implementation of the Time() macro.

 

method Time(parameters: array of String): String

 

String Time(String[] parameters)

 

Function Time(parameters As array of String) As String

Parameters:

  • parameters: Parameters of the macro call

TrimLeft  protected

Returns Sybase-specific implementation of the TrimLeft(string) macro.

 

method TrimLeft(parameters: array of String): String

 

String TrimLeft(String[] parameters)

 

Function TrimLeft(parameters As array of String) As String

Parameters:

  • parameters: Parameters of the macro call

TrimRight  protected

Returns Sybase-specific implementation of the TrimRight(string) macro.

 

method TrimRight(parameters: array of String): String

 

String TrimRight(String[] parameters)

 

Function TrimRight(parameters As array of String) As String

Parameters:

  • parameters: Parameters of the macro call

UpperCase  protected

Returns Sybase-specific implementation of the UpperCase(string) macro.

 

method UpperCase(parameters: array of String): String

 

String UpperCase(String[] parameters)

 

Function UpperCase(parameters As array of String) As String

Parameters:

  • parameters: Parameters of the macro call

See Also