MacroExpression Class
From RemObjects Wiki
This is a Data Abstract for .NET Library topic
Please do not modify the page structure, but feel free to modify/add text.
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
- Assembly: RemObjects.DataAbstract.dll
- Namespace: RemObjects.DataAbstract.Expressions
- WhereExpression
- MacroExpression
Properties
| Count |
|---|
|
Gets a count of defined macro parameters.
|
| Item |
|
Gets or sets a macro parameter at the idx position.
|
| Kind |
|
Gets the kind of the current WhereExpression instance. For the MacroExpression class, this property always equals WhereKind.Macro.
|
| Name |
|
Name of the macro expression. Can be considered as name of the underlying SQL function.
|
Instance Methods
| constructor () |
|---|
|
Creates a new instance of the MacroExpression class.
|
| constructor (String) |
|
Creates a new instance of the MacroExpression class and initializes its Name property.
|
| 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.
|
| Add |
|
Adds a provided WhereExpression instance to the list of macro parameter values.
|
| Insert |
|
Inserts a provided WhereExpression instance to the list of macro parameter values at the Position position.
|
| ReadFromXml |
|
Deserializes the MacroExpression from the provided XmlNode.
|
| Remove |
|
Removes a provided WhereExpression instance from the macro parameters list.
|
| RemoveAt |
|
Removes the macro parameter stored in the macro parameters list at the index position.
|
| ToSQLString |
|
Converts the current MacroExpression instance to its SQL representation and adds the result of this conversion to the provided StringBuilder.
|
| WriteToXml |
|
Serializes the current MacroExpression instance to XML and stores the serialization result in the provided XmlNode.
|
See Also
- Lists
- Data Abstract for .NET: Namespaces – Interfaces – Classes – Enums
- RemObjects SDK for .NET: Namespaces – Interfaces – Classes – Enums
- Data Abstract shared: Data Types – File Types
- other editions
- Data Abstract for Delphi: Interfaces – Classes – Enums
- Data Abstract for Xcode: Protocols – Classes – Enums
- Data Abstract for .NET: Namespaces – Interfaces – Classes – Enums
Product: RemObjects Data Abstract
Available Editions: Data Abstract for .NET, Delphi and Xcode
Glossary — Architecture — Articles — Features — Library — Samples