示例#1
0
        /// <summary>
        /// Creates a metadata source which filters out unneeded rows according to the given
        /// filters.
        /// </summary>
        /// <param name="metadataID">Identifier to create the appropriate metadata source.</param>
        /// <param name="restrictions">
        ///     Restrictions to be applied to the metadata table. Only columns that have 
        ///     restrictions appear in the collection of restrictions.
        /// </param>
        /// <param name="escapeChar">Escape character used in filtering.</param>
        /// <param name="identifierQuoteChar">Character used as a quote around identifiers.</param>
        /// <param name="filterAsIdentifier">Indicates if string filters are treated as identifiers.</param>
        /// <returns>An IMetadataSource object representing the requested metadata.</returns>
        public override IMetadataSource MakeNewMetadataSource(
            MetadataSourceID metadataID,
            IDictionary<MetadataSourceColumnTag, string> restrictions,
            string escapeChar,
            string identifierQuoteChar,
            bool filterAsIdentifier)
        {
            // TODO(ODBC) #05: Create and return your Metadata Sources.
            // TODO(ADO)  #07: Create and return your Metadata Sources.
            LogUtilities.LogFunctionEntrance(
                Log, 
                metadataID, 
                restrictions, 
                escapeChar, 
                identifierQuoteChar, 
                filterAsIdentifier);

            // At the very least, ODBC conforming applications will require the following metadata 
            // sources:
            //
            //  Tables
            //      List of all tables defined in the data source.
            //
            //  CatalogOnly
            //      List of all catalogs defined in the data source.
            //
            //  SchemaOnly
            //      List of all schemas defined in the data source.
            //
            //  TableTypeOnly
            //      List of all table types (TABLE,VIEW,SYSTEM) defined within the data source.
            //
            //  Columns
            //      List of all columns defined across all tables in the data source.
            //
            //  TypeInfo
            //      List of the supported types by the data source.
            //
            //  In some cases applications may provide values to restrict the metadata sources.
            //  These restrictions are stored within restrictions and can be used to restrict
            //  the number of rows that are returned from the metadata source.

            // Columns, Tables, CatalogOnly, SchemaOnly, TableTypeOnly, TypeInfo.
            switch (metadataID)
            {
                case MetadataSourceID.Tables:
                {
                    return new BTablesMetadataSource(Log, m_Properties);
                }

                case MetadataSourceID.CatalogOnly:
                {
                    return new BCatalogOnlyMetadataSource(Log, m_Properties);
                }

                case MetadataSourceID.SchemaOnly:
                {
                    return new BSchemaOnlyMetadataSource(Log);
                }

                case MetadataSourceID.TableTypeOnly:
                {
                    return new DSITableTypeOnlyMetadataSource(Log);
                }

                case MetadataSourceID.Columns:
                {
                    return new BColumnsMetadataSource(Log, m_Properties);
                }

                case MetadataSourceID.TypeInfo:
                {
                    return new BTypeInfoMetadataSource(Log);
                }

                default:
                {
                    return new DSIEmptyMetadataSource();
                }
            }
        }
示例#2
0
        /// <summary>
        /// Creates a metadata source which filters out unneeded rows according to the given
        /// filters.
        /// </summary>
        /// <param name="metadataID">Identifier to create the appropriate metadata source.</param>
        /// <param name="restrictions">
        ///     Restrictions to be applied to the metadata table. Only columns that have
        ///     restrictions appear in the collection of restrictions.
        /// </param>
        /// <param name="escapeChar">Escape character used in filtering.</param>
        /// <param name="identifierQuoteChar">Character used as a quote around identifiers.</param>
        /// <param name="filterAsIdentifier">Indicates if string filters are treated as identifiers.</param>
        /// <returns>An IMetadataSource object representing the requested metadata.</returns>
        public override IMetadataSource MakeNewMetadataSource(
            MetadataSourceID metadataID,
            IDictionary <MetadataSourceColumnTag, string> restrictions,
            string escapeChar,
            string identifierQuoteChar,
            bool filterAsIdentifier)
        {
            // TODO(ODBC) #05: Create and return your Metadata Sources.
            // TODO(ADO)  #07: Create and return your Metadata Sources.
            LogUtilities.LogFunctionEntrance(
                Log,
                metadataID,
                restrictions,
                escapeChar,
                identifierQuoteChar,
                filterAsIdentifier);

            // At the very least, ODBC conforming applications will require the following metadata
            // sources:
            //
            //  Tables
            //      List of all tables defined in the data source.
            //
            //  CatalogOnly
            //      List of all catalogs defined in the data source.
            //
            //  SchemaOnly
            //      List of all schemas defined in the data source.
            //
            //  TableTypeOnly
            //      List of all table types (TABLE,VIEW,SYSTEM) defined within the data source.
            //
            //  Columns
            //      List of all columns defined across all tables in the data source.
            //
            //  TypeInfo
            //      List of the supported types by the data source.
            //
            //  In some cases applications may provide values to restrict the metadata sources.
            //  These restrictions are stored within restrictions and can be used to restrict
            //  the number of rows that are returned from the metadata source.

            // Columns, Tables, CatalogOnly, SchemaOnly, TableTypeOnly, TypeInfo.
            switch (metadataID)
            {
            case MetadataSourceID.Tables:
            {
                return(new BTablesMetadataSource(Log, m_Properties));
            }

            case MetadataSourceID.CatalogOnly:
            {
                return(new BCatalogOnlyMetadataSource(Log, m_Properties));
            }

            case MetadataSourceID.SchemaOnly:
            {
                return(new BSchemaOnlyMetadataSource(Log));
            }

            case MetadataSourceID.TableTypeOnly:
            {
                return(new DSITableTypeOnlyMetadataSource(Log));
            }

            case MetadataSourceID.Columns:
            {
                return(new BColumnsMetadataSource(Log, m_Properties));
            }

            case MetadataSourceID.TypeInfo:
            {
                return(new BTypeInfoMetadataSource(Log));
            }

            default:
            {
                return(new DSIEmptyMetadataSource());
            }
            }
        }