TDAWhereBuilder

Overview

The TDAWhereBuilder class is used to dynamically build WHERE statements.

Location


 

constructor Create

Creates a new instance.

constructor Create

Clear

Clears all properties.

procedure Clear

ColumnMapping

Column mapping.

property ColumnMapping: TDAColumnMappingCollection read write

Expression

Represents Where expressions.

property Expression: TDAWhereExpression read write

ExpressionToXml

class function ExpressionToXml(const aExpression: TDAWhereExpression): UnicodeString

Parameters:

  • aExpression:

ExpressionToXmlNode

Converts TDAWhereExpression to XML node

class function ExpressionToXmlNode(const aExpression: TDAWhereExpression): IXMLNode

Parameters:

  • aExpression: expression

IsEmpty

Returns True is Expression is empty.

function IsEmpty: Boolean

Adds a new BETWEEN condition to the WHERE clause:

aExpression BETWEEN aLower AND aUpper
class function NewBetweenExpression(aExpression: TDAWhereExpression; aLower: TDAWhereExpression; aUpper: TDAWhereExpression): TDAWhereExpression

Parameters:

  • aExpression: expression
  • aLower: The minimal value
  • aUpper: The maximum value

NewBetweenExpression (string, string, TDAWhereExpression, TDAWhereExpression): TDAWhereExpression  overload

Adds a new BETWEEN condition to the WHERE clause:

aExprTableName.aExprFieldName BETWEEN aLower AND aUpper
class function NewBetweenExpression(const aExprTableName: string; const aExprFieldName: string; aLower: TDAWhereExpression; aUpper: TDAWhereExpression): TDAWhereExpression

Parameters:

  • aExprTableName: table name
  • aExprFieldName: field name
  • aLower: The minimal value
  • aUpper: The maximum value

NewBetweenExpression (string, string, variant, variant, TDADataType): TDAWhereExpression  overload

Adds a new BETWEEN condition to the WHERE clause:

aExprTableName.aExprFieldName BETWEEN aLower AND aUpper
class function NewBetweenExpression(const aExprTableName: string; const aExprFieldName: string; aLowerValue: variant; aUpperValue: variant; aValuesDataType: TDADataType): TDAWhereExpression

Parameters:

  • aExprTableName: table name
  • aExprFieldName: field name
  • aLowerValue: The minimal value
  • aUpperValue: The maximum value
  • aValuesDataType: data type of aLowerValue and aUpperValue

NewBinaryExpression (TDAWhereExpression, TDABinaryOperator, variant): TDAWhereExpression  overload

class function NewBinaryExpression(aLeft: TDAWhereExpression; anOp: TDABinaryOperator; const aValue: variant): TDAWhereExpression

Parameters:

  • aLeft:
  • anOp:
  • aValue:

NewBinaryExpression (TDAWhereExpression, TDABinaryOperator, variant, TDADataType): TDAWhereExpression  overload

class function NewBinaryExpression(aLeft: TDAWhereExpression; anOp: TDABinaryOperator; const aValue: variant; aType: TDADataType): TDAWhereExpression

Parameters:

  • aLeft:
  • anOp:
  • aValue:
  • aType:

class function NewBinaryExpression(aLeft: TDAWhereExpression; aRight: TDAWhereExpression; anOp: TDABinaryOperator): TDAWhereExpression

Parameters:

  • aLeft:
  • aRight:
  • anOp:

NewBinaryExpression (string, string, TDABinaryOperator, variant): TDAWhereExpression  overload

class function NewBinaryExpression(const aTableName: string; const aFieldName: string; anOp: TDABinaryOperator; const aValue: variant): TDAWhereExpression

Parameters:

  • aTableName:
  • aFieldName:
  • anOp:
  • aValue:

NewBinaryExpression (string, string, TDABinaryOperator, variant, TDADataType): TDAWhereExpression  overload

class function NewBinaryExpression(const aTableName: string; const aFieldName: string; anOp: TDABinaryOperator; const aValue: variant; aType: TDADataType): TDAWhereExpression

Parameters:

  • aTableName:
  • aFieldName:
  • anOp:
  • aValue:
  • aType:

NewBinaryExpression (string, string, string, TDADataType, TDABinaryOperator): TDAWhereExpression  overload

