private void Initial(string exp)
        {
            //string exp = "select itemname as  textcol_1,ordercycle  as longcol_1 from itemdata where itemno= p_form0000000083_m.userdefine_1;10;p_form0000000083_d";

            string[] s = exp.Split(';');

            string sql       = s[0];
            string action    = s[1];
            string tableName = s[2];

            this.Sql = sql;
            //处理sql语句
            TGSqlParser sqlparser = new TGSqlParser(TDbVendor.DbVMssql);

            sqlparser.SqlText.Text = sql;
            int i = sqlparser.Parse();

            if (i == 0)
            {
                WhereCondition w = new WhereCondition(sqlparser.SqlStatements[0].WhereClause);
                this.Right = w.getControlIds();
            }

            //处理action
            switch (action)
            {
            case "00": this.ActionType = Rule.Expression.ActionType.Override;
                break;

            case "01": this.ActionType = Rule.Expression.ActionType.Append;
                break;

            case "11": this.ActionType = Rule.Expression.ActionType.SelectAppend;
                break;

            case "10": this.ActionType = Rule.Expression.ActionType.SelectOverride;
                break;

            default: this.ActionType = Rule.Expression.ActionType.Append;
                break;
            }

            //处理表名
            this.TableName = tableName;

            //帮助的字段
            this.HelpFields = GetColumnAlia(sql);
        }
Exemplo n.º 2
0
        private void Initial(string exp)
        {
            //string exp = "p_form0000000083_m.textcol_1 = (select itemname from itemdata where itemno= p_form0000000083_m.userdefine_1 )";

            int    index = exp.IndexOf('=');
            string left  = exp.Substring(0, index);
            string right = exp.Substring(index + 1);

            this.Left.Add(left);
            //List<string> ls = null;
            TGSqlParser sqlparser = new TGSqlParser(TDbVendor.DbVMssql);

            sqlparser.SqlText.Text = right;
            int i = sqlparser.Parse();

            if (i == 0)
            {
                WhereCondition w = new WhereCondition(sqlparser.SqlStatements[0].WhereClause);
                //ls = w.getControlIds();
                this.Right = w.getControlIds();
            }
        }