DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Protected Member Functions | Properties | Private Member Functions | List of all members
Deveel.Data.Sql.Parser.SelectStatementNode Class Reference
Inheritance diagram for Deveel.Data.Sql.Parser.SelectStatementNode:
Deveel.Data.Sql.Parser.SqlStatementNode Deveel.Data.Sql.Parser.SqlNode Deveel.Data.Sql.Parser.ISqlVisitableNode Deveel.Data.Sql.Parser.IStatementNode Deveel.Data.Sql.Parser.ISqlNode 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...
 
override void BuildStatement (StatementBuilder builder)
 
- 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

SqlQueryExpressionNode QueryExpression [get, private set]
 
IEnumerable< OrderByNodeOrderBy [get, private set]
 Gets a read-oly list of order criteria for sorting the results of the query. More...
 
LimitNode Limit [get, private set]
 
- 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 GetOrderBy (ISqlNode node)
 
void GetLimit (ISqlNode node)
 
IEnumerable< SortColumnBuildOrderBy (IEnumerable< OrderByNode > nodes)
 
QueryLimit BuildLimit (LimitNode node)
 

Additional Inherited Members

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

Detailed Description

Definition at line 26 of file SelectStatementNode.cs.

Member Function Documentation

QueryLimit Deveel.Data.Sql.Parser.SelectStatementNode.BuildLimit ( LimitNode  node)
inlineprivate

Definition at line 83 of file SelectStatementNode.cs.

83  {
84  if (node == null)
85  return null;
86 
87  return new QueryLimit(node.Offset, node.Count);
88  }
IEnumerable<SortColumn> Deveel.Data.Sql.Parser.SelectStatementNode.BuildOrderBy ( IEnumerable< OrderByNode nodes)
inlineprivate

Definition at line 76 of file SelectStatementNode.cs.

76  {
77  if (nodes == null)
78  return null;
79 
80  return nodes.Select(node => new SortColumn(ExpressionBuilder.Build(node.Expression), node.Ascending));
81  }
override void Deveel.Data.Sql.Parser.SelectStatementNode.BuildStatement ( StatementBuilder  builder)
inlineprotectedvirtual

Implements Deveel.Data.Sql.Parser.SqlStatementNode.

Definition at line 63 of file SelectStatementNode.cs.

63  {
64  var queryExpression = (SqlQueryExpression) ExpressionBuilder.Build(QueryExpression);
65  if (QueryExpression.IntoClause != null) {
66  var refExp = ExpressionBuilder.Build(QueryExpression.IntoClause);
67  builder.Statements.Add(new SelectIntoStatement(queryExpression, refExp));
68  } else {
69  var orderBy = BuildOrderBy(OrderBy);
70  var statement = new SelectStatement(queryExpression, orderBy);
71  statement.Limit = BuildLimit(Limit);
72  builder.Statements.Add(statement);
73  }
74  }
IEnumerable< OrderByNode > OrderBy
Gets a read-oly list of order criteria for sorting the results of the query.
IEnumerable< SortColumn > BuildOrderBy(IEnumerable< OrderByNode > nodes)
void Deveel.Data.Sql.Parser.SelectStatementNode.GetLimit ( ISqlNode  node)
inlineprivate

Definition at line 57 of file SelectStatementNode.cs.

57  {
58  var child = node.ChildNodes.FirstOrDefault();
59  if (child != null)
60  Limit = (LimitNode) child;
61  }
void Deveel.Data.Sql.Parser.SelectStatementNode.GetOrderBy ( ISqlNode  node)
inlineprivate

Definition at line 50 of file SelectStatementNode.cs.

50  {
51  var listNode = node.FindByName("sorted_def_list");
52  if (listNode != null) {
53  OrderBy = listNode.ChildNodes.Cast<OrderByNode>();
54  }
55  }
IEnumerable< OrderByNode > OrderBy
Gets a read-oly list of order criteria for sorting the results of the query.
override ISqlNode Deveel.Data.Sql.Parser.SelectStatementNode.OnChildNode ( ISqlNode  node)
inlineprotectedvirtual

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

Parameters
nodeThe node being added to the list of children.
Returns
Returns a normalized version of the child node, or the node itself.

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

Definition at line 38 of file SelectStatementNode.cs.

38  {
39  if (node.NodeName == "sql_query_expression") {
40  QueryExpression = node as SqlQueryExpressionNode;
41  } else if (node.NodeName == "order_opt") {
42  GetOrderBy(node);
43  } else if (node.NodeName == "limit_opt") {
44  GetLimit(node);
45  }
46 
47  return base.OnChildNode(node);
48  }

Property Documentation

LimitNode Deveel.Data.Sql.Parser.SelectStatementNode.Limit
getprivate set

Definition at line 36 of file SelectStatementNode.cs.

IEnumerable<OrderByNode> Deveel.Data.Sql.Parser.SelectStatementNode.OrderBy
getprivate set

Gets a read-oly list of order criteria for sorting the results of the query.

See also
OrderByNode

Definition at line 34 of file SelectStatementNode.cs.

SqlQueryExpressionNode Deveel.Data.Sql.Parser.SelectStatementNode.QueryExpression
getprivate set

Definition at line 27 of file SelectStatementNode.cs.


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