class function NewBinaryExpression(const aTableName: string; const aFieldName: string; const aParameterName: string; aParameterType: TDADataType; anOp: TDABinaryOperator): TDAWhereExpression

Parameters:

  • aTableName:
  • aFieldName:
  • aParameterName:
  • aParameterType:
  • anOp:

NewBinaryExpressionList

Adds a new condition to the WHERE clause

class function NewBinaryExpressionList(const aExpressions: array of TDAWhereExpression; anOp: TDABinaryOperator): TDAWhereExpression

Parameters:

  • aExpressions: list of expressions
  • anOp: operator

NewConstant (Variant): TDAWhereExpression  overload

Adds a new constant condition to the WHERE clause.

class function NewConstant(const aValue: Variant): TDAWhereExpression

Parameters:

  • aValue: value

NewConstant (Variant, TDADataType): TDAWhereExpression  overload

Adds a new constant condition to the WHERE clause.

class function NewConstant(const aValue: Variant; aType: TDADataType): TDAWhereExpression

Parameters:

  • aValue: value
  • aType: value type

NewDateTimePart

class function NewDateTimePart(anExpression: TDAWhereExpression; aPart: TDADateTimePart): TDAWhereExpression

Parameters:

  • anExpression:
  • aPart:

NewField

Adds a new field condition to the WHERE clause.

class function NewField(const aTableName: string; const aFieldName: string): TDAWhereExpression

Parameters:

  • aTableName: table name
  • aFieldName: field name

NewFunctionCall

class function NewFunctionCall(anExpression: TDAWhereExpression; aFunctionKind: TDAFunctionKind): TDAWhereExpression

Parameters:

  • anExpression:
  • aFunctionKind:

NewIsNotNull  overload

class function NewIsNotNull: TDAWhereExpression

NewIsNotNull (string, string): TDAWhereExpression  overload

Adds a new NOT NULL condition to the WHERE clause:

aTableName.aFieldName IS NOT NULL
class function NewIsNotNull(const aTableName: string; const aFieldName: string): TDAWhereExpression

Parameters:

  • aTableName: table name
  • aFieldName: field name

NewList

Adds a new list condition to the WHERE clause.

class function NewList(const aValues: array of TDAWhereExpression): TDAWhereExpression

Parameters:

  • aValues: list of expressions

NewMacro (string): TDAWhereExpression  overload

Adds a new macro condition to the WHERE clause.

class function NewMacro(const aName: string): TDAWhereExpression

Parameters:

  • aName: macro name

NewMacro (string, array of TDAWhereExpression): TDAWhereExpression  overload

Adds a new macro condition to the WHERE clause.

class function NewMacro(const aName: string; const aValues: array of TDAWhereExpression): TDAWhereExpression

Parameters:

  • aName: macro name
  • aValues: array of expressions.

NewNow

class function NewNow: TDAWhereExpression

NewNull

class function NewNull: TDAWhereExpression

NewParameter

Adds a new parameter condition to the WHERE clause.

class function NewParameter(const aParameterName: string; aParameterType: TDADataType): TDAWhereExpression

Parameters:

  • aParameterName: parameter name
  • aParameterType: parameter type

NewToday

class function NewToday: TDAWhereExpression

NewUnaryExpression

Adds a new unary condition to the WHERE clause.

class function NewUnaryExpression(anExpression: TDAWhereExpression; anOp: TDAUnaryOperator): TDAWhereExpression

Parameters:

  • anExpression: expression
  • anOp: operator

Params

Provides access to the list of parameters defined for the command.

property Params: TDAParamCollection read write

ReadFromXml  protected virtual

Reads Where expression from XML node

class function ReadFromXml(xr: IXmlNode): TDAWhereExpression

Parameters:

  • xr: node

WriteToXml  protected virtual

Writes Where expression to XML node

class procedure WriteToXml(sw: IXmlNode; const aExpression: TDAWhereExpression)

Parameters:

  • sw: node
  • aExpression: expression

Xml

Represent Where expressions as XML node.

property Xml: UnicodeString read write

XMLToExpression

Reads Where expression from XML

class function XMLToExpression(const aXML: UnicodeString): TDAWhereExpression

