Exemplo n.º 1
0
        protected static String ReplaceSql(string sql, object[] args)
        {
            StringBuilder text = new StringBuilder(sql);

            for (int startIndex = 0, argsIndex = 0; argsIndex < args.Length; ++argsIndex)
            {
                Match match = _parser.Match(text.ToString(), startIndex);
                if (!match.Success)
                {
                    break;
                }
                string newValue = GetBindVariableText(args[argsIndex]);
                text.Replace(match.Value, newValue, match.Index, match.Length);
                startIndex = match.Index + newValue.Length;
            }
            return(text.ToString());
        }