DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Protected Member Functions | Properties | Private Member Functions | Private Attributes | List of all members
Deveel.Data.Sql.Parser.SqlBinaryExpressionNode Class Reference

Represents an expression that evaluates between two other expressions. More...

Inheritance diagram for Deveel.Data.Sql.Parser.SqlBinaryExpressionNode:
Deveel.Data.Sql.Parser.SqlNode Deveel.Data.Sql.Parser.IExpressionNode Deveel.Data.Sql.Parser.ISqlNode Deveel.Data.Sql.Parser.ISqlNode

Protected Member Functions

override ISqlNode OnChildNode (ISqlNode node)
 During the initialization of the node from the parser, this method is called for every child node added to ChildNodes More...
 
- Protected Member Functions inherited from Deveel.Data.Sql.Parser.SqlNode
virtual void OnNodeInit ()
 After the initialization of the node from the parser, this method is invoked to let the specific initialization to occur. More...
 

Properties

IExpressionNode Left [get, private set]
 Gets the left side argument of the expression. More...
 
IExpressionNode Right [get, private set]
 Gets the right side argument of the expression. More...
 
bool IsAll [get, private set]
 Gets a boolean value indicating if the expression is the special case of ALL. More...
 
bool IsAny [get, private set]
 Gets a boolean value indicating if the expression is the special case of ANY. More...
 
string Operator [get, private set]
 Gets the binary operator that will be used to evaluate the final result. More...
 
- Properties inherited from Deveel.Data.Sql.Parser.SqlNode
ISqlNode Parent [get, private set]
 Gets the parent of the current node. More...
 
string NodeName [get, private set]
 Gets the name of the node, as expressed in the SQL grammar. More...
 
IEnumerable< ISqlNodeChildNodes [get, private set]
 Gets an immutable list of nodes, children of the current node. More...
 
IEnumerable< TokenTokens [get, private set]
 Gets an immutable list of Token that represent the source of this node. More...
 
string ISqlNode. NodeName [get]
 
ISqlNode ISqlNode. Parent [get]
 
IEnumerable< ISqlNode > ISqlNode. ChildNodes [get]
 
IEnumerable< Token > ISqlNode. Tokens [get]
 
- Properties inherited from Deveel.Data.Sql.Parser.ISqlNode
string NodeName [get]
 Gets the name of the node analyzed from the parser. More...
 
ISqlNode Parent [get]
 Gets a reference to the parent ISqlNode, if any. More...
 
IEnumerable< ISqlNodeChildNodes [get]
 Gets a read-only enumeration of the children nodes, if any. More...
 
IEnumerable< TokenTokens [get]
 Gets an enumeration of the tokens composing the this node. More...
 

Private Member Functions

void GetOperator (ISqlNode node)
 
void GetLogicalOp (ISqlNode node)
 
void GetAnyAllOp (ISqlNode node)
 

Private Attributes

bool leftSeen
 

Additional Inherited Members

- Public Member Functions inherited from Deveel.Data.Sql.Parser.SqlNode
 SqlNode ()
 

Detailed Description

Represents an expression that evaluates between two other expressions.

Definition at line 25 of file SqlBinaryExpressionNode.cs.

Member Function Documentation

void Deveel.Data.Sql.Parser.SqlBinaryExpressionNode.GetAnyAllOp ( ISqlNode  node)
inlineprivate

Definition at line 100 of file SqlBinaryExpressionNode.cs.

100  {
101  var sb = new StringBuilder();
102  foreach (var childNode in node.ChildNodes) {
103  if (childNode is SqlKeyNode) {
104  var anyOrAll = ((SqlKeyNode) childNode).Text;
105  if (String.Equals(anyOrAll, "ALL", StringComparison.OrdinalIgnoreCase)) {
106  IsAll = true;
107  } else if (String.Equals(anyOrAll, "ANY", StringComparison.OrdinalIgnoreCase)) {
108  IsAny = true;
109  }
110  } else if (childNode.NodeName == "binary_op_simple") {
111  var op = childNode.ChildNodes.First();
112  sb.Append(((SqlKeyNode) op).Text);
113  }
114  }
115 
116  Operator = sb.ToString();
117  }
A long string in the system.
string Operator
Gets the binary operator that will be used to evaluate the final result.
bool IsAll
Gets a boolean value indicating if the expression is the special case of ALL.
bool IsAny
Gets a boolean value indicating if the expression is the special case of ANY.
void Deveel.Data.Sql.Parser.SqlBinaryExpressionNode.GetLogicalOp ( ISqlNode  node)
inlineprivate