Parameters:

  • aXML: given XML

 

ColumnMapping

Column mapping.

property ColumnMapping: TDAColumnMappingCollection read write

Expression

Represents Where expressions.

property Expression: TDAWhereExpression read write

Params

Provides access to the list of parameters defined for the command.

property Params: TDAParamCollection read write

Xml

Represent Where expressions as XML node.

property Xml: UnicodeString read write

 

ExpressionToXml

class function ExpressionToXml(const aExpression: TDAWhereExpression): UnicodeString

Parameters:

  • aExpression:

ExpressionToXmlNode

Converts TDAWhereExpression to XML node

class function ExpressionToXmlNode(const aExpression: TDAWhereExpression): IXMLNode

Parameters:

  • aExpression: expression

Adds a new BETWEEN condition to the WHERE clause:

aExpression BETWEEN aLower AND aUpper
class function NewBetweenExpression(aExpression: TDAWhereExpression; aLower: TDAWhereExpression; aUpper: TDAWhereExpression): TDAWhereExpression

Parameters:

  • aExpression: expression
  • aLower: The minimal value
  • aUpper: The maximum value

NewBetweenExpression (string, string, TDAWhereExpression, TDAWhereExpression): TDAWhereExpression  overload

Adds a new BETWEEN condition to the WHERE clause:

aExprTableName.aExprFieldName BETWEEN aLower AND aUpper
class function NewBetweenExpression(const aExprTableName: string; const aExprFieldName: string; aLower: TDAWhereExpression; aUpper: TDAWhereExpression): TDAWhereExpression

Parameters:

  • aExprTableName: table name
  • aExprFieldName: field name
  • aLower: The minimal value
  • aUpper: The maximum value

NewBetweenExpression (string, string, variant, variant, TDADataType): TDAWhereExpression  overload

Adds a new BETWEEN condition to the WHERE clause:

aExprTableName.aExprFieldName BETWEEN aLower AND aUpper
class function NewBetweenExpression(const aExprTableName: string; const aExprFieldName: string; aLowerValue: variant; aUpperValue: variant; aValuesDataType: TDADataType): TDAWhereExpression

Parameters:

  • aExprTableName: table name
  • aExprFieldName: field name
  • aLowerValue: The minimal value
  • aUpperValue: The maximum value
  • aValuesDataType: data type of aLowerValue and aUpperValue

NewBinaryExpression (TDAWhereExpression, TDABinaryOperator, variant): TDAWhereExpression  overload

class function NewBinaryExpression(aLeft: TDAWhereExpression; anOp: TDABinaryOperator; const aValue: variant): TDAWhereExpression

Parameters:

  • aLeft:
  • anOp:
  • aValue:

NewBinaryExpression (TDAWhereExpression, TDABinaryOperator, variant, TDADataType): TDAWhereExpression  overload

class function NewBinaryExpression(aLeft: TDAWhereExpression; anOp: TDABinaryOperator; const aValue: variant; aType: TDADataType): TDAWhereExpression

Parameters:

  • aLeft:
  • anOp:
  • aValue:
  • aType:

class function NewBinaryExpression(aLeft: TDAWhereExpression; aRight: TDAWhereExpression; anOp: TDABinaryOperator): TDAWhereExpression

Parameters:

  • aLeft:
  • aRight:
  • anOp:

NewBinaryExpression (string, string, TDABinaryOperator, variant): TDAWhereExpression  overload

class function NewBinaryExpression(const aTableName: string; const aFieldName: string; anOp: TDABinaryOperator; const aValue: variant): TDAWhereExpression

Parameters:

  • aTableName:
  • aFieldName:
  • anOp:
  • aValue:

NewBinaryExpression (string, string, TDABinaryOperator, variant, TDADataType): TDAWhereExpression  overload

class function NewBinaryExpression(const aTableName: string; const aFieldName: string; anOp: TDABinaryOperator; const aValue: variant; aType: TDADataType): TDAWhereExpression

Parameters:

  • aTableName:
  • aFieldName:
  • anOp:
  • aValue:
  • aType:

NewBinaryExpression (string, string, string, TDADataType, TDABinaryOperator): TDAWhereExpression  overload

