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

The default implementation of ISqlNode, that is a node in the text analysis parsing of SQL commands. More...

Inheritance diagram for Deveel.Data.Sql.Parser.SqlNode:
Deveel.Data.Sql.Parser.ISqlNode Deveel.Data.Sql.Parser.AddColumnNode Deveel.Data.Sql.Parser.AddConstraintNode Deveel.Data.Sql.Parser.AlterColumnNode Deveel.Data.Sql.Parser.CaseSwitchNode Deveel.Data.Sql.Parser.ColumnConstraintNode Deveel.Data.Sql.Parser.CommitStatementNode Deveel.Data.Sql.Parser.CursorParameterNode Deveel.Data.Sql.Parser.DataTypeMetaNode Deveel.Data.Sql.Parser.DataTypeNode Deveel.Data.Sql.Parser.DeclareExceptionNode Deveel.Data.Sql.Parser.DeclarePragmaNode Deveel.Data.Sql.Parser.DropColumnNode Deveel.Data.Sql.Parser.DropConstraintNode Deveel.Data.Sql.Parser.DropCoulmnNode Deveel.Data.Sql.Parser.DropDefaultNode Deveel.Data.Sql.Parser.DropPrimaryKeyNode Deveel.Data.Sql.Parser.ExceptionHandlerNode Deveel.Data.Sql.Parser.FromClauseNode Deveel.Data.Sql.Parser.FromQuerySourceNode Deveel.Data.Sql.Parser.FromTableSourceNode Deveel.Data.Sql.Parser.GotoStatementNode Deveel.Data.Sql.Parser.GroupByNode Deveel.Data.Sql.Parser.IdentifiedByPasswordNode Deveel.Data.Sql.Parser.IdentifierNode Deveel.Data.Sql.Parser.InsertSetNode Deveel.Data.Sql.Parser.InsertValueNode Deveel.Data.Sql.Parser.IntegerLiteralNode Deveel.Data.Sql.Parser.JoinNode Deveel.Data.Sql.Parser.LabelNode Deveel.Data.Sql.Parser.LimitNode Deveel.Data.Sql.Parser.NumberLiteralNode Deveel.Data.Sql.Parser.ObjectNameNode Deveel.Data.Sql.Parser.OrderByNode Deveel.Data.Sql.Parser.PlSqlBlockNode Deveel.Data.Sql.Parser.PlSqlCodeBlockNode Deveel.Data.Sql.Parser.PrivilegeNode Deveel.Data.Sql.Parser.QueryCompositeNode Deveel.Data.Sql.Parser.QueryInsertNode Deveel.Data.Sql.Parser.QueryUpdateNode Deveel.Data.Sql.Parser.ReturnStatementNode Deveel.Data.Sql.Parser.RollbackStatementNode Deveel.Data.Sql.Parser.SelectItemNode Deveel.Data.Sql.Parser.SequenceOfStatementsNode Deveel.Data.Sql.Parser.SetAccountStatusNode Deveel.Data.Sql.Parser.SetDefaultNode Deveel.Data.Sql.Parser.SetGroupsNode Deveel.Data.Sql.Parser.SetInsertNode Deveel.Data.Sql.Parser.SetPasswordNode Deveel.Data.Sql.Parser.SimpleUpdateNode Deveel.Data.Sql.Parser.SqlBetweenExpressionNode Deveel.Data.Sql.Parser.SqlBinaryExpressionNode Deveel.Data.Sql.Parser.SqlCaseExpressionNode Deveel.Data.Sql.Parser.SqlConstantExpressionNode Deveel.Data.Sql.Parser.SqlExpressionTupleNode Deveel.Data.Sql.Parser.SqlFunctionCallExpressionNode Deveel.Data.Sql.Parser.SqlQueryExpressionNode Deveel.Data.Sql.Parser.SqlReferenceExpressionNode Deveel.Data.Sql.Parser.SqlStatementNode Deveel.Data.Sql.Parser.SqlUnaryExpressionNode Deveel.Data.Sql.Parser.SqlVariableRefExpressionNode Deveel.Data.Sql.Parser.StringLiteralNode Deveel.Data.Sql.Parser.TableColumnNode Deveel.Data.Sql.Parser.TableConstraintNode Deveel.Data.Sql.Parser.UpdateColumnNode Deveel.Data.Sql.Parser.ValuesInsertNode

Public Member Functions

 SqlNode ()
 

Protected Member Functions

virtual void OnNodeInit ()
 After the initialization of the node from the parser, this method is invoked to let the specific initialization to occur. More...
 
virtual 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...
 

Properties

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 IAstNodeInit. Init (AstContext context, ParseTreeNode parseNode)
 

Detailed Description

The default implementation of ISqlNode, that is a node in the text analysis parsing of SQL commands.

See also
ISqlNode

Definition at line 32 of file SqlNode.cs.

Constructor & Destructor Documentation

Deveel.Data.Sql.Parser.SqlNode.SqlNode ( )
inline

Definition at line 33 of file SqlNode.cs.

33  {
34  ChildNodes = new ReadOnlyCollection<ISqlNode>(new ISqlNode[0]);
35  Tokens = new ReadOnlyCollection<Token>(new Token[0]);
36  }
IEnumerable< Token > Tokens
Gets an immutable list of Token that represent the source of this node.
Definition: SqlNode.cs:63
IEnumerable< ISqlNode > ChildNodes
Gets an immutable list of nodes, children of the current node.
Definition: SqlNode.cs:55

Member Function Documentation

void IAstNodeInit. Deveel.Data.Sql.Parser.SqlNode.Init ( AstContext  context,
ParseTreeNode  parseNode 
)
inlineprivate

Definition at line 66 of file SqlNode.cs.

66  {
67  NodeName = parseNode.Term == null ? GetType().Name : parseNode.Term.Name;
68 
69  var tokens = new List<Token>();
70 
71  var iToken = parseNode.FindToken();
72  if (iToken != null) {
73  tokens.Add(new Token(iToken.Location.Column, iToken.Location.Line, iToken.Text, iToken.Value));
74  }
75 
76  var childNodes = new List<ISqlNode>();
77 
78  foreach (var childNode in parseNode.ChildNodes) {
79  ISqlNode child;
80  if (childNode.Term is KeyTerm) {
81  var childIToken = childNode.FindToken();
82  child = new SqlKeyNode(new Token(childIToken.Location.Column, childIToken.Location.Line, childIToken.Text, childIToken.Value));
83  } else {
84  child = (ISqlNode)childNode.AstNode;
85  }
86 
87  child = OnChildNode(child);
88 
89  if (child != null) {
90  if (child is ISqlChildNode)
91  (child as ISqlChildNode).SetParent(this);
92 
93  childNodes.Add(child);
94  tokens.AddRange(child.Tokens);
95  }
96  }
97 
98  ChildNodes = childNodes.ToArray();
99  Tokens = tokens.ToArray();
100 
101  OnNodeInit();
102  }
virtual ISqlNode OnChildNode(ISqlNode node)
During the initialization of the node from the parser, this method is called for every child node add...
Definition: SqlNode.cs:135
virtual void OnNodeInit()
After the initialization of the node from the parser, this method is invoked to let the specific init...
Definition: SqlNode.cs:124
IEnumerable< Token > Tokens
Gets an immutable list of Token that represent the source of this node.
Definition: SqlNode.cs:63
IEnumerable< ISqlNode > ChildNodes
Gets an immutable list of nodes, children of the current node.
Definition: SqlNode.cs:55
string NodeName
Gets the name of the node, as expressed in the SQL grammar.
Definition: SqlNode.cs:48
virtual ISqlNode Deveel.Data.Sql.Parser.SqlNode.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 in Deveel.Data.Sql.Parser.DataTypeNode, Deveel.Data.Sql.Parser.SqlQueryExpressionNode, Deveel.Data.Sql.Parser.JoinNode, Deveel.Data.Sql.Parser.SqlBinaryExpressionNode, Deveel.Data.Sql.Parser.TableConstraintNode, Deveel.Data.Sql.Parser.SqlBetweenExpressionNode, Deveel.Data.Sql.Parser.QueryCompositeNode, Deveel.Data.Sql.Parser.SqlCaseExpressionNode, Deveel.Data.Sql.Parser.SqlFunctionCallExpressionNode, Deveel.Data.Sql.Parser.ObjectNameNode, Deveel.Data.Sql.Parser.CaseSwitchNode, Deveel.Data.Sql.Parser.OrderByNode, Deveel.Data.Sql.Parser.FromQuerySourceNode, Deveel.Data.Sql.Parser.GroupByNode, Deveel.Data.Sql.Parser.SqlUnaryExpressionNode, Deveel.Data.Sql.Parser.FromClauseNode, Deveel.Data.Sql.Parser.SqlExpressionTupleNode, Deveel.Data.Sql.Parser.ColumnConstraintNode, Deveel.Data.Sql.Parser.FromTableSourceNode, Deveel.Data.Sql.Parser.SelectStatementNode, Deveel.Data.Sql.Parser.DeclareCursorNode, Deveel.Data.Sql.Parser.SqlConstantExpressionNode, Deveel.Data.Sql.Parser.InsertStatementNode, Deveel.Data.Sql.Parser.CreateViewNode, Deveel.Data.Sql.Parser.DeclareVariableNode, Deveel.Data.Sql.Parser.GrantStatementNode, Deveel.Data.Sql.Parser.SimpleUpdateNode, Deveel.Data.Sql.Parser.SqlReferenceExpressionNode, Deveel.Data.Sql.Parser.PrivilegeNode, Deveel.Data.Sql.Parser.SequenceOfStatementsNode, Deveel.Data.Sql.Parser.SqlVariableRefExpressionNode, Deveel.Data.Sql.Parser.AlterTableNode, Deveel.Data.Sql.Parser.GrantRoleStatementNode, Deveel.Data.Sql.Parser.OpenCursorStatementNode, Deveel.Data.Sql.Parser.QueryUpdateNode, Deveel.Data.Sql.Parser.UpdateStatementNode, Deveel.Data.Sql.Parser.ExceptionHandlerNode, Deveel.Data.Sql.Parser.BreakStatementNode, Deveel.Data.Sql.Parser.ContinueStatementNode, Deveel.Data.Sql.Parser.ExitStatementNode, Deveel.Data.Sql.Parser.PlSqlBlockNode, Deveel.Data.Sql.Parser.UpdateColumnNode, Deveel.Data.Sql.Parser.CreateUserStatementNode, Deveel.Data.Sql.Parser.PlSqlCodeBlockNode, Deveel.Data.Sql.Parser.AlterUserStatementNode, Deveel.Data.Sql.Parser.InsertSetNode, Deveel.Data.Sql.Parser.DataTypeMetaNode, Deveel.Data.Sql.Parser.DeclarePragmaNode, Deveel.Data.Sql.Parser.RaiseStatementNode, Deveel.Data.Sql.Parser.SetDefaultNode, Deveel.Data.Sql.Parser.ValuesInsertNode, Deveel.Data.Sql.Parser.AddColumnNode, Deveel.Data.Sql.Parser.AddConstraintNode, Deveel.Data.Sql.Parser.AlterColumnNode, Deveel.Data.Sql.Parser.CreateSequenceNode, Deveel.Data.Sql.Parser.DeclareExceptionNode, Deveel.Data.Sql.Parser.DropColumnNode, Deveel.Data.Sql.Parser.DropConstraintNode, Deveel.Data.Sql.Parser.DropCoulmnNode, Deveel.Data.Sql.Parser.DropDefaultNode, Deveel.Data.Sql.Parser.GotoStatementNode, Deveel.Data.Sql.Parser.IdentifiedByPasswordNode, Deveel.Data.Sql.Parser.LabelNode, Deveel.Data.Sql.Parser.QueryInsertNode, Deveel.Data.Sql.Parser.ReturnStatementNode, Deveel.Data.Sql.Parser.SetAccountStatusNode, Deveel.Data.Sql.Parser.SetPasswordNode, Deveel.Data.Sql.Parser.FetchStatementNode, Deveel.Data.Sql.Parser.CreateSchemaNode, and Deveel.Data.Sql.Parser.DropSchemaStatementNode.

Definition at line 135 of file SqlNode.cs.

135  {
136  return node;
137  }
virtual void Deveel.Data.Sql.Parser.SqlNode.OnNodeInit ( )
inlineprotectedvirtual

Property Documentation

IEnumerable<ISqlNode> Deveel.Data.Sql.Parser.SqlNode.ChildNodes
getprivate setprotected

Gets an immutable list of nodes, children of the current node.

See also
ISqlNode.ChildNodes

Definition at line 55 of file SqlNode.cs.

IEnumerable<ISqlNode> ISqlNode. Deveel.Data.Sql.Parser.SqlNode.ChildNodes
getprivate

Definition at line 112 of file SqlNode.cs.

string Deveel.Data.Sql.Parser.SqlNode.NodeName
getprivate setprotected

Gets the name of the node, as expressed in the SQL grammar.

See also
ISqlNode.NodeName

Definition at line 48 of file SqlNode.cs.

string ISqlNode. Deveel.Data.Sql.Parser.SqlNode.NodeName
getprivate

Definition at line 104 of file SqlNode.cs.

ISqlNode Deveel.Data.Sql.Parser.SqlNode.Parent
getprivate setprotected

Gets the parent of the current node.

See also
ISqlNode.Parent

Definition at line 42 of file SqlNode.cs.

ISqlNode ISqlNode. Deveel.Data.Sql.Parser.SqlNode.Parent
getprivate

Definition at line 108 of file SqlNode.cs.

IEnumerable<Token> Deveel.Data.Sql.Parser.SqlNode.Tokens
getprivate setprotected

Gets an immutable list of Token that represent the source of this node.

See also
Token, ISqlNode.Tokens

Definition at line 63 of file SqlNode.cs.

IEnumerable<Token> ISqlNode. Deveel.Data.Sql.Parser.SqlNode.Tokens
getprivate

Definition at line 116 of file SqlNode.cs.


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