WhereExpression 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
The base abstract class for classes that represent WHERE expression tree nodes:
- BinaryExpression combines two other expressions with a binary operator (such as equality or binary logical operators);
- UnaryExpression represents expressions, based in the application of a unary operator (like the change of sign or logical negation) to another, inner expression;
- BetweenExpression represents expression that checks belonging to a range of values;
- ConstantExpression - the constant values that appear in an expression are represented through objects of this class;
- ListExpression is a complex expression, represented by a list of expressions;
- ParameterExpression - the parameters (variables) of an expression are represented through objects of this class;
- FieldExpression represents the part of expression containing table field names;
- NullExpression represents NULL values used in the expression;
- MacroExpression represents a call to a macro function, which will be processed by Macro Processor.
This class is used to dynamically build WHERE statements from code (Dynamic Where feature of Data Abstarct).
For example, a WHERE part of this query
SELECT * FROM Employees WHERE ((Position = 'Sales Manager') OR (Zip IS NULL)) AND (City IN ('Atlanta GA', 'Seattle WA', 'New York CA'))
will be presented as:
WhereExpression lResult; lResult = new BinaryExpression(new BinaryExpression( new BinaryExpression( new FieldExpression("Position"), new ConstantExpression("Sales Manager", DataType.String),BinaryOperator.Equal), new BinaryExpression( new FieldExpression("Zip"), new NullExpression(),BinaryOperator.Equal),BinaryOperator.Or), new BinaryExpression( new FieldExpression("City"), new ListExpression( new WhereExpression[]{ new ConstantExpression("Atlanta GA",DataType.String), new ConstantExpression("Seattle WA", DataType.String), new ConstantExpression("New York CA", DataType.String) }), BinaryOperator.In), BinaryOperator.And);
Location
- Assembly: RemObjects.DataAbstract.dll
- Namespace: RemObjects.DataAbstract.Expressions
Properties
| Kind |
|---|
|
Abstract readonly property, which represents the type of WHERE expression in the descendant class.
|
Class Methods
| Combine (WhereExpression, WhereExpression): WhereExpression |
|---|
|
Creates new BinaryExpression from given aLeft and aRight operands, using operator And.
|
| Combine (WhereExpression, WhereExpression, BinaryOperator): WhereExpression |
|
|
| FromString |
|
Creates new WhereExpression from string, which should contain where node in the correct Dynamic Where XML Format.
|
| FromXmlNode |
|
Creates new WhereExpression from xml node, which should be in the correct Dynamic Where XML Format.
|
| Validate |
|
Validates that WhereExpression doesn't contain any errors, using WhereValidator. The main purpose of this validation - to scan all objects of WhereExpession tree and make sure that it contains correct field names. Validates that WhereExpression doesn't contain any errors, using WhereValidator. The main purpose of this validation - to scan all objects of WhereExpession tree and make sure that it contains correct field names.
|
Instance Methods
| constructor |
|---|
|
|
| ApplyFieldMapping |
|
Adjusts the field names in the WhereExpression in accordance with table names of fields in the given schema column mapping.
|
| ApplyTableNameOrAlias |
|
|
| ExtractAllConstantExpression |
|
Establishes a list of all ConstantExpression contained in the WhereExpression.
|
| ExtractAllFieldNames |
|
Establishes a list of field names used in the WhereExpression.
|
| ExtractAllParams |
|
Fills SchemaParameterCollection with ParameterExpressions and ConstantExpressions (as ParameterExpressions) contained in the WhereExpression.
|
| ReadFromXml |
|
Abstract method. In descendants creates WhereExpression from the given xml node, that should be in the correct Dynamic Where XML Format.
|
| ToSQLString () |
|
|
| ToSQLString (StringBuilder) |
|
|
| ToXmlNode |
|
Creates query node (in the Dynamic Where XML Format) from WhereExpression.
|
| ToXmlString |
|
Creates query node (in the Dynamic Where XML Format) from WhereExpression and returns it in the string format.
|
| Validate |
|
|
| WriteToXml |
|
Abstract method. In descendants creates where node (in the Dynamic Where XML Format) from WhereExpression.
|
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