Esempio n. 1
0
 private void GetOrderBy(ISqlNode node)
 {
     var listNode =  node.FindByName("sorted_def_list");
     if (listNode != null) {
         OrderBy = listNode.ChildNodes.Cast<OrderByNode>();
     }
 }
Esempio n. 2
0
        private void GetOrderBy(ISqlNode node)
        {
            var listNode = node.FindByName("sorted_def_list");

            if (listNode != null)
            {
                OrderBy = listNode.ChildNodes.Cast <OrderByNode>();
            }
        }
Esempio n. 3
0
        private void GetUserType(ISqlNode node)
        {
            IsPrimitive = false;
            TypeName    = node.FindNode <ObjectNameNode>().Name;
            var optMetaList = node.FindByName("user_type_meta_opt");

            if (optMetaList != null)
            {
                GetMeta(optMetaList.ChildNodes.FirstOrDefault());
            }
        }
Esempio n. 4
0
        public static bool HasOptionalNode(this ISqlNode node, string nodeName)
        {
            var foundNode = node.FindByName(nodeName);

            if (foundNode == null)
            {
                return(false);
            }

            return(foundNode.ChildNodes.Any());
        }
Esempio n. 5
0
        public static TNode FindNodeOf <TNode>(this ISqlNode node, string nodeName) where TNode : class, ISqlNode
        {
            var parent = node.FindByName(nodeName);

            if (parent == null)
            {
                return(null);
            }

            return(parent.FindNode <TNode>());
        }
Esempio n. 6
0
        private void GetIsolationLevel(ISqlNode node)
        {
            var levelType = node.FindByName("level_type");

            if (levelType == null)
            {
                throw new SqlParseException("Cannot find the isolation level");
            }

            var keys = levelType.ChildNodes.OfType <SqlKeyNode>().Select(x => x.Text).ToArray();

            Value = String.Join(" ", keys);
        }
Esempio n. 7
0
        private void GetReadAccess(ISqlNode node)
        {
            var accessType = node.FindByName("access_type");

            if (accessType == null)
            {
                throw new SqlParseException("Cannot find the read access type.");
            }

            var keys = accessType.ChildNodes.OfType <SqlKeyNode>().Select(x => x.Text).ToArray();

            Value = String.Join(" ", keys);
        }
        private void GetArguments(ISqlNode node)
        {
            var listNode = node.FindByName("arg_list");
            if (listNode == null)
                return;

            var args = new List<IExpressionNode>();

            foreach (var childNode in listNode.ChildNodes) {
                if (childNode is IExpressionNode)
                    args.Add((IExpressionNode)childNode);
            }

            Arguments = args.AsEnumerable();
        }
Esempio n. 9
0
        protected override ISqlNode OnChildNode(ISqlNode node)
        {
            if (node is ObjectNameNode) {
                TableName = ((ObjectNameNode) node).Name;
            } else if (node.NodeName.Equals("insert_source")) {
                var colNode = node.FindByName("column_list_opt");
                if (colNode != null)
                    ColumnNames = colNode.FindNodes<IdentifierNode>().Select(x => x.Text);

                ValuesInsert = node.FindNode<ValuesInsertNode>();
                SetInsert = node.FindNode<SetInsertNode>();
                QueryInsert = node.FindNode<QueryInsertNode>();
            }

            return base.OnChildNode(node);
        }
Esempio n. 10
0
        private void GetArguments(ISqlNode node)
        {
            var listNode = node.FindByName("arg_list");

            if (listNode == null)
            {
                return;
            }

            var args = new List <IExpressionNode>();

            foreach (var childNode in listNode.ChildNodes)
            {
                if (childNode is IExpressionNode)
                {
                    args.Add((IExpressionNode)childNode);
                }
            }

            Arguments = args.AsEnumerable();
        }
Esempio n. 11
0
        protected override ISqlNode OnChildNode(ISqlNode node)
        {
            if (node is ObjectNameNode)
            {
                TableName = ((ObjectNameNode)node).Name;
            }
            else if (node.NodeName.Equals("insert_source"))
            {
                var colNode = node.FindByName("column_list_opt");
                if (colNode != null)
                {
                    ColumnNames = colNode.FindNodes <IdentifierNode>().Select(x => x.Text);
                }

                ValuesInsert = node.FindNode <ValuesInsertNode>();
                SetInsert    = node.FindNode <SetInsertNode>();
                QueryInsert  = node.FindNode <QueryInsertNode>();
            }

            return(base.OnChildNode(node));
        }
Esempio n. 12
0
 private void GetUserType(ISqlNode node)
 {
     IsPrimitive = false;
     TypeName = node.FindNode<ObjectNameNode>().Name;
     var optMetaList = node.FindByName("user_type_meta_opt");
     if (optMetaList != null) {
         GetMeta(optMetaList.ChildNodes.FirstOrDefault());
     }
 }