MacroExpression Class

From RemObjects Wiki

Jump to:navigation, search
.NET Platform Header-48.png

This is a Data Abstract for .NET Library topic

Please do not modify the page structure, but feel free to modify/add text.

ClassesProtocolsEnums

Contents

Overview

Instances of the MacroExpression class can be used to represent direct calls to the SQL function of the underlying database server.

For example: this SQL expression

DATEADD(DAY, 1, CURRENT_TIMESTAMP)

can be represented as

new MacroExpression("DATEADD",
  new WhereExpression[] { 
    new MacroExpression("DAY"), 
    new ConstantExpression(1), 
    new MacroExpression("CURRENT_TIMESTAMP") });


Please note that a WhereExpression containing a MacroExpression cannot be used to perform Dynamic Where clauses due to security restrictions (allowing it would enable SQL injection attacks via Dynamic Where).

Instead, you can provide a custom DataService method that accepts the WhereExpression parameter and converts it into SQL using the ToSqlString method.

Location


Properties

Count

Gets a count of defined macro parameters.


Prism:   property Count: Int32 read
C#:   Int32 Count { get; }
VB:   Property ReadOnly Count As Int32


Item

Gets or sets a macro parameter at the idx position.


Prism:   property Item[aIndex: Int32]: WhereExpression read write
C#:   WhereExpression Item[Int32 aIndex] { get; set; }
VB:   Property Item[aIndex As Int32] As WhereExpression


Kind

Gets the kind of the current WhereExpression instance. For the MacroExpression class, this property always equals WhereKind.Macro.


Prism:   property Kind: WhereKind read
C#:   WhereKind Kind { get; }
VB:   Property ReadOnly Kind As WhereKind


Name

Name of the macro expression. Can be considered as name of the underlying SQL function.


Prism:   property Name: String read write
C#:   String Name { get; set; }
VB:   Property Name As String


Instance Methods

constructor ()

Creates a new instance of the MacroExpression class.


Prism:   constructor
C#:   constructor()
VB:   Sub New


constructor (String)

Creates a new instance of the MacroExpression class and initializes its Name property.


Prism:   constructor(aName: String)
C#:   constructor(String aName)
VB:   Sub New (aName As String)


Parameters:

  • aName: Name of the created MacroExpression


constructor (String, array of WhereExpression)

Creates a new instance of the MacroExpression class and initializes its Name property. The method also intializes a list of macro parameters.


Prism:   constructor(aName: String; params aValues: array of WhereExpression)
C#:   constructor(String aName, params array of WhereExpression aValues)
VB:   Sub New (aName As String, ParamArray aValues As array of WhereExpression)


Parameters:

  • aName: Name of the created MacroExpression
  • aValues: Parameter values of the created MacroExpression


Add

Adds a provided WhereExpression instance to the list of macro parameter values.


Prism:   method Add(aValue: WhereExpression)
C#:   void Add(WhereExpression aValue)
VB:   Sub Add(aValue As WhereExpression)


Parameters:

  • aValue: Macro parameter to be added to the parameters list


Insert

Inserts a provided WhereExpression instance to the list of macro parameter values at the Position position.


Prism:   method Insert(aPosition: Int32; aValue: WhereExpression)
C#:   void Insert(Int32 aPosition, WhereExpression aValue)
VB:   Sub Insert(aPosition As Int32, aValue As WhereExpression)


Parameters:

  • aPosition:
  • aValue: Macro parameter to be inserted into the parameters list


ReadFromXml

Deserializes the MacroExpression from the provided XmlNode.


Prism:   method ReadFromXml(aXmlNode: XmlNode)
C#:   void ReadFromXml(XmlNode aXmlNode)
VB:   Sub ReadFromXml(aXmlNode As XmlNode)


Parameters:

  • aXmlNode:


Remove

Removes a provided WhereExpression instance from the macro parameters list.


Prism:   method Remove(aValue: WhereExpression)
C#:   void Remove(WhereExpression aValue)
VB:   Sub Remove(aValue As WhereExpression)


Parameters:

  • aValue: Macro parameter to be removed from the parameters list


RemoveAt

Removes the macro parameter stored in the macro parameters list at the index position.


Prism:   method RemoveAt(aIndex: Int32)
C#:   void RemoveAt(Int32 aIndex)
VB:   Sub RemoveAt(aIndex As Int32)


Parameters:

  • aIndex:


ToSQLString

Converts the current MacroExpression instance to its SQL representation and adds the result of this conversion to the provided StringBuilder.


Prism:   method ToSQLString(aDestination: StringBuilder)
C#:   void ToSQLString(StringBuilder aDestination)
VB:   Sub ToSQLString(aDestination As StringBuilder)


Parameters:

  • aDestination:


WriteToXml

Serializes the current MacroExpression instance to XML and stores the serialization result in the provided XmlNode.


Prism:   method WriteToXml(aXmlNode: XmlNode)
C#:   void WriteToXml(XmlNode aXmlNode)
VB:   Sub WriteToXml(aXmlNode As XmlNode)


Parameters:

  • aXmlNode:



See Also


Da-48.png

Product: RemObjects Data Abstract
Available Editions: Data Abstract for .NET, Delphi and Xcode

GlossaryArchitectureArticlesFeaturesLibrarySamples

Navigation
products
hubs
special
Toolbox