Definition at line 88 of file SqlBinaryExpressionNode.cs.

88  {
89  var sb = new StringBuilder();
90  foreach (var childNode in node.ChildNodes) {
91  if (childNode is SqlKeyNode) {
92  sb.Append(((SqlKeyNode) childNode).Text);
93  sb.Append(" ");
94  }
95  }
96 
97  Operator = sb.ToString().Trim();
98  }
string Operator
Gets the binary operator that will be used to evaluate the final result.
void Deveel.Data.Sql.Parser.SqlBinaryExpressionNode.GetOperator ( ISqlNode  node)
inlineprivate

Definition at line 73 of file SqlBinaryExpressionNode.cs.

73  {
74  var childNode = node.ChildNodes.First();
75  if (childNode.NodeName == "binary_op_simple") {
76  var op = childNode.ChildNodes.First();
77  Operator = ((SqlKeyNode) op).Text;
78  } else if (childNode.NodeName == "logical_op") {
79  GetLogicalOp(childNode);
80  } else if (node.NodeName == "any_op" ||
81  node.NodeName == "all_op") {
82  GetAnyAllOp(childNode);
83  } else if (childNode.NodeName == "subquery_op") {
84  GetLogicalOp(childNode);
85  }
86  }
string Operator
Gets the binary operator that will be used to evaluate the final result.
override ISqlNode Deveel.Data.Sql.Parser.SqlBinaryExpressionNode.OnChildNode ( ISqlNode  node)
inlineprotectedvirtual

During the initialization of the node from the parser, this method is called for every child node added to ChildNodes

Reimplemented from Deveel.Data.Sql.Parser.SqlNode.

Definition at line 57 of file SqlBinaryExpressionNode.cs.

57  {
58  if (node is IExpressionNode) {
59  if (!leftSeen) {
60  Left = (IExpressionNode) node;
61  leftSeen = true;
62  } else {
63  Right = (IExpressionNode) node;
64  leftSeen = false;
65  }
66  } else if (node.NodeName == "binary_op") {
67  GetOperator(node);
68  }
69 
70  return base.OnChildNode(node);
71  }
IExpressionNode Right
Gets the right side argument of the expression.
IExpressionNode Left
Gets the left side argument of the expression.

Member Data Documentation

bool Deveel.Data.Sql.Parser.SqlBinaryExpressionNode.leftSeen
private

Definition at line 26 of file SqlBinaryExpressionNode.cs.

Property Documentation

bool Deveel.Data.Sql.Parser.SqlBinaryExpressionNode.IsAll
getprivate set

Gets a boolean value indicating if the expression is the special case of ALL.

Definition at line 42 of file SqlBinaryExpressionNode.cs.

bool Deveel.Data.Sql.Parser.SqlBinaryExpressionNode.IsAny
getprivate set

Gets a boolean value indicating if the expression is the special case of ANY.

Definition at line 48 of file SqlBinaryExpressionNode.cs.

IExpressionNode Deveel.Data.Sql.Parser.SqlBinaryExpressionNode.Left
getprivate set

Gets the left side argument of the expression.

Definition at line 31 of file SqlBinaryExpressionNode.cs.

string Deveel.Data.Sql.Parser.SqlBinaryExpressionNode.Operator
getprivate set

Gets the binary operator that will be used to evaluate the final result.

Definition at line 54 of file SqlBinaryExpressionNode.cs.

IExpressionNode Deveel.Data.Sql.Parser.SqlBinaryExpressionNode.Right
getprivate set

Gets the right side argument of the expression.

Definition at line 36 of file SqlBinaryExpressionNode.cs.


The documentation for this class was generated from the following file: