BinaryExpression

Overview

The BinaryExpression class implements BinaryExpression class and represents logical operations like And, Or, Greater Than etc.

Like other classes derived from WhereExpression, this one is used to represent conditions in Data Abstract data requests.

For example, the WHERE clause in this query:

SELECT * FROM Employees WHERE (ID=42)

can be transformed to:

WhereExpression where = new BinaryExpression(
                          new FieldExpression("ID"), 
                          new ConstantExpression(42), 
                          BinaryOperator.Equal);

Location


 

constructor

Creates a new instance of the BinaryExpression class.

 

constructor

 

BinaryExpression()

Creates a new instance of the BinaryExpression class with provided left and right expressions and the specified operator.

 

constructor(aLeft: WhereExpression; aRight: WhereExpression; anOperator: BinaryOperator)

 

BinaryExpression(WhereExpression aLeft, WhereExpression aRight, BinaryOperator anOperator)

Parameters:

  • aLeft: The left operand of the binary expression.
  • aRight: The right operand of the binary expression.
  • anOperator: The specified operator.

constructor (WhereExpression, Object, BinaryOperator)

Helper constructor that creates binary expression, with the one part as a constant (i.e. where "age" > 21).

 

constructor(aLeft: WhereExpression; aValue: Object; anOperator: BinaryOperator)

 

BinaryExpression(WhereExpression aLeft, Object aValue, BinaryOperator anOperator)

Parameters:

  • aLeft: The left operand of the binary expression.
  • aValue: The constant that will wrapped with a constant expression and placed as right operand.
  • anOperator: The specified operator.

Creates a new BinaryExpression from the given aLeft and aRight operands using BinaryOperator.

 

class method combine(aLeft: WhereExpression; aRight: WhereExpression): WhereExpression

 

static WhereExpression combine(WhereExpression aLeft, WhereExpression aRight)

Parameters:

  • aLeft: The left operand to be combined.
  • aRight: The right operand to be combined.

Creates a new BinaryExpression from the given aLeft and aRight operands using the given operator.

 

class method combine(aLeft: WhereExpression; aRight: WhereExpression; anOperator: BinaryOperator): WhereExpression

 

static WhereExpression combine(WhereExpression aLeft, WhereExpression aRight, BinaryOperator anOperator)

Parameters:

  • aLeft: The left operand to be combined.
  • aRight: The right operand to be combined.
  • anOperator: The operator to be used in combining.

fromString    (declared in WhereExpression)

Creates a new WhereExpression from the specified string, which should contain XML node in the correct Dynamic Where XML Format.

 

class method fromString(anXml: String): WhereExpression

 

static WhereExpression fromString(String anXml)

Parameters:

  • anXml: The given XML string.

fromStringToSql    (declared in WhereExpression)

A helper method to convert a XML string into SQL string.

 

class method fromStringToSql(anXml: String): String

 

static String fromStringToSql(String anXml)

Parameters:

  • anXml: The XML string to be converted.

fromXmlNode    (declared in WhereExpression)

Creates a new WhereExpression from the given XML node, which should be in the correct Dynamic Where XML Format.

 

class method fromXmlNode(aNode: Node): WhereExpression

 

static WhereExpression fromXmlNode(Node aNode)

Parameters:

  • aNode: The XML node to be parsed.

Kind

Gets the type of the expression. For the current class, the type is WhereKind.Binary

 

property Kind: WhereKind read;

 

WhereKind Kind { __get; }

Left

The left side of the binary expression.

 

property Left: WhereExpression read write;

 

WhereExpression Left { __get; __set; }

Operator

Represents the binary operator. It can be: addition, and, divide, =, >, in, <, <=, like, multiply, <>, or, subtraction, xor. Available types of BinaryExpression are defined by the BinaryOperator.

 

property Operator: BinaryOperator read write;

 

BinaryOperator Operator { __get; __set; }

parseExpression    (declared in WhereExpression)

Creates new Where expression from XML node.

 

class method parseExpression(node: Node): WhereExpression

 

static WhereExpression parseExpression(Node node)

Parameters:

  • node: XML node

readFromXml

Initializes the current expression from the given XML node.

 

method readFromXml(aNode: Node)

 

void readFromXml(Node aNode)

Parameters:

  • aNode: The XML node to be parsed.

The right side of the expression.

 

property Right: WhereExpression read write;

 

WhereExpression Right { __get; __set; }

toSqlString    (declared in WhereExpression)

Creates an SQL representation of the current where expression instance

 

method toSqlString: String

 

String toSqlString()

toSqlString (StringBuilder)

Creates an SQL representation of the current where expression instance and appends it to the provided StringBuilder.

 

method toSqlString(aDestination: StringBuilder)

 

void toSqlString(StringBuilder aDestination)

Parameters:

  • aDestination: The destination string builder to be appended.

toString    (declared in WhereExpression)

Returns a SQL string representation of the current expression.

 

method toString: String

 

String toString()

toXmlNode    (declared in WhereExpression)

Creates a query node (in the Dynamic Where XML Format) from the current expression.

 

method toXmlNode: Node

 

Node toXmlNode()

toXmlString    (declared in WhereExpression)

Creates the query node (in the Dynamic Where XML Format) from current expression and returns it in the string format.

 

method toXmlString: String

 

String toXmlString()

validate    (declared in WhereExpression)

Validates the current expression with the WhereValidator and returns TRUE if it contains no errors. The main purpose of the validation is to scan all objects of WhereExpession tree and make sure that they contain correct field names.

 

method validate: Boolean

 

Boolean validate()

validate (WhereExpression): Boolean    (declared in WhereExpression)

Validates the provided WhereExpression with the WhereValidator and returns TRUE if it contains no errors. The main purpose of the validation is to scan all objects of WhereExpession tree and make sure that it contains correct field names.

 

class method validate(anExpression: WhereExpression): Boolean

 

static Boolean validate(WhereExpression anExpression)

Parameters:

  • anExpression: The expression to be validated.

writeToXml

Creates where node (in the Dynamic Where XML Format) from expression.

 

method writeToXml(aNode: Node)

 

void writeToXml(Node aNode)

Parameters:

  • aNode: The given parent XML node.

 

Kind

Gets the type of the expression. For the current class, the type is WhereKind.Binary

 

property Kind: WhereKind read;

 

WhereKind Kind { __get; }

Left

The left side of the binary expression.

 

property Left: WhereExpression read write;

 

WhereExpression Left { __get; __set; }

Operator

Represents the binary operator. It can be: addition, and, divide, =, >, in, <, <=, like, multiply, <>, or, subtraction, xor. Available types of BinaryExpression are defined by the BinaryOperator.

 

property Operator: BinaryOperator read write;

 

BinaryOperator Operator { __get; __set; }

The right side of the expression.

 

property Right: WhereExpression read write;

 

WhereExpression Right { __get; __set; }

 

Creates a new BinaryExpression from the given aLeft and aRight operands using BinaryOperator.

 

class method combine(aLeft: WhereExpression; aRight: WhereExpression): WhereExpression

 

static WhereExpression combine(WhereExpression aLeft, WhereExpression aRight)

Parameters:

  • aLeft: The left operand to be combined.
  • aRight: The right operand to be combined.

Creates a new BinaryExpression from the given aLeft and aRight operands using the given operator.

 

class method combine(aLeft: WhereExpression; aRight: WhereExpression; anOperator: BinaryOperator): WhereExpression

 

static WhereExpression combine(WhereExpression aLeft, WhereExpression aRight, BinaryOperator anOperator)

Parameters:

  • aLeft: The left operand to be combined.
  • aRight: The right operand to be combined.
  • anOperator: The operator to be used in combining.

fromString    (declared in WhereExpression)

Creates a new WhereExpression from the specified string, which should contain XML node in the correct Dynamic Where XML Format.

 

class method fromString(anXml: String): WhereExpression

 

static WhereExpression fromString(String anXml)

Parameters:

  • anXml: The given XML string.

fromStringToSql    (declared in WhereExpression)

A helper method to convert a XML string into SQL string.

 

class method fromStringToSql(anXml: String): String

 

static String fromStringToSql(String anXml)

Parameters:

  • anXml: The XML string to be converted.

fromXmlNode    (declared in WhereExpression)

Creates a new WhereExpression from the given XML node, which should be in the correct Dynamic Where XML Format.

 

class method fromXmlNode(aNode: Node): WhereExpression

 

static WhereExpression fromXmlNode(Node aNode)

Parameters:

  • aNode: The XML node to be parsed.

parseExpression    (declared in WhereExpression)

Creates new Where expression from XML node.

 

class method parseExpression(node: Node): WhereExpression

 

static WhereExpression parseExpression(Node node)

Parameters:

  • node: XML node

validate (WhereExpression): Boolean    (declared in WhereExpression)

Validates the provided WhereExpression with the WhereValidator and returns TRUE if it contains no errors. The main purpose of the validation is to scan all objects of WhereExpession tree and make sure that it contains correct field names.

 

class method validate(anExpression: WhereExpression): Boolean

 

static Boolean validate(WhereExpression anExpression)

Parameters:

  • anExpression: The expression to be validated.

 

constructor

Creates a new instance of the BinaryExpression class.

 

constructor

 

BinaryExpression()

Creates a new instance of the BinaryExpression class with provided left and right expressions and the specified operator.

 

constructor(aLeft: WhereExpression; aRight: WhereExpression; anOperator: BinaryOperator)

 

BinaryExpression(WhereExpression aLeft, WhereExpression aRight, BinaryOperator anOperator)

Parameters:

  • aLeft: The left operand of the binary expression.
  • aRight: The right operand of the binary expression.
  • anOperator: The specified operator.

constructor (WhereExpression, Object, BinaryOperator)

Helper constructor that creates binary expression, with the one part as a constant (i.e. where "age" &gt; 21).

 

constructor(aLeft: WhereExpression; aValue: Object; anOperator: BinaryOperator)

 

BinaryExpression(WhereExpression aLeft, Object aValue, BinaryOperator anOperator)

Parameters:

  • aLeft: The left operand of the binary expression.
  • aValue: The constant that will wrapped with a constant expression and placed as right operand.
  • anOperator: The specified operator.

readFromXml

Initializes the current expression from the given XML node.

 

method readFromXml(aNode: Node)

 

void readFromXml(Node aNode)

Parameters:

  • aNode: The XML node to be parsed.

toSqlString    (declared in WhereExpression)

Creates an SQL representation of the current where expression instance

 

method toSqlString: String

 

String toSqlString()

toSqlString (StringBuilder)

Creates an SQL representation of the current where expression instance and appends it to the provided StringBuilder.

 

method toSqlString(aDestination: StringBuilder)

 

void toSqlString(StringBuilder aDestination)

Parameters:

  • aDestination: The destination string builder to be appended.

toString    (declared in WhereExpression)

Returns a SQL string representation of the current expression.

 

method toString: String

 

String toString()

toXmlNode    (declared in WhereExpression)

Creates a query node (in the Dynamic Where XML Format) from the current expression.

 

method toXmlNode: Node

 

Node toXmlNode()

toXmlString    (declared in WhereExpression)

Creates the query node (in the Dynamic Where XML Format) from current expression and returns it in the string format.

 

method toXmlString: String

 

String toXmlString()

validate    (declared in WhereExpression)

Validates the current expression with the WhereValidator and returns TRUE if it contains no errors. The main purpose of the validation is to scan all objects of WhereExpession tree and make sure that they contain correct field names.

 

method validate: Boolean

 

Boolean validate()

writeToXml

Creates where node (in the Dynamic Where XML Format) from expression.

 

method writeToXml(aNode: Node)

 

void writeToXml(Node aNode)

Parameters:

  • aNode: The given parent XML node.