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

An SQL node describing an in-line CASE conditional expression. More...

Inheritance diagram for Deveel.Data.Sql.Parser.SqlCaseExpressionNode:
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...
 

Package Functions

 SqlCaseExpressionNode ()
 

Properties

IEnumerable< CaseSwitchNodeCaseSwitches [get, private set]
 Gets a read-only list of switches that will be evaluated to return the result of the expresion. More...
 
IExpressionNode ElseExpression [get, private set]
 Gets a fallback expression that will be evaluated if none of CaseSwitches is be evaluated. More...
 
IExpressionNode TestExpression [get, private set]
 Gets the main expression to be evaluated against the CaseSwitches 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 GetElse (ISqlNode node)
 
void GetWhenThenList (ISqlNode node)
 

Additional Inherited Members

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

Detailed Description

An SQL node describing an in-line CASE conditional expression.

Definition at line 25 of file SqlCaseExpressionNode.cs.

Constructor & Destructor Documentation

Deveel.Data.Sql.Parser.SqlCaseExpressionNode.SqlCaseExpressionNode ( )
inlinepackage

Definition at line 26 of file SqlCaseExpressionNode.cs.

26  {
27  }

Member Function Documentation

void Deveel.Data.Sql.Parser.SqlCaseExpressionNode.GetElse ( ISqlNode  node)
inlineprivate

Definition at line 63 of file SqlCaseExpressionNode.cs.

63  {
64  foreach (var childNode in node.ChildNodes) {
65  if (childNode is IExpressionNode) {
66  ElseExpression = (IExpressionNode) childNode;
67  break;
68  }
69  }
70  }
IExpressionNode ElseExpression
Gets a fallback expression that will be evaluated if none of CaseSwitches is be evaluated.
void Deveel.Data.Sql.Parser.SqlCaseExpressionNode.GetWhenThenList ( ISqlNode  node)
inlineprivate

Definition at line 72 of file SqlCaseExpressionNode.cs.

72  {
73  var switches = new List<CaseSwitchNode>();
74 
75  foreach (var childNode in node.ChildNodes) {
76  if (childNode is CaseSwitchNode)
77  switches.Add((CaseSwitchNode)childNode);
78  }
79 
80  CaseSwitches = switches.ToArray();
81  }
IEnumerable< CaseSwitchNode > CaseSwitches
Gets a read-only list of switches that will be evaluated to return the result of the expresion...
override ISqlNode Deveel.Data.Sql.Parser.SqlCaseExpressionNode.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 47 of file SqlCaseExpressionNode.cs.

47  {
48  if (node.NodeName == "case_test_expression_opt") {
49  if (node.ChildNodes.Any()) {
50  var exp = node.ChildNodes.First();
51  if (exp is IExpressionNode)
52  TestExpression = (IExpressionNode) exp;
53  }
54  } else if (node.NodeName == "case_when_then_list") {
55  GetWhenThenList(node);
56  } else if (node.NodeName == "case_else_opt") {
57  GetElse(node);
58  }
59 
60  return base.OnChildNode(node);
61  }
IExpressionNode TestExpression
Gets the main expression to be evaluated against the CaseSwitches

Property Documentation

IEnumerable<CaseSwitchNode> Deveel.Data.Sql.Parser.SqlCaseExpressionNode.CaseSwitches
getprivate set

Gets a read-only list of switches that will be evaluated to return the result of the expresion.

Definition at line 33 of file SqlCaseExpressionNode.cs.

IExpressionNode Deveel.Data.Sql.Parser.SqlCaseExpressionNode.ElseExpression
getprivate set

Gets a fallback expression that will be evaluated if none of CaseSwitches is be evaluated.

Definition at line 39 of file SqlCaseExpressionNode.cs.

IExpressionNode Deveel.Data.Sql.Parser.SqlCaseExpressionNode.TestExpression
getprivate set

Gets the main expression to be evaluated against the CaseSwitches

Definition at line 44 of file SqlCaseExpressionNode.cs.


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