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

ObjectNameNode ViewName [get, private set]
 
bool ReplaceIfExists [get, private set]
 
IEnumerable< string > ColumnNames [get, private set]
 
SqlQueryExpressionNode QueryExpression [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 GetColumnList (ISqlNode node)
 

Additional Inherited Members

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

Detailed Description

Definition at line 26 of file CreateViewNode.cs.

Member Function Documentation

override void Deveel.Data.Sql.Parser.CreateViewNode.BuildStatement ( StatementBuilder  builder)
inlineprotectedvirtual

Implements Deveel.Data.Sql.Parser.SqlStatementNode.

Definition at line 63 of file CreateViewNode.cs.

63  {
64  var queryExpression = (SqlQueryExpression)ExpressionBuilder.Build(QueryExpression);
65  var statement = new CreateViewStatement(ViewName.Name, ColumnNames, queryExpression);
66  builder.Statements.Add(statement);
67  }
SqlQueryExpressionNode QueryExpression
string Name
The full object name as composed from the input SQL string analyzed.
void Deveel.Data.Sql.Parser.CreateViewNode.GetColumnList ( ISqlNode  node)
inlineprivate

Definition at line 50 of file CreateViewNode.cs.

50  {
51  var columnListNode = node.ChildNodes.FirstOrDefault();
52  if (columnListNode == null)
53  return;
54 
55  var columnNames = (columnListNode.ChildNodes.Where(childNode => childNode.NodeName.Equals("column_name"))
56  .Select(childNode => childNode.ChildNodes.FirstOrDefault())
57  .Where(columnName => columnName != null && columnName is IdentifierNode)
58  .Select(columnName => ((IdentifierNode) columnName).Text)).ToList();
59 
60  ColumnNames = columnNames.AsEnumerable();
61  }
override ISqlNode Deveel.Data.Sql.Parser.CreateViewNode.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 35 of file CreateViewNode.cs.

35  {
36  if (node.NodeName == "column_list_opt") {
37  GetColumnList(node);
38  } else if (node.NodeName == "or_replace_opt") {
39  if (node.ChildNodes.Any())
40  ReplaceIfExists = true;
41  } else if (node is ObjectNameNode) {
42  ViewName = (ObjectNameNode) node;
43  } else if (node is SqlQueryExpressionNode) {
44  QueryExpression = (SqlQueryExpressionNode) node;
45  }
46 
47  return base.OnChildNode(node);
48  }
SqlQueryExpressionNode QueryExpression
override ISqlNode OnChildNode(ISqlNode node)
During the initialization of the node from the parser, this method is called for every child node add...

Property Documentation

IEnumerable<string> Deveel.Data.Sql.Parser.CreateViewNode.ColumnNames
getprivate set

Definition at line 31 of file CreateViewNode.cs.

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

Definition at line 33 of file CreateViewNode.cs.

bool Deveel.Data.Sql.Parser.CreateViewNode.ReplaceIfExists
getprivate set

Definition at line 29 of file CreateViewNode.cs.

ObjectNameNode Deveel.Data.Sql.Parser.CreateViewNode.ViewName
getprivate set

Definition at line 27 of file CreateViewNode.cs.


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