TDASelectWhereBuilder

Overview

The TDASelectWhereBuilder class is used to create dynamic SELECT and WHERE statements of any SQL statement. This class is obsolete and only used for backward compatibility. For creating dynamic statements, see the articles Dynamic Select, Dynamic Where and Dynamic Request.

Location

 

constructor Create

Creates a new instance.

constructor Create

AddField

Adds a new specified field aField to the collection Fields.

function AddField(aField: TDASelectWhereItem): Integer

Parameters:

  • aField: Specified field

Clear    (declared in TDAWhereBuilder)

Clears all properties.

procedure Clear

ColumnMapping    (declared in TDAWhereBuilder)

Column mapping.

property ColumnMapping: TDAColumnMappingCollection read write

DeleteField

Deletes the field with the specified index from the collection Fields.

procedure DeleteField(index: Integer)

Parameters:

  • index: Specified index

Expression    (declared in TDAWhereBuilder)

Represents Where expressions.

property Expression: TDAWhereExpression read write

ExpressionToXmlNode    (declared in TDAWhereBuilder)

Converts TDAWhereExpression to XML node

function ExpressionToXmlNode(const aExpression: TDAWhereExpression): IXMLNode

Parameters:

  • aExpression: expression

FieldCount

Represents the count of items in the collection Fields.

property FieldCount: Integer read write

Fields

Represents the collection of fields in the SELECT statement of the current object.

property Fields[i: Integer]: TDASelectWhereItem read write

IsEmpty    (declared in TDAWhereBuilder)

Returns True is Expression is empty.

function IsEmpty: Boolean

NewBetweenExpression (string, string, TDAWhereExpression, TDAWhereExpression): TDAWhereExpression  overload    (declared in TDAWhereBuilder)

Adds a new BETWEEN condition to the WHERE clause:

aExprTableName.aExprFieldName BETWEEN aLower AND aUpper
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    (declared in TDAWhereBuilder)

Adds a new BETWEEN condition to the WHERE clause:

aExprTableName.aExprFieldName BETWEEN aLower AND aUpper
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

NewBetweenExpression (TDAWhereExpression, TDAWhereExpression, TDAWhereExpression): TDAWhereExpression  overload    (declared in TDAWhereBuilder)

Adds a new BETWEEN condition to the WHERE clause:

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

Parameters:

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

NewBinaryExpression (string, string, string, TDADataType, TDABinaryOperator): TDAWhereExpression  overload    (declared in TDAWhereBuilder)

Adds a new comparison condition to the WHERE clause

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

Parameters:

  • aTableName: table name
  • aFieldName: field name
  • aParameterName: parameter name
  • aParameterType: parameter type
  • anOp: operator

NewBinaryExpression (string, string, TDABinaryOperator, variant): TDAWhereExpression  overload    (declared in TDAWhereBuilder)

Adds a new comparison condition to the WHERE clause

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

Parameters:

  • aTableName: table name
  • aFieldName: field name
  • anOp: operator
  • aValue: constant value

NewBinaryExpression (string, string, TDABinaryOperator, variant, TDADataType): TDAWhereExpression  overload    (declared in TDAWhereBuilder)

Adds a new comparison condition to the WHERE clause

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

Parameters:

  • aTableName: table name
  • aFieldName: field name
  • anOp: operator
  • aValue: constant value
  • aType: data type

NewBinaryExpression (TDAWhereExpression, TDABinaryOperator, variant): TDAWhereExpression  overload    (declared in TDAWhereBuilder)

Adds a new comparison condition to the WHERE clause

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

Parameters:

  • aLeft: left expression
  • anOp: operator
  • aValue: constant value

NewBinaryExpression (TDAWhereExpression, TDABinaryOperator, variant, TDADataType): TDAWhereExpression  overload    (declared in TDAWhereBuilder)

Adds a new comparison condition to the WHERE clause

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

Parameters:

  • aLeft: left expression
  • anOp: operator
  • aValue: constant value
  • aType: data type

NewBinaryExpression (TDAWhereExpression, TDAWhereExpression, TDABinaryOperator): TDAWhereExpression  overload    (declared in TDAWhereBuilder)

Adds a new comparison condition to the WHERE clause

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

Parameters:

  • aLeft: left expression
  • aRight: right expression
  • anOp: operator

NewBinaryExpressionList    (declared in TDAWhereBuilder)

Adds a new condition to the WHERE clause

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

Parameters:

  • aExpressions: list of expressions
  • anOp: operator

NewConstant (Variant): TDAWhereExpression  overload    (declared in TDAWhereBuilder)

Adds a new constant condition to the WHERE clause.

function NewConstant(const aValue: Variant): TDAWhereExpression

Parameters:

  • aValue: value

NewConstant (Variant, TDADataType): TDAWhereExpression  overload    (declared in TDAWhereBuilder)

Adds a new constant condition to the WHERE clause.

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

Parameters:

  • aValue: value
  • aType: value type

NewField    (declared in TDAWhereBuilder)

