Пример #1
0
        public SelectColumn(TreeNode node)
        {
            TreeNode nd;
            string   s;

            Name = TreeHelper.GetValue(node);
            if (Name == "*")
            {
                Column_name = "*";
                ColumnType  = SelectColumnType._column;
                return;
            }
            nd = node.Nodes[0];
            nd = nd.Nodes[0];
            //while (nd != null)
            {
                s = (TreeHelper.GetRuleName(nd));
                switch (s)
                {
                case "Column_name": Column_name = TreeHelper.GetValue(nd); ColumnType = SelectColumnType._column; break;

                case "Function_name":
                {
                    string ss = TreeHelper.GetValue(nd.Parent);
                    ss            = ss.Substring(0, ss.IndexOf("("));
                    Function_name = ss;
                    ColumnType    = SelectColumnType._function;
                    Column_name   = ss + GetHashCode();
                    Expr          = TreeHelper.GetValue(nd.Parent);
                    break;
                }

                case "Expr":
                {
                    Expr        = TreeHelper.GetValue(nd.Parent); ColumnType = SelectColumnType._expr;
                    Column_name = "Expr" + GetHashCode();
                    break;
                }

                default: break;
                }
                //nd = nd.NextNode;
            }
            nd = node.Nodes[0].NextNode;
            while (nd != null)
            {
                s = (TreeHelper.GetRuleName(nd));
                switch (s)
                {
                case "Column_alias": Column_alias = TreeHelper.GetValue(nd); break;

                default: break;
                }
                nd = nd.NextNode;
            }
        }
Пример #2
0
        public CreateTableColumn(TreeNode node)
        {
            TreeNode nd;
            string   s;

            Name        = TreeHelper.GetValue(node);
            nd          = node.Nodes[0];
            Column_name = TreeHelper.GetValue(nd);
            nd          = nd.NextNode;
            ColumnType  = TreeHelper.GetValue(nd).ToLower();
        }