Пример #1
0
        protected override Command getCommand()
        {
            Command cmd = new Command(this.context);

            cmd.key    = getCommandID();
            cmd.paramS = this.paramS;

            StringBuilder sb = new StringBuilder(commandText);

            //1.替换schema
            {
                int idx = 0;
                while (true)
                {
                    idx = sb.IndexOf(DataFlagConfig.dbNameFlag[0], idx);
                    if (idx > 0)
                    {
                        sb.Replace(idx, idx + 1, context.getSchema());
                        idx++;
                    }
                    else
                    {
                        break;
                    }
                }
            }

            if (this.paramS.Count > 0)
            {
                int paIdx = 0; //参数位置
                int atIdx = 0; //? in sb位置//到此时已不再有?...(之前已转换为?)


                while (true)
                {
                    atIdx = sb.IndexOf(DataFlagConfig.paramReplaceFlag[0], atIdx);
                    if (atIdx > 0)
                    {
                        Variate temp = doGet(paIdx);
                        if (temp == null)
                        {
                            WeedConfig.logException(cmd, new WeedException("缺少参数"));
                        }

                        temp.setName("p" + paIdx);
                        sb.Replace(DataFlagConfig.paramReplaceFlag, DataFlagConfig.parameterHeadFlag + temp.getName(), atIdx, 1);

                        //atIdx+= strVal.Length;//增加替换后的长度
                        atIdx += temp.getName().Length + 1;
                        paIdx++;
                    }
                    else
                    {
                        break;
                    }
                }
            }

            cmd.text = sb.ToString();

            logCommandBuilt(cmd);

            return(cmd);
        }
Пример #2
0
 protected void doSet(Variate value)
 {
     paramS.Add(value);
 }