Adds a new field condition to the WHERE clause.

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

Parameters:

  • aTableName: table name
  • aFieldName: field name

NewIsNotNull  overload    (declared in TDAWhereBuilder)

Adds a new NOT NULL condition to the WHERE clause.

function NewIsNotNull: TDAWhereExpression

NewIsNotNull (string, string): TDAWhereExpression  overload    (declared in TDAWhereBuilder)

Adds a new NOT NULL condition to the WHERE clause:

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

Parameters:

  • aTableName: table name
  • aFieldName: field name

NewList    (declared in TDAWhereBuilder)

Adds a new list condition to the WHERE clause.

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

Parameters:

  • aValues: list of expressions

NewMacro (string): TDAWhereExpression  overload    (declared in TDAWhereBuilder)

Adds a new macro condition to the WHERE clause.

function NewMacro(const aName: string): TDAWhereExpression

Parameters:

  • aName: macro name

NewMacro (string, array of TDAWhereExpression): TDAWhereExpression  overload    (declared in TDAWhereBuilder)

Adds a new macro condition to the WHERE clause.

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

Parameters:

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

NewNull    (declared in TDAWhereBuilder)

Adds a NULL condition to the WHERE clause.

function NewNull: TDAWhereExpression

NewParameter    (declared in TDAWhereBuilder)

Adds a new parameter condition to the WHERE clause.

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

Parameters:

  • aParameterName: parameter name
  • aParameterType: parameter type

NewUnaryExpression    (declared in TDAWhereBuilder)

Adds a new unary condition to the WHERE clause.

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

Parameters:

  • anExpression: expression
  • anOp: operator

Params    (declared in TDAWhereBuilder)

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

property Params: TDAParamCollection read write

ReadFromXml  protected override

Virtual protected function that reads the specified statement from the XML file. The xr contains the complete information about the TDASelectWhereBuilder object in XML format.
If the XML node xr does not contain the initial node select, the method raises an exception.

function ReadFromXml(xr: IXmlNode): TDAWhereExpression

Parameters:

  • xr: Contains the complete information about the TDASelectWhereBuilder object in XML format.

TableName

Represents the table name that is used in the SELECT statement of the current object.

property TableName: string read write

WriteToXml  protected override

Writes Where expression to XML node

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

Parameters:

  • sw: node
  • aExpression: expression

Xml    (declared in TDAWhereBuilder)

Represent Where expressions as XML node.

property Xml: UnicodeString read write

XMLToExpression    (declared in TDAWhereBuilder)

Reads Where expression from XML

function XMLToExpression(const aXML: UnicodeString): TDAWhereExpression

Parameters:

  • aXML: given XML

 

ColumnMapping    (declared in TDAWhereBuilder)

Column mapping.

property ColumnMapping: TDAColumnMappingCollection read write

Expression    (declared in TDAWhereBuilder)

Represents Where expressions.

property Expression: TDAWhereExpression read write

FieldCount

Represents the count of items in the collection Fields.

property FieldCount: Integer read write

Fields

Represents the collection of fields in the SELECT statement of the current object.

property Fields[i: Integer]: TDASelectWhereItem read write

Params    (declared in TDAWhereBuilder)

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

property Params: TDAParamCollection read write

TableName

Represents the table name that is used in the SELECT statement of the current object.

property TableName: string read write

Xml    (declared in TDAWhereBuilder)

Represent Where expressions as XML node.

property Xml: UnicodeString read write

 

constructor Create

Creates a new instance.

constructor Create

AddField

Adds a new specified field aField to the collection Fields.

function AddField(aField: TDASelectWhereItem): Integer

Parameters:

  • aField: Specified field

Clear    (declared in TDAWhereBuilder)

Clears all properties.

procedure Clear

DeleteField

Deletes the field with the specified index from the collection Fields.

procedure DeleteField(index: Integer)

Parameters:

  • index: Specified index

ExpressionToXmlNode    (declared in TDAWhereBuilder)

Converts TDAWhereExpression to XML node

function ExpressionToXmlNode(const aExpression: TDAWhereExpression): IXMLNode

Parameters:

  • aExpression: expression

IsEmpty    (declared in TDAWhereBuilder)

Returns True is Expression is empty.

function IsEmpty: Boolean

NewBetweenExpression (string, string, TDAWhereExpression, TDAWhereExpression): TDAWhereExpression  overload    (declared in TDAWhereBuilder)

Adds a new BETWEEN condition to the WHERE clause:

aExprTableName.aExprFieldName BETWEEN aLower AND aUpper
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    (declared in TDAWhereBuilder)

Adds a new BETWEEN condition to the WHERE clause:

aExprTableName.aExprFieldName BETWEEN aLower AND aUpper
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

NewBetweenExpression (TDAWhereExpression, TDAWhereExpression, TDAWhereExpression): TDAWhereExpression  overload    (declared in TDAWhereBuilder)

Adds a new BETWEEN condition to the WHERE clause:

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

Parameters:

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

