protected override DbSqlParserColumnCollection GatherTableColumns(DbSqlParserTable table)
        {
            OciStatementHandle          stmtp       = new OciStatementHandle(this._connection.ServiceContextHandle);
            OciErrorHandle              errorHandle = this._connection.ErrorHandle;
            StringBuilder               builder     = new StringBuilder();
            string                      schemaName  = table.SchemaName;
            string                      tableName   = table.TableName;
            DbSqlParserColumnCollection columns     = new DbSqlParserColumnCollection();

            builder.Append("select * from ");
            if (!System.Data.Common.ADP.IsEmpty(schemaName))
            {
                builder.Append(schemaName);
                builder.Append(".");
            }
            builder.Append(tableName);
            string stmt = builder.ToString();

            if ((TracedNativeMethods.OCIStmtPrepare(stmtp, errorHandle, stmt, OCI.SYNTAX.OCI_NTV_SYNTAX, OCI.MODE.OCI_DEFAULT, this._connection) == 0) && (TracedNativeMethods.OCIStmtExecute(this._connection.ServiceContextHandle, stmtp, errorHandle, 0, OCI.MODE.OCI_DESCRIBE_ONLY) == 0))
            {
                int num3;
                stmtp.GetAttribute(OCI.ATTR.OCI_ATTR_PARAM_COUNT, out num3, errorHandle);
                for (int i = 0; i < num3; i++)
                {
                    string str;
                    OciParameterDescriptor handle = stmtp.GetDescriptor(i, errorHandle);
                    handle.GetAttribute(OCI.ATTR.OCI_ATTR_SQLCODE, out str, errorHandle, this._connection);
                    OciHandle.SafeDispose(ref handle);
                    str = this.QuotePrefixCharacter + str + this.QuoteSuffixCharacter;
                    columns.Add(null, schemaName, tableName, str, null);
                }
            }
            OciHandle.SafeDispose(ref stmtp);
            return(columns);
        }
        protected DbSqlParserColumn FindCompletedColumn(DbSqlParserTable table, DbSqlParserColumn searchColumn)
        {
            DbSqlParserColumnCollection columns = table.Columns;
            int count = columns.Count;

            for (int i = 0; i < count; i++)
            {
                DbSqlParserColumn column = columns[i];
                if (this.CatalogMatch(column.ColumnName, searchColumn.ColumnName))
                {
                    return(column);
                }
            }
            return(null);
        }
        private DbSqlParserColumn FindConstraintColumn(string schemaName, string tableName, string columnName)
        {
            DbSqlParserColumnCollection columns = base.Columns;
            int count = columns.Count;

            for (int i = 0; i < count; i++)
            {
                DbSqlParserColumn column = columns[i];
                if ((this.CatalogMatch(column.SchemaName, schemaName) && this.CatalogMatch(column.TableName, tableName)) && this.CatalogMatch(column.ColumnName, columnName))
                {
                    return(column);
                }
            }
            return(null);
        }
        private void Parse2(string statementText)
        {
            bool flag;
            PARSERSTATE nOTHINGYET = PARSERSTATE.NOTHINGYET;
            Token[] namePart = new Token[4];
            int maxPart = 0;
            Token @null = Token.Null;
            TokenType type7 = TokenType.Null;
            int num2 = 0;
            this._columns = null;
            this._tables = null;
            Match match = SqlTokenParser.Match(statementText);
            Token token2 = TokenFromMatch(match);
        Label_003B:
            flag = false;
            switch (nOTHINGYET)
            {
                case PARSERSTATE.NOTHINGYET:
                    if (token2.Type != TokenType.Keyword_SELECT)
                    {
                        throw System.Data.Common.ADP.InvalidOperation(Res.GetString("ADP_SQLParserInternalError"));
                    }
                    nOTHINGYET = PARSERSTATE.SELECT;
                    goto Label_061A;

                case PARSERSTATE.SELECT:
                {
                    TokenType type2 = token2.Type;
                    if (type2 > TokenType.Other_Star)
                    {
                        switch (type2)
                        {
                            case TokenType.Keyword_DISTINCT:
                            case TokenType.Keyword_ALL:
                                goto Label_061A;

                            case TokenType.Keyword_FROM:
                                nOTHINGYET = PARSERSTATE.FROM;
                                goto Label_061A;
                        }
                        break;
                    }
                    switch (type2)
                    {
                        case TokenType.Identifier:
                        case TokenType.QuotedIdentifier:
                            nOTHINGYET = PARSERSTATE.COLUMN;
                            maxPart = 0;
                            namePart[0] = token2;
                            goto Label_061A;

                        case TokenType.Other_LeftParen:
                            nOTHINGYET = PARSERSTATE.EXPRESSION;
                            num2++;
                            goto Label_061A;

                        case TokenType.Other_RightParen:
                            throw System.Data.Common.ADP.SyntaxErrorMissingParenthesis();

                        case TokenType.Other_Star:
                            nOTHINGYET = PARSERSTATE.COLUMNALIAS;
                            maxPart = 0;
                            namePart[0] = token2;
                            goto Label_061A;
                    }
                    break;
                }
                case PARSERSTATE.COLUMN:
                {
                    TokenType type = token2.Type;
                    if (type > TokenType.Other_Star)
                    {
                        switch (type)
                        {
                            case TokenType.Keyword_AS:
                                goto Label_061A;

                            case TokenType.Keyword_FROM:
                                goto Label_01FF;
                        }
                    }
                    else
                    {
                        switch (type)
                        {
                            case TokenType.Identifier:
                            case TokenType.QuotedIdentifier:
                                if (TokenType.Other_Period != type7)
                                {
                                    nOTHINGYET = PARSERSTATE.COLUMNALIAS;
                                    @null = token2;
                                }
                                else
                                {
                                    namePart[++maxPart] = token2;
                                }
                                goto Label_061A;

                            case TokenType.Other_Comma:
                                goto Label_01FF;

                            case TokenType.Other_Period:
                                if (maxPart > 3)
                                {
                                    throw System.Data.Common.ADP.SyntaxErrorTooManyNameParts();
                                }
                                goto Label_061A;

                            case TokenType.Other_LeftParen:
                                nOTHINGYET = PARSERSTATE.EXPRESSION;
                                num2++;
                                maxPart = -1;
                                goto Label_061A;

                            case TokenType.Other_RightParen:
                                throw System.Data.Common.ADP.SyntaxErrorMissingParenthesis();

                            case TokenType.Other_Star:
                                nOTHINGYET = PARSERSTATE.COLUMNALIAS;
                                namePart[++maxPart] = token2;
                                goto Label_061A;
                        }
                    }
                    nOTHINGYET = PARSERSTATE.EXPRESSION;
                    maxPart = -1;
                    goto Label_061A;
                }
                case PARSERSTATE.COLUMNALIAS:
                {
                    TokenType type9 = token2.Type;
                    if ((type9 != TokenType.Other_Comma) && (type9 != TokenType.Keyword_FROM))
                    {
                        throw System.Data.Common.ADP.SyntaxErrorExpectedCommaAfterColumn();
                    }
                    nOTHINGYET = (token2.Type == TokenType.Keyword_FROM) ? PARSERSTATE.FROM : PARSERSTATE.SELECT;
                    this.AddColumn(maxPart, namePart, @null);
                    maxPart = -1;
                    @null = Token.Null;
                    goto Label_061A;
                }
                case PARSERSTATE.TABLE:
                    switch (token2.Type)
                    {
                        case TokenType.Null:
                        case TokenType.Keyword_COMPUTE:
                        case TokenType.Keyword_FOR:
                        case TokenType.Keyword_GROUP:
                        case TokenType.Keyword_HAVING:
                        case TokenType.Keyword_INTERSECT:
                        case TokenType.Keyword_MINUS:
                        case TokenType.Keyword_ORDER:
                        case TokenType.Keyword_UNION:
                        case TokenType.Keyword_WHERE:
                            nOTHINGYET = PARSERSTATE.DONE;
                            flag = true;
                            goto Label_061A;

                        case TokenType.Identifier:
                        case TokenType.QuotedIdentifier:
                            if (TokenType.Other_Period != type7)
                            {
                                nOTHINGYET = PARSERSTATE.TABLEALIAS;
                                @null = token2;
                            }
                            else
                            {
                                namePart[++maxPart] = token2;
                            }
                            goto Label_061A;

                        case TokenType.Other_Comma:
                        case TokenType.Keyword_JOIN:
                            nOTHINGYET = PARSERSTATE.FROM;
                            flag = true;
                            goto Label_061A;

                        case TokenType.Other_Period:
                            if (maxPart > 2)
                            {
                                throw System.Data.Common.ADP.SyntaxErrorTooManyNameParts();
                            }
                            goto Label_061A;

                        case TokenType.Keyword_AS:
                            goto Label_061A;

                        case TokenType.Keyword_CROSS:
                        case TokenType.Keyword_LEFT:
                        case TokenType.Keyword_NATURAL:
                        case TokenType.Keyword_RIGHT:
                            nOTHINGYET = PARSERSTATE.JOIN;
                            flag = true;
                            goto Label_061A;

                        case TokenType.Keyword_ON:
                        case TokenType.Keyword_USING:
                            nOTHINGYET = PARSERSTATE.JOINCONDITION;
                            flag = true;
                            goto Label_061A;
                    }
                    throw System.Data.Common.ADP.SyntaxErrorExpectedNextPart();

                case PARSERSTATE.TABLEALIAS:
                    flag = true;
                    switch (token2.Type)
                    {
                        case TokenType.Keyword_COMPUTE:
                        case TokenType.Keyword_FOR:
                        case TokenType.Keyword_GROUP:
                        case TokenType.Keyword_HAVING:
                        case TokenType.Keyword_INTERSECT:
                        case TokenType.Keyword_MINUS:
                        case TokenType.Keyword_ORDER:
                        case TokenType.Keyword_UNION:
                        case TokenType.Keyword_WHERE:
                        case TokenType.Null:
                            nOTHINGYET = PARSERSTATE.DONE;
                            goto Label_061A;

                        case TokenType.Keyword_CROSS:
                        case TokenType.Keyword_LEFT:
                        case TokenType.Keyword_NATURAL:
                        case TokenType.Keyword_RIGHT:
                            nOTHINGYET = PARSERSTATE.JOIN;
                            goto Label_061A;

                        case TokenType.Keyword_JOIN:
                        case TokenType.Other_Comma:
                            nOTHINGYET = PARSERSTATE.FROM;
                            goto Label_061A;

                        case TokenType.Keyword_ON:
                        case TokenType.Keyword_USING:
                            nOTHINGYET = PARSERSTATE.JOINCONDITION;
                            goto Label_061A;
                    }
                    throw System.Data.Common.ADP.SyntaxErrorExpectedCommaAfterTable();

                case PARSERSTATE.FROM:
                    switch (token2.Type)
                    {
                        case TokenType.Identifier:
                        case TokenType.QuotedIdentifier:
                            nOTHINGYET = PARSERSTATE.TABLE;
                            maxPart = 0;
                            namePart[0] = token2;
                            goto Label_061A;
                    }
                    throw System.Data.Common.ADP.SyntaxErrorExpectedIdentifier();

                case PARSERSTATE.EXPRESSION:
                    switch (token2.Type)
                    {
                        case TokenType.Identifier:
                        case TokenType.QuotedIdentifier:
                            if (num2 == 0)
                            {
                                @null = token2;
                            }
                            break;

                        case TokenType.Other_Comma:
                        case TokenType.Keyword_FROM:
                            if (num2 == 0)
                            {
                                nOTHINGYET = (token2.Type == TokenType.Keyword_FROM) ? PARSERSTATE.FROM : PARSERSTATE.SELECT;
                                this.AddColumn(maxPart, namePart, @null);
                                maxPart = -1;
                                @null = Token.Null;
                            }
                            break;

                        case TokenType.Other_LeftParen:
                            num2++;
                            break;

                        case TokenType.Other_RightParen:
                            num2--;
                            break;
                    }
                    goto Label_061A;

                case PARSERSTATE.JOIN:
                    switch (token2.Type)
                    {
                        case TokenType.Keyword_INNER:
                        case TokenType.Keyword_OUTER:
                            goto Label_061A;

                        case TokenType.Keyword_JOIN:
                            nOTHINGYET = PARSERSTATE.FROM;
                            goto Label_061A;
                    }
                    throw System.Data.Common.ADP.SyntaxErrorExpectedNextPart();

                case PARSERSTATE.JOINCONDITION:
                    switch (token2.Type)
                    {
                        case TokenType.Other_LeftParen:
                            num2++;
                            goto Label_061A;

                        case TokenType.Other_RightParen:
                            num2--;
                            goto Label_061A;
                    }
                    if (num2 == 0)
                    {
                        switch (token2.Type)
                        {
                            case TokenType.Keyword_COMPUTE:
                            case TokenType.Keyword_FOR:
                            case TokenType.Keyword_GROUP:
                            case TokenType.Keyword_HAVING:
                            case TokenType.Keyword_INTERSECT:
                            case TokenType.Keyword_MINUS:
                            case TokenType.Keyword_ORDER:
                            case TokenType.Keyword_UNION:
                            case TokenType.Keyword_WHERE:
                            case TokenType.Null:
                                nOTHINGYET = PARSERSTATE.DONE;
                                break;

                            case TokenType.Keyword_CROSS:
                            case TokenType.Keyword_LEFT:
                            case TokenType.Keyword_NATURAL:
                            case TokenType.Keyword_RIGHT:
                                nOTHINGYET = PARSERSTATE.JOIN;
                                break;

                            case TokenType.Keyword_JOIN:
                                nOTHINGYET = PARSERSTATE.FROM;
                                break;
                        }
                    }
                    goto Label_061A;

                case PARSERSTATE.DONE:
                    return;

                default:
                    throw System.Data.Common.ADP.InvalidOperation(Res.GetString("ADP_SQLParserInternalError"));
            }
            nOTHINGYET = PARSERSTATE.EXPRESSION;
            goto Label_061A;
        Label_01FF:
            nOTHINGYET = (token2.Type == TokenType.Keyword_FROM) ? PARSERSTATE.FROM : PARSERSTATE.SELECT;
            this.AddColumn(maxPart, namePart, @null);
            maxPart = -1;
            @null = Token.Null;
        Label_061A:
            if (flag)
            {
                this.AddTable(maxPart, namePart, @null);
                maxPart = -1;
                @null = Token.Null;
                flag = false;
            }
            type7 = token2.Type;
            match = match.NextMatch();
            token2 = TokenFromMatch(match);
            goto Label_003B;
        }
 protected override DbSqlParserColumnCollection GatherTableColumns(DbSqlParserTable table)
 {
     OciStatementHandle stmtp = new OciStatementHandle(this._connection.ServiceContextHandle);
     OciErrorHandle errorHandle = this._connection.ErrorHandle;
     StringBuilder builder = new StringBuilder();
     string schemaName = table.SchemaName;
     string tableName = table.TableName;
     DbSqlParserColumnCollection columns = new DbSqlParserColumnCollection();
     builder.Append("select * from ");
     if (!System.Data.Common.ADP.IsEmpty(schemaName))
     {
         builder.Append(schemaName);
         builder.Append(".");
     }
     builder.Append(tableName);
     string stmt = builder.ToString();
     if ((TracedNativeMethods.OCIStmtPrepare(stmtp, errorHandle, stmt, OCI.SYNTAX.OCI_NTV_SYNTAX, OCI.MODE.OCI_DEFAULT, this._connection) == 0) && (TracedNativeMethods.OCIStmtExecute(this._connection.ServiceContextHandle, stmtp, errorHandle, 0, OCI.MODE.OCI_DESCRIBE_ONLY) == 0))
     {
         int num3;
         stmtp.GetAttribute(OCI.ATTR.OCI_ATTR_PARAM_COUNT, out num3, errorHandle);
         for (int i = 0; i < num3; i++)
         {
             string str;
             OciParameterDescriptor handle = stmtp.GetDescriptor(i, errorHandle);
             handle.GetAttribute(OCI.ATTR.OCI_ATTR_SQLCODE, out str, errorHandle, this._connection);
             OciHandle.SafeDispose(ref handle);
             str = this.QuotePrefixCharacter + str + this.QuoteSuffixCharacter;
             columns.Add(null, schemaName, tableName, str, null);
         }
     }
     OciHandle.SafeDispose(ref stmtp);
     return columns;
 }
        private void CompleteSchemaInformation()
        {
            DbSqlParserColumnCollection columns = this.Columns;
            DbSqlParserTableCollection  tables  = this.Tables;
            int count = columns.Count;
            int num10 = tables.Count;

            for (int i = 0; i < num10; i++)
            {
                DbSqlParserTable            table2   = tables[i];
                DbSqlParserColumnCollection columns4 = this.GatherTableColumns(table2);
                table2.Columns = columns4;
            }
            for (int j = 0; j < count; j++)
            {
                DbSqlParserColumn column = columns[j];
                DbSqlParserTable  table  = this.FindTableForColumn(column);
                if (!column.IsExpression)
                {
                    if ("*" == column.ColumnName)
                    {
                        columns.RemoveAt(j);
                        if (column.TableName.Length != 0)
                        {
                            DbSqlParserColumnCollection columns3 = table.Columns;
                            int num9 = columns3.Count;
                            for (int m = 0; m < num9; m++)
                            {
                                columns.Insert(j + m, columns3[m]);
                            }
                            count += num9 - 1;
                            j     += num9 - 1;
                        }
                        else
                        {
                            for (int n = 0; n < num10; n++)
                            {
                                table = tables[n];
                                DbSqlParserColumnCollection columns2 = table.Columns;
                                int num8 = columns2.Count;
                                for (int num2 = 0; num2 < num8; num2++)
                                {
                                    columns.Insert(j + num2, columns2[num2]);
                                }
                                count += num8 - 1;
                                j     += num8;
                            }
                        }
                    }
                    else
                    {
                        DbSqlParserColumn completedColumn = this.FindCompletedColumn(table, column);
                        if (completedColumn != null)
                        {
                            column.CopySchemaInfoFrom(completedColumn);
                        }
                        else
                        {
                            column.CopySchemaInfoFrom(table);
                        }
                    }
                }
            }
            for (int k = 0; k < num10; k++)
            {
                DbSqlParserTable table3 = tables[k];
                this.GatherKeyColumns(table3);
            }
        }
        private void Parse2(string statementText)
        {
            bool        flag;
            PARSERSTATE nOTHINGYET = PARSERSTATE.NOTHINGYET;

            Token[]   namePart = new Token[4];
            int       maxPart  = 0;
            Token     @null    = Token.Null;
            TokenType type7    = TokenType.Null;
            int       num2     = 0;

            this._columns = null;
            this._tables  = null;
            Match match  = SqlTokenParser.Match(statementText);
            Token token2 = TokenFromMatch(match);

Label_003B:
            flag = false;
            switch (nOTHINGYET)
            {
            case PARSERSTATE.NOTHINGYET:
                if (token2.Type != TokenType.Keyword_SELECT)
                {
                    throw System.Data.Common.ADP.InvalidOperation(Res.GetString("ADP_SQLParserInternalError"));
                }
                nOTHINGYET = PARSERSTATE.SELECT;
                goto Label_061A;

            case PARSERSTATE.SELECT:
            {
                TokenType type2 = token2.Type;
                if (type2 > TokenType.Other_Star)
                {
                    switch (type2)
                    {
                    case TokenType.Keyword_DISTINCT:
                    case TokenType.Keyword_ALL:
                        goto Label_061A;

                    case TokenType.Keyword_FROM:
                        nOTHINGYET = PARSERSTATE.FROM;
                        goto Label_061A;
                    }
                    break;
                }
                switch (type2)
                {
                case TokenType.Identifier:
                case TokenType.QuotedIdentifier:
                    nOTHINGYET  = PARSERSTATE.COLUMN;
                    maxPart     = 0;
                    namePart[0] = token2;
                    goto Label_061A;

                case TokenType.Other_LeftParen:
                    nOTHINGYET = PARSERSTATE.EXPRESSION;
                    num2++;
                    goto Label_061A;

                case TokenType.Other_RightParen:
                    throw System.Data.Common.ADP.SyntaxErrorMissingParenthesis();

                case TokenType.Other_Star:
                    nOTHINGYET  = PARSERSTATE.COLUMNALIAS;
                    maxPart     = 0;
                    namePart[0] = token2;
                    goto Label_061A;
                }
                break;
            }

            case PARSERSTATE.COLUMN:
            {
                TokenType type = token2.Type;
                if (type > TokenType.Other_Star)
                {
                    switch (type)
                    {
                    case TokenType.Keyword_AS:
                        goto Label_061A;

                    case TokenType.Keyword_FROM:
                        goto Label_01FF;
                    }
                }
                else
                {
                    switch (type)
                    {
                    case TokenType.Identifier:
                    case TokenType.QuotedIdentifier:
                        if (TokenType.Other_Period != type7)
                        {
                            nOTHINGYET = PARSERSTATE.COLUMNALIAS;
                            @null      = token2;
                        }
                        else
                        {
                            namePart[++maxPart] = token2;
                        }
                        goto Label_061A;

                    case TokenType.Other_Comma:
                        goto Label_01FF;

                    case TokenType.Other_Period:
                        if (maxPart > 3)
                        {
                            throw System.Data.Common.ADP.SyntaxErrorTooManyNameParts();
                        }
                        goto Label_061A;

                    case TokenType.Other_LeftParen:
                        nOTHINGYET = PARSERSTATE.EXPRESSION;
                        num2++;
                        maxPart = -1;
                        goto Label_061A;

                    case TokenType.Other_RightParen:
                        throw System.Data.Common.ADP.SyntaxErrorMissingParenthesis();

                    case TokenType.Other_Star:
                        nOTHINGYET          = PARSERSTATE.COLUMNALIAS;
                        namePart[++maxPart] = token2;
                        goto Label_061A;
                    }
                }
                nOTHINGYET = PARSERSTATE.EXPRESSION;
                maxPart    = -1;
                goto Label_061A;
            }

            case PARSERSTATE.COLUMNALIAS:
            {
                TokenType type9 = token2.Type;
                if ((type9 != TokenType.Other_Comma) && (type9 != TokenType.Keyword_FROM))
                {
                    throw System.Data.Common.ADP.SyntaxErrorExpectedCommaAfterColumn();
                }
                nOTHINGYET = (token2.Type == TokenType.Keyword_FROM) ? PARSERSTATE.FROM : PARSERSTATE.SELECT;
                this.AddColumn(maxPart, namePart, @null);
                maxPart = -1;
                @null   = Token.Null;
                goto Label_061A;
            }

            case PARSERSTATE.TABLE:
                switch (token2.Type)
                {
                case TokenType.Null:
                case TokenType.Keyword_COMPUTE:
                case TokenType.Keyword_FOR:
                case TokenType.Keyword_GROUP:
                case TokenType.Keyword_HAVING:
                case TokenType.Keyword_INTERSECT:
                case TokenType.Keyword_MINUS:
                case TokenType.Keyword_ORDER:
                case TokenType.Keyword_UNION:
                case TokenType.Keyword_WHERE:
                    nOTHINGYET = PARSERSTATE.DONE;
                    flag       = true;
                    goto Label_061A;

                case TokenType.Identifier:
                case TokenType.QuotedIdentifier:
                    if (TokenType.Other_Period != type7)
                    {
                        nOTHINGYET = PARSERSTATE.TABLEALIAS;
                        @null      = token2;
                    }
                    else
                    {
                        namePart[++maxPart] = token2;
                    }
                    goto Label_061A;

                case TokenType.Other_Comma:
                case TokenType.Keyword_JOIN:
                    nOTHINGYET = PARSERSTATE.FROM;
                    flag       = true;
                    goto Label_061A;

                case TokenType.Other_Period:
                    if (maxPart > 2)
                    {
                        throw System.Data.Common.ADP.SyntaxErrorTooManyNameParts();
                    }
                    goto Label_061A;

                case TokenType.Keyword_AS:
                    goto Label_061A;

                case TokenType.Keyword_CROSS:
                case TokenType.Keyword_LEFT:
                case TokenType.Keyword_NATURAL:
                case TokenType.Keyword_RIGHT:
                    nOTHINGYET = PARSERSTATE.JOIN;
                    flag       = true;
                    goto Label_061A;

                case TokenType.Keyword_ON:
                case TokenType.Keyword_USING:
                    nOTHINGYET = PARSERSTATE.JOINCONDITION;
                    flag       = true;
                    goto Label_061A;
                }
                throw System.Data.Common.ADP.SyntaxErrorExpectedNextPart();

            case PARSERSTATE.TABLEALIAS:
                flag = true;
                switch (token2.Type)
                {
                case TokenType.Keyword_COMPUTE:
                case TokenType.Keyword_FOR:
                case TokenType.Keyword_GROUP:
                case TokenType.Keyword_HAVING:
                case TokenType.Keyword_INTERSECT:
                case TokenType.Keyword_MINUS:
                case TokenType.Keyword_ORDER:
                case TokenType.Keyword_UNION:
                case TokenType.Keyword_WHERE:
                case TokenType.Null:
                    nOTHINGYET = PARSERSTATE.DONE;
                    goto Label_061A;

                case TokenType.Keyword_CROSS:
                case TokenType.Keyword_LEFT:
                case TokenType.Keyword_NATURAL:
                case TokenType.Keyword_RIGHT:
                    nOTHINGYET = PARSERSTATE.JOIN;
                    goto Label_061A;

                case TokenType.Keyword_JOIN:
                case TokenType.Other_Comma:
                    nOTHINGYET = PARSERSTATE.FROM;
                    goto Label_061A;

                case TokenType.Keyword_ON:
                case TokenType.Keyword_USING:
                    nOTHINGYET = PARSERSTATE.JOINCONDITION;
                    goto Label_061A;
                }
                throw System.Data.Common.ADP.SyntaxErrorExpectedCommaAfterTable();

            case PARSERSTATE.FROM:
                switch (token2.Type)
                {
                case TokenType.Identifier:
                case TokenType.QuotedIdentifier:
                    nOTHINGYET  = PARSERSTATE.TABLE;
                    maxPart     = 0;
                    namePart[0] = token2;
                    goto Label_061A;
                }
                throw System.Data.Common.ADP.SyntaxErrorExpectedIdentifier();

            case PARSERSTATE.EXPRESSION:
                switch (token2.Type)
                {
                case TokenType.Identifier:
                case TokenType.QuotedIdentifier:
                    if (num2 == 0)
                    {
                        @null = token2;
                    }
                    break;

                case TokenType.Other_Comma:
                case TokenType.Keyword_FROM:
                    if (num2 == 0)
                    {
                        nOTHINGYET = (token2.Type == TokenType.Keyword_FROM) ? PARSERSTATE.FROM : PARSERSTATE.SELECT;
                        this.AddColumn(maxPart, namePart, @null);
                        maxPart = -1;
                        @null   = Token.Null;
                    }
                    break;

                case TokenType.Other_LeftParen:
                    num2++;
                    break;

                case TokenType.Other_RightParen:
                    num2--;
                    break;
                }
                goto Label_061A;

            case PARSERSTATE.JOIN:
                switch (token2.Type)
                {
                case TokenType.Keyword_INNER:
                case TokenType.Keyword_OUTER:
                    goto Label_061A;

                case TokenType.Keyword_JOIN:
                    nOTHINGYET = PARSERSTATE.FROM;
                    goto Label_061A;
                }
                throw System.Data.Common.ADP.SyntaxErrorExpectedNextPart();

            case PARSERSTATE.JOINCONDITION:
                switch (token2.Type)
                {
                case TokenType.Other_LeftParen:
                    num2++;
                    goto Label_061A;

                case TokenType.Other_RightParen:
                    num2--;
                    goto Label_061A;
                }
                if (num2 == 0)
                {
                    switch (token2.Type)
                    {
                    case TokenType.Keyword_COMPUTE:
                    case TokenType.Keyword_FOR:
                    case TokenType.Keyword_GROUP:
                    case TokenType.Keyword_HAVING:
                    case TokenType.Keyword_INTERSECT:
                    case TokenType.Keyword_MINUS:
                    case TokenType.Keyword_ORDER:
                    case TokenType.Keyword_UNION:
                    case TokenType.Keyword_WHERE:
                    case TokenType.Null:
                        nOTHINGYET = PARSERSTATE.DONE;
                        break;

                    case TokenType.Keyword_CROSS:
                    case TokenType.Keyword_LEFT:
                    case TokenType.Keyword_NATURAL:
                    case TokenType.Keyword_RIGHT:
                        nOTHINGYET = PARSERSTATE.JOIN;
                        break;

                    case TokenType.Keyword_JOIN:
                        nOTHINGYET = PARSERSTATE.FROM;
                        break;
                    }
                }
                goto Label_061A;

            case PARSERSTATE.DONE:
                return;

            default:
                throw System.Data.Common.ADP.InvalidOperation(Res.GetString("ADP_SQLParserInternalError"));
            }
            nOTHINGYET = PARSERSTATE.EXPRESSION;
            goto Label_061A;
Label_01FF:
            nOTHINGYET = (token2.Type == TokenType.Keyword_FROM) ? PARSERSTATE.FROM : PARSERSTATE.SELECT;
            this.AddColumn(maxPart, namePart, @null);
            maxPart = -1;
            @null   = Token.Null;
Label_061A:
            if (flag)
            {
                this.AddTable(maxPart, namePart, @null);
                maxPart = -1;
                @null   = Token.Null;
                flag    = false;
            }
            type7  = token2.Type;
            match  = match.NextMatch();
            token2 = TokenFromMatch(match);
            goto Label_003B;
        }
Пример #8
0
        private void FillSchemaTable(DataTable schemaTable)
        {
            DataColumn column3 = new DataColumn(SchemaTableOptionalColumn.ProviderSpecificDataType, typeof(Type));

            schemaTable.Columns.Add(column3);
            int fieldCount = this.FieldCount;
            DbSqlParserColumnCollection columns = null;
            int count = 0;

            if (this._keyInfoRequested)
            {
                OracleSqlParser parser = new OracleSqlParser();
                parser.Parse(this._statementText, this._connection);
                columns = parser.Columns;
                count   = columns.Count;
            }
            for (int i = 0; i < fieldCount; i++)
            {
                OracleColumn column = this._columnInfo[i];
                DataRow      row    = schemaTable.NewRow();
                row[SchemaTableColumn.ColumnName]    = column.ColumnName;
                row[SchemaTableColumn.ColumnOrdinal] = column.Ordinal;
                if (column.IsLong | column.IsLob)
                {
                    row[SchemaTableColumn.ColumnSize] = 0x7fffffff;
                }
                else
                {
                    row[SchemaTableColumn.ColumnSize] = column.SchemaTableSize;
                }
                row[SchemaTableColumn.NumericPrecision] = column.Precision;
                row[SchemaTableColumn.NumericScale]     = column.Scale;
                row[SchemaTableColumn.DataType]         = column.GetFieldType();
                row[column3] = column.GetFieldOracleType();
                row[SchemaTableColumn.ProviderType] = column.OracleType;
                row[SchemaTableColumn.IsLong]       = column.IsLong | column.IsLob;
                row[SchemaTableColumn.AllowDBNull]  = column.IsNullable;
                if (this._keyInfoRequested && (count == fieldCount))
                {
                    DbSqlParserColumn column2 = columns[i];
                    row[SchemaTableColumn.IsAliased]      = column2.IsAliased;
                    row[SchemaTableColumn.IsExpression]   = column2.IsExpression;
                    row[SchemaTableColumn.IsKey]          = column2.IsKey;
                    row[SchemaTableColumn.IsUnique]       = column2.IsUnique;
                    row[SchemaTableColumn.BaseSchemaName] = this.SetSchemaValue(OracleSqlParser.CatalogCase(column2.SchemaName));
                    row[SchemaTableColumn.BaseTableName]  = this.SetSchemaValue(OracleSqlParser.CatalogCase(column2.TableName));
                    row[SchemaTableColumn.BaseColumnName] = this.SetSchemaValue(OracleSqlParser.CatalogCase(column2.ColumnName));
                }
                else
                {
                    row[SchemaTableColumn.IsAliased]      = DBNull.Value;
                    row[SchemaTableColumn.IsExpression]   = DBNull.Value;
                    row[SchemaTableColumn.IsKey]          = DBNull.Value;
                    row[SchemaTableColumn.IsUnique]       = DBNull.Value;
                    row[SchemaTableColumn.BaseSchemaName] = DBNull.Value;
                    row[SchemaTableColumn.BaseTableName]  = DBNull.Value;
                    row[SchemaTableColumn.BaseColumnName] = DBNull.Value;
                }
                schemaTable.Rows.Add(row);
                row.AcceptChanges();
            }
        }