コード例 #1
0
        public string Run(string sourceSql)
        {
            StringBuilder output = new StringBuilder();
            int           num    = 0;
            int           pos    = 0;

            while (pos <= sourceSql.Length)
            {
                this.PassWhiteSpaces(output, sourceSql, ref pos);
                if (pos < sourceSql.Length)
                {
                    if (TextScanner.Pass('?', sourceSql, ref pos))
                    {
                        this.OutputQuestionMark(num++, output, sourceSql, ref pos);
                    }
                    else
                    {
                        string str;
                        if (TextScanner.PassQuoted(ref str, '\'', sourceSql, ref pos))
                        {
                            this.OutputStringLiteral(str, output, sourceSql, ref pos);
                        }
                        else if (TextScanner.PassQuoted(ref str, '"', sourceSql, ref pos))
                        {
                            this.OutputQualifiedIdentifier(str, output, sourceSql, ref pos);
                        }
                        else if (this.PassQuoted(ref str, '[', ']', sourceSql, ref pos))
                        {
                            this.OutputQualifiedIdentifier(str, output, sourceSql, ref pos);
                        }
                        else if (TextScanner.PassIdentifier(ref str, sourceSql, ref pos))
                        {
                            this.OutputIdentifier(str, output, sourceSql, ref pos);
                        }
                        else
                        {
                            output.Append(sourceSql[pos++]);
                        }
                    }
                }
                else
                {
                    break;
                }
            }
            return(output.ToString());
        }