NewBinaryExpression (string, string, string, TDADataType, TDABinaryOperator): TDAWhereExpression  overload    (declared in TDAWhereBuilder)

Adds a new comparison condition to the WHERE clause

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

Parameters:

  • aTableName: table name
  • aFieldName: field name
  • aParameterName: parameter name
  • aParameterType: parameter type
  • anOp: operator

NewBinaryExpression (string, string, TDABinaryOperator, variant): TDAWhereExpression  overload    (declared in TDAWhereBuilder)

Adds a new comparison condition to the WHERE clause

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

Parameters:

  • aTableName: table name
  • aFieldName: field name
  • anOp: operator
  • aValue: constant value

NewBinaryExpression (string, string, TDABinaryOperator, variant, TDADataType): TDAWhereExpression  overload    (declared in TDAWhereBuilder)

Adds a new comparison condition to the WHERE clause

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

Parameters:

  • aTableName: table name
  • aFieldName: field name
  • anOp: operator
  • aValue: constant value
  • aType: data type

NewBinaryExpression (TDAWhereExpression, TDABinaryOperator, variant): TDAWhereExpression  overload    (declared in TDAWhereBuilder)

Adds a new comparison condition to the WHERE clause

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

Parameters:

  • aLeft: left expression
  • anOp: operator
  • aValue: constant value

NewBinaryExpression (TDAWhereExpression, TDABinaryOperator, variant, TDADataType): TDAWhereExpression  overload    (declared in TDAWhereBuilder)

Adds a new comparison condition to the WHERE clause

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

Parameters:

  • aLeft: left expression
  • anOp: operator
  • aValue: constant value
  • aType: data type

NewBinaryExpression (TDAWhereExpression, TDAWhereExpression, TDABinaryOperator): TDAWhereExpression  overload    (declared in TDAWhereBuilder)

Adds a new comparison condition to the WHERE clause

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

Parameters:

  • aLeft: left expression
  • aRight: right expression
  • anOp: operator

NewBinaryExpressionList    (declared in TDAWhereBuilder)

Adds a new condition to the WHERE clause

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

Parameters:

  • aExpressions: list of expressions
  • anOp: operator

NewConstant (Variant): TDAWhereExpression  overload    (declared in TDAWhereBuilder)

Adds a new constant condition to the WHERE clause.

function NewConstant(const aValue: Variant): TDAWhereExpression

Parameters:

  • aValue: value

NewConstant (Variant, TDADataType): TDAWhereExpression  overload    (declared in TDAWhereBuilder)

Adds a new constant condition to the WHERE clause.

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

Parameters:

  • aValue: value
  • aType: value type

NewField    (declared in TDAWhereBuilder)

Adds a new field condition to the WHERE clause.

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

Parameters:

  • aTableName: table name
  • aFieldName: field name

NewIsNotNull  overload    (declared in TDAWhereBuilder)

Adds a new NOT NULL condition to the WHERE clause.

function NewIsNotNull: TDAWhereExpression

NewIsNotNull (string, string): TDAWhereExpression  overload    (declared in TDAWhereBuilder)

Adds a new NOT NULL condition to the WHERE clause:

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

Parameters:

  • aTableName: table name
  • aFieldName: field name

NewList    (declared in TDAWhereBuilder)

Adds a new list condition to the WHERE clause.

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

Parameters:

  • aValues: list of expressions

NewMacro (string): TDAWhereExpression  overload    (declared in TDAWhereBuilder)

Adds a new macro condition to the WHERE clause.

function NewMacro(const aName: string): TDAWhereExpression

Parameters:

  • aName: macro name

NewMacro (string, array of TDAWhereExpression): TDAWhereExpression  overload    (declared in TDAWhereBuilder)

Adds a new macro condition to the WHERE clause.

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

Parameters:

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

NewNull    (declared in TDAWhereBuilder)

Adds a NULL condition to the WHERE clause.

function NewNull: TDAWhereExpression

NewParameter    (declared in TDAWhereBuilder)

Adds a new parameter condition to the WHERE clause.

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

Parameters:

  • aParameterName: parameter name
  • aParameterType: parameter type

NewUnaryExpression    (declared in TDAWhereBuilder)

Adds a new unary condition to the WHERE clause.

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

Parameters:

  • anExpression: expression
  • anOp: operator

ReadFromXml  protected override

Virtual protected function that reads the specified statement from the XML file. The xr contains the complete information about the TDASelectWhereBuilder object in XML format.
If the XML node xr does not contain the initial node select, the method raises an exception.

function ReadFromXml(xr: IXmlNode): TDAWhereExpression

Parameters:

  • xr: Contains the complete information about the TDASelectWhereBuilder object in XML format.

WriteToXml  protected override

Writes Where expression to XML node

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

Parameters:

  • sw: node
  • aExpression: expression

XMLToExpression    (declared in TDAWhereBuilder)

Reads Where expression from XML

function XMLToExpression(const aXML: UnicodeString): TDAWhereExpression

Parameters:

  • aXML: given XML

See Also