class function NewBinaryExpression(const aTableName: string; const aFieldName: string; const aParameterName: string; aParameterType: TDADataType; anOp: TDABinaryOperator): TDAWhereExpression

Parameters:

  • aTableName:
  • aFieldName:
  • aParameterName:
  • aParameterType:
  • anOp:

NewBinaryExpressionList

Adds a new condition to the WHERE clause

class function NewBinaryExpressionList(const aExpressions: array of TDAWhereExpression; anOp: TDABinaryOperator): TDAWhereExpression

Parameters:

  • aExpressions: list of expressions
  • anOp: operator

NewConstant (Variant): TDAWhereExpression  overload

Adds a new constant condition to the WHERE clause.

class function NewConstant(const aValue: Variant): TDAWhereExpression

Parameters:

  • aValue: value

NewConstant (Variant, TDADataType): TDAWhereExpression  overload

Adds a new constant condition to the WHERE clause.

class function NewConstant(const aValue: Variant; aType: TDADataType): TDAWhereExpression

Parameters:

  • aValue: value
  • aType: value type

NewDateTimePart

class function NewDateTimePart(anExpression: TDAWhereExpression; aPart: TDADateTimePart): TDAWhereExpression

Parameters:

  • anExpression:
  • aPart:

NewField

Adds a new field condition to the WHERE clause.

class function NewField(const aTableName: string; const aFieldName: string): TDAWhereExpression

Parameters:

  • aTableName: table name
  • aFieldName: field name

NewFunctionCall

class function NewFunctionCall(anExpression: TDAWhereExpression; aFunctionKind: TDAFunctionKind): TDAWhereExpression

Parameters:

  • anExpression:
  • aFunctionKind:

NewIsNotNull  overload

class function NewIsNotNull: TDAWhereExpression

NewIsNotNull (string, string): TDAWhereExpression  overload

Adds a new NOT NULL condition to the WHERE clause:

aTableName.aFieldName IS NOT NULL
class function NewIsNotNull(const aTableName: string; const aFieldName: string): TDAWhereExpression

Parameters:

  • aTableName: table name
  • aFieldName: field name

NewList

Adds a new list condition to the WHERE clause.

class function NewList(const aValues: array of TDAWhereExpression): TDAWhereExpression

Parameters:

  • aValues: list of expressions

NewMacro (string): TDAWhereExpression  overload

Adds a new macro condition to the WHERE clause.

class function NewMacro(const aName: string): TDAWhereExpression

Parameters:

  • aName: macro name

NewMacro (string, array of TDAWhereExpression): TDAWhereExpression  overload

Adds a new macro condition to the WHERE clause.

class function NewMacro(const aName: string; const aValues: array of TDAWhereExpression): TDAWhereExpression

Parameters:

  • aName: macro name
  • aValues: array of expressions.

NewNow

class function NewNow: TDAWhereExpression

NewNull

class function NewNull: TDAWhereExpression

NewParameter

Adds a new parameter condition to the WHERE clause.

class function NewParameter(const aParameterName: string; aParameterType: TDADataType): TDAWhereExpression

Parameters:

  • aParameterName: parameter name
  • aParameterType: parameter type

NewToday

class function NewToday: TDAWhereExpression

NewUnaryExpression

Adds a new unary condition to the WHERE clause.

class function NewUnaryExpression(anExpression: TDAWhereExpression; anOp: TDAUnaryOperator): TDAWhereExpression

Parameters:

  • anExpression: expression
  • anOp: operator

ReadFromXml  protected virtual

Reads Where expression from XML node

class function ReadFromXml(xr: IXmlNode): TDAWhereExpression

Parameters:

  • xr: node

WriteToXml  protected virtual

Writes Where expression to XML node

class procedure WriteToXml(sw: IXmlNode; const aExpression: TDAWhereExpression)

Parameters:

  • sw: node
  • aExpression: expression

XMLToExpression

Reads Where expression from XML

class function XMLToExpression(const aXML: UnicodeString): TDAWhereExpression

Parameters:

  • aXML: given XML

 

constructor Create

Creates a new instance.

constructor Create

Clear

Clears all properties.

procedure Clear

IsEmpty

Returns True is Expression is empty.

function IsEmpty: Boolean