18 using System.Collections.Generic;
21 namespace Deveel.Data.Sql.Parser {
27 public string Privilege {
get;
private set; }
29 public IEnumerable<string> Columns {
get;
private set; }
35 Privilege = ((SqlKeyNode) node).Text;
36 }
else if (node.
NodeName.Equals(
"update_priv")) {
38 GetPrivilegeWithColumns(node);
39 }
else if (node.
NodeName.Equals(
"select_priv")) {
41 GetPrivilegeWithColumns(node);
42 }
else if (node.
NodeName.Equals(
"reference_priv")) {
43 Privilege =
"REFERENCE";
44 GetPrivilegeWithColumns(node);
47 return base.OnChildNode(node);
51 foreach (var childNode
in node.ChildNodes) {
52 if (childNode.NodeName.Equals(
"column_list_opt"))
53 GetColumns(childNode);
58 var childNode = node.
ChildNodes.FirstOrDefault();
59 if (childNode == null)
62 var list =
new List<string>();
63 foreach (var idNode
in childNode.ChildNodes) {
65 list.Add(((IdentifierNode)idNode).Text);
68 Columns = list.AsEnumerable();
This is a simple identifier within a SQL grammar.
Defines the contract for nodes in an AST model for a SQL grammar analysis and parsing.
Represents a keyword found during the compilation of a source text.
string NodeName
Gets the name of the node analyzed from the parser.
void GetColumns(ISqlNode node)
void GetPrivilegeWithColumns(ISqlNode node)
IEnumerable< ISqlNode > ChildNodes
Gets a read-only enumeration of the children nodes, if any.
override ISqlNode OnChildNode(ISqlNode node)
During the initialization of the node from the parser, this method is called for every child node add...
The default implementation of ISqlNode, that is a node in the text analysis parsing of SQL commands...