private DataTable GetDataTypesCollection(string[] restrictions, OdbcConnection connection)
        {
            if (!ADP.IsEmptyArray(restrictions))
            {
                throw ADP.TooManyRestrictions(DbMetaDataCollectionNames.DataTypes);
            }
            if (base.CollectionDataSet.Tables[DbMetaDataCollectionNames.DataTypes] == null)
            {
                throw ADP.UnableToBuildCollection(DbMetaDataCollectionNames.DataTypes);
            }
            DataTable      dataTypesTable = base.CloneAndFilterCollection(DbMetaDataCollectionNames.DataTypes, null);
            OdbcCommand    command        = null;
            OdbcDataReader dataReader     = null;

            object[] methodArguments = new object[] { (short)0 };
            try
            {
                command    = this.GetCommand(connection);
                dataReader = command.ExecuteReaderFromSQLMethod(methodArguments, ODBC32.SQL_API.SQLGETTYPEINFO);
                this.DataTableFromDataReaderDataTypes(dataTypesTable, dataReader, connection);
            }
            finally
            {
                if (dataReader != null)
                {
                    dataReader.Dispose();
                }
                if (command != null)
                {
                    command.Dispose();
                }
            }
            dataTypesTable.AcceptChanges();
            return(dataTypesTable);
        }
        private DataTable GetColumnsCollection(string[] restrictions, OdbcConnection connection)
        {
            OdbcDataReader reader  = null;
            OdbcCommand    command = null;
            DataTable      table   = null;

            try
            {
                command = this.GetCommand(connection);
                string[] allRestrictions = new string[4];
                this.FillOutRestrictions(4, restrictions, allRestrictions, OdbcMetaDataCollectionNames.Columns);
                reader = command.ExecuteReaderFromSQLMethod(allRestrictions, ODBC32.SQL_API.SQLCOLUMNS);
                table  = this.DataTableFromDataReader(reader, OdbcMetaDataCollectionNames.Columns);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Dispose();
                }
                if (command != null)
                {
                    command.Dispose();
                }
            }
            return(table);
        }
        private DataTable GetProceduresCollection(string[] restrictions, OdbcConnection connection)
        {
            OdbcDataReader reader  = null;
            OdbcCommand    command = null;
            DataTable      table   = null;

            try
            {
                short num;
                command = this.GetCommand(connection);
                string[] allRestrictions = new string[4];
                this.FillOutRestrictions(4, restrictions, allRestrictions, OdbcMetaDataCollectionNames.Procedures);
                reader = command.ExecuteReaderFromSQLMethod(allRestrictions, ODBC32.SQL_API.SQLPROCEDURES);
                if (allRestrictions[3] == null)
                {
                    return(this.DataTableFromDataReader(reader, OdbcMetaDataCollectionNames.Procedures));
                }
                if ((restrictions[3] == "SQL_PT_UNKNOWN") || (restrictions[3] == "0"))
                {
                    num = 0;
                }
                else if ((restrictions[3] == "SQL_PT_PROCEDURE") || (restrictions[3] == "1"))
                {
                    num = 1;
                }
                else
                {
                    if (!(restrictions[3] == "SQL_PT_FUNCTION") && !(restrictions[3] == "2"))
                    {
                        throw ADP.InvalidRestrictionValue(OdbcMetaDataCollectionNames.Procedures, "PROCEDURE_TYPE", restrictions[3]);
                    }
                    num = 2;
                }
                table = this.DataTableFromDataReaderProcedures(reader, OdbcMetaDataCollectionNames.Procedures, num);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Dispose();
                }
                if (command != null)
                {
                    command.Dispose();
                }
            }
            return(table);
        }
        private DataTable GetTablesCollection(string[] restrictions, OdbcConnection connection, bool isTables)
        {
            OdbcDataReader reader  = null;
            OdbcCommand    command = null;
            DataTable      table   = null;

            try
            {
                string tables;
                string str2;
                command = this.GetCommand(connection);
                string[] allRestrictions = new string[4];
                if (isTables)
                {
                    str2   = "TABLE,SYSTEM TABLE";
                    tables = OdbcMetaDataCollectionNames.Tables;
                }
                else
                {
                    str2   = "VIEW";
                    tables = OdbcMetaDataCollectionNames.Views;
                }
                this.FillOutRestrictions(3, restrictions, allRestrictions, tables);
                allRestrictions[3] = str2;
                reader             = command.ExecuteReaderFromSQLMethod(allRestrictions, ODBC32.SQL_API.SQLTABLES);
                table = this.DataTableFromDataReader(reader, tables);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Dispose();
                }
                if (command != null)
                {
                    command.Dispose();
                }
            }
            return(table);
        }
        private DataTable GetIndexCollection(string[] restrictions, OdbcConnection connection)
        {
            OdbcDataReader reader  = null;
            OdbcCommand    command = null;
            DataTable      table   = null;

            try
            {
                command = this.GetCommand(connection);
                object[] allRestrictions = new object[5];
                this.FillOutRestrictions(4, restrictions, allRestrictions, OdbcMetaDataCollectionNames.Indexes);
                if (allRestrictions[2] == null)
                {
                    throw ODBC.GetSchemaRestrictionRequired();
                }
                allRestrictions[3] = (short)1;
                allRestrictions[4] = (short)1;
                reader             = command.ExecuteReaderFromSQLMethod(allRestrictions, ODBC32.SQL_API.SQLSTATISTICS);
                string restrictionIndexName = null;
                if ((restrictions != null) && (restrictions.Length >= 4))
                {
                    restrictionIndexName = restrictions[3];
                }
                table = this.DataTableFromDataReaderIndex(reader, OdbcMetaDataCollectionNames.Indexes, restrictionIndexName);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Dispose();
                }
                if (command != null)
                {
                    command.Dispose();
                }
            }
            return(table);
        }
        private DataTable GetProcedureColumnsCollection(string[] restrictions, OdbcConnection connection, bool isColumns)
        {
            OdbcDataReader reader  = null;
            OdbcCommand    command = null;
            DataTable      table   = null;

            try
            {
                string procedureColumns;
                command = this.GetCommand(connection);
                string[] allRestrictions = new string[4];
                this.FillOutRestrictions(4, restrictions, allRestrictions, OdbcMetaDataCollectionNames.Columns);
                reader = command.ExecuteReaderFromSQLMethod(allRestrictions, ODBC32.SQL_API.SQLPROCEDURECOLUMNS);
                if (isColumns)
                {
                    procedureColumns = OdbcMetaDataCollectionNames.ProcedureColumns;
                }
                else
                {
                    procedureColumns = OdbcMetaDataCollectionNames.ProcedureParameters;
                }
                table = this.DataTableFromDataReaderProcedureColumns(reader, procedureColumns, isColumns);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Dispose();
                }
                if (command != null)
                {
                    command.Dispose();
                }
            }
            return(table);
        }