Example #1
0
        protected override void OnNodeInit()
        {
            Expression = ChildNodes.OfType<IExpressionNode>().FirstOrDefault();
            Name = ChildNodes.OfType<ObjectNameNode>().FirstOrDefault();

            var aliasNode = this.FindByName("select_as_opt");
            if (aliasNode != null)
                Alias = aliasNode.FindNode<IdentifierNode>();
        }
Example #2
0
        /// <inheritdoc/>
        protected override ISqlNode OnChildNode(ISqlNode node)
        {
            if (node is ObjectNameNode) {
                TableName = (ObjectNameNode)node;
            } else if (node.NodeName == "select_as_opt") {
                Alias = (IdentifierNode)node.ChildNodes.FirstOrDefault();
            }

            return base.OnChildNode(node);
        }
Example #3
0
        /// <inheritdoc/>
        protected override ISqlNode OnChildNode(ISqlNode node)
        {
            if (node is ObjectNameNode)
            {
                TableName = (ObjectNameNode)node;
            }
            else if (node.NodeName == "select_as_opt")
            {
                Alias = (IdentifierNode)node.ChildNodes.FirstOrDefault();
            }

            return(base.OnChildNode(node));
        }
Example #4
0
        protected override ISqlNode OnChildNode(ISqlNode node)
        {
            if (node.NodeName == "column_list_opt") {
                GetColumnList(node);
            } else if (node.NodeName == "or_replace_opt") {
                if (node.ChildNodes.Any())
                    ReplaceIfExists = true;
            } else if (node is ObjectNameNode) {
                ViewName = (ObjectNameNode) node;
            } else if (node is SqlQueryExpressionNode) {
                QueryExpression = (SqlQueryExpressionNode) node;
            }

            return base.OnChildNode(node);
        }
 /// <inheritdoc/>
 protected override ISqlNode OnChildNode(ISqlNode node)
 {
     Reference = (ObjectNameNode) node;
     return base.OnChildNode(node);
 }
        protected override ISqlNode OnChildNode(ISqlNode node)
        {
            if (node is SqlKeyNode) {
                var keyNode = (SqlKeyNode) node;
                if (String.Equals(keyNode.Text, "NULL", StringComparison.OrdinalIgnoreCase)) {
                    if (notSeen) {
                        ConstraintType = ConstraintTypeNames.NotNull;
                    } else {
                        ConstraintType = ConstraintTypeNames.Null;
                    }
                } else if (String.Equals(keyNode.Text, "NOT", StringComparison.OrdinalIgnoreCase)) {
                    notSeen = true;
                } else if (String.Equals(keyNode.Text, "REFERENCES", StringComparison.OrdinalIgnoreCase)) {
                    ConstraintType = ConstraintTypeNames.ForeignKey;
                } else if (String.Equals(keyNode.Text, "CHECK", StringComparison.OrdinalIgnoreCase)) {
                    ConstraintType = ConstraintTypeNames.Check;
                } else if (String.Equals(keyNode.Text, "PRIMARY", StringComparison.OrdinalIgnoreCase)) {
                    ConstraintType = ConstraintTypeNames.PrimaryKey;
                } else if (String.Equals(keyNode.Text, "UNIQUE", StringComparison.OrdinalIgnoreCase)) {
                    ConstraintType = ConstraintTypeNames.UniqueKey;
                }
            } else if (node is IExpressionNode) {
                CheckExpression = (IExpressionNode) node;
            } else if (node is ObjectNameNode) {
                if (!String.Equals(ConstraintType, ConstraintTypeNames.ForeignKey, StringComparison.OrdinalIgnoreCase))
                    throw new InvalidOperationException();

                ReferencedTable = ((ObjectNameNode) node);
            }

            return base.OnChildNode(node);
        }
Example #7
0
 /// <inheritdoc/>
 protected override ISqlNode OnChildNode(ISqlNode node)
 {
     Reference = (ObjectNameNode)node;
     return(base.OnChildNode(node));
 }