public DataTable GetOleDbSchemaTable(Guid schema, object[] restrictions)   // MDAC 61846
        {
            OleDbConnection.ExecutePermission.Demand();

            IntPtr hscp;

            Bid.ScopeEnter(out hscp, "<oledb.OleDbConnection.GetOleDbSchemaTable|API> %d#, schema=%ls, restrictions\n", ObjectID, schema);
            try {
                CheckStateOpen(ADP.GetOleDbSchemaTable);
                OleDbConnectionInternal connection = GetOpenConnection();

                if (OleDbSchemaGuid.DbInfoLiterals == schema)
                {
                    if ((null == restrictions) || (0 == restrictions.Length))
                    {
                        return(connection.BuildInfoLiterals());
                    }
                    throw ODB.InvalidRestrictionsDbInfoLiteral("restrictions");
                }
                else if (OleDbSchemaGuid.SchemaGuids == schema)
                {
                    if ((null == restrictions) || (0 == restrictions.Length))
                    {
                        return(connection.BuildSchemaGuids());
                    }
                    throw ODB.InvalidRestrictionsSchemaGuids("restrictions");
                }
                else if (OleDbSchemaGuid.DbInfoKeywords == schema)
                {
                    if ((null == restrictions) || (0 == restrictions.Length))
                    {
                        return(connection.BuildInfoKeywords());
                    }
                    throw ODB.InvalidRestrictionsDbInfoKeywords("restrictions");
                }

                if (connection.SupportSchemaRowset(schema))
                {
                    return(connection.GetSchemaRowset(schema, restrictions));
                }
                else
                {
                    using (IDBSchemaRowsetWrapper wrapper = connection.IDBSchemaRowset()) {
                        if (null == wrapper.Value)
                        {
                            throw ODB.SchemaRowsetsNotSupported(Provider); // MDAC 72689
                        }
                    }
                    throw ODB.NotSupportedSchemaTable(schema, this); // MDAC 63279
                }
            }
            finally {
                Bid.ScopeLeave(ref hscp);
            }
        }
Beispiel #2
0
        public DataTable GetOleDbSchemaTable(Guid schema, object[] restrictions)
        {
            DataTable table;
            IntPtr    ptr;

            ExecutePermission.Demand();
            Bid.ScopeEnter(out ptr, "<oledb.OleDbConnection.GetOleDbSchemaTable|API> %d#, schema=%ls, restrictions\n", this.ObjectID, schema);
            try
            {
                this.CheckStateOpen("GetOleDbSchemaTable");
                OleDbConnectionInternal openConnection = this.GetOpenConnection();
                if (OleDbSchemaGuid.DbInfoLiterals == schema)
                {
                    if ((restrictions != null) && (restrictions.Length != 0))
                    {
                        throw ODB.InvalidRestrictionsDbInfoLiteral("restrictions");
                    }
                    return(openConnection.BuildInfoLiterals());
                }
                if (OleDbSchemaGuid.SchemaGuids == schema)
                {
                    if ((restrictions != null) && (restrictions.Length != 0))
                    {
                        throw ODB.InvalidRestrictionsSchemaGuids("restrictions");
                    }
                    return(openConnection.BuildSchemaGuids());
                }
                if (OleDbSchemaGuid.DbInfoKeywords == schema)
                {
                    if ((restrictions != null) && (restrictions.Length != 0))
                    {
                        throw ODB.InvalidRestrictionsDbInfoKeywords("restrictions");
                    }
                    return(openConnection.BuildInfoKeywords());
                }
                if (openConnection.SupportSchemaRowset(schema))
                {
                    return(openConnection.GetSchemaRowset(schema, restrictions));
                }
                using (IDBSchemaRowsetWrapper wrapper = openConnection.IDBSchemaRowset())
                {
                    if (wrapper.Value == null)
                    {
                        throw ODB.SchemaRowsetsNotSupported(this.Provider);
                    }
                }
                throw ODB.NotSupportedSchemaTable(schema, this);
            }
            finally
            {
                Bid.ScopeLeave(ref ptr);
            }
            return(table);
        }
Beispiel #3
0
        public DataTable GetOleDbSchemaTable(Guid schema, object[] restrictions)
        {
            CheckStateOpen(ADP.GetOleDbSchemaTable);
            OleDbConnectionInternal connection = GetOpenConnection();

            if (OleDbSchemaGuid.DbInfoLiterals == schema)
            {
                if ((null == restrictions) || (0 == restrictions.Length))
                {
                    return(connection.BuildInfoLiterals());
                }
                throw ODB.InvalidRestrictionsDbInfoLiteral("restrictions");
            }
            else if (OleDbSchemaGuid.SchemaGuids == schema)
            {
                if ((null == restrictions) || (0 == restrictions.Length))
                {
                    return(connection.BuildSchemaGuids());
                }
                throw ODB.InvalidRestrictionsSchemaGuids("restrictions");
            }
            else if (OleDbSchemaGuid.DbInfoKeywords == schema)
            {
                if ((null == restrictions) || (0 == restrictions.Length))
                {
                    return(connection.BuildInfoKeywords());
                }
                throw ODB.InvalidRestrictionsDbInfoKeywords("restrictions");
            }

            if (connection.SupportSchemaRowset(schema))
            {
                return(connection.GetSchemaRowset(schema, restrictions));
            }
            else
            {
                using (IDBSchemaRowsetWrapper wrapper = connection.IDBSchemaRowset())
                {
                    if (null == wrapper.Value)
                    {
                        throw ODB.SchemaRowsetsNotSupported(Provider);
                    }
                }
                throw ODB.NotSupportedSchemaTable(schema, this);
            }
        }
Beispiel #4
0
        private DataTable GetDataSourceInformationTable(OleDbConnection connection, OleDbConnectionInternal internalConnection)
        {
            // verify that the data source information table is in the data set
            DataTable dataSourceInformationTable = CollectionDataSet.Tables[DbMetaDataCollectionNames.DataSourceInformation];

            if (dataSourceInformationTable == null)
            {
                throw ADP.UnableToBuildCollection(DbMetaDataCollectionNames.DataSourceInformation);
            }

            // copy the table filtering out any rows that don't apply to tho current version of the prrovider
            dataSourceInformationTable = CloneAndFilterCollection(DbMetaDataCollectionNames.DataSourceInformation, null);

            // after filtering there better be just one row
            if (dataSourceInformationTable.Rows.Count != 1)
            {
                throw ADP.IncorrectNumberOfDataSourceInformationRows();
            }
            DataRow dataSourceInformation = dataSourceInformationTable.Rows[0];

            // update the identifier separator
            string catalogSeparatorPattern = internalConnection.GetLiteralInfo(ODB.DBLITERAL_CATALOG_SEPARATOR);
            string schemaSeparatorPattern  = internalConnection.GetLiteralInfo(ODB.DBLITERAL_SCHEMA_SEPARATOR);

            if (catalogSeparatorPattern != null)
            {
                StringBuilder compositeSeparatorPattern = new StringBuilder();
                StringBuilder patternEscaped            = new StringBuilder();
                ADP.EscapeSpecialCharacters(catalogSeparatorPattern, patternEscaped);
                compositeSeparatorPattern.Append(patternEscaped.ToString());
                if ((schemaSeparatorPattern != null) && (schemaSeparatorPattern != catalogSeparatorPattern))
                {
                    compositeSeparatorPattern.Append("|");
                    patternEscaped.Length = 0;
                    ADP.EscapeSpecialCharacters(schemaSeparatorPattern, patternEscaped);
                    compositeSeparatorPattern.Append(patternEscaped.ToString());
                }
                dataSourceInformation[DbMetaDataColumnNames.CompositeIdentifierSeparatorPattern] = compositeSeparatorPattern.ToString();
            }
            else if (schemaSeparatorPattern != null)
            {
                StringBuilder patternEscaped = new StringBuilder();
                ADP.EscapeSpecialCharacters(schemaSeparatorPattern, patternEscaped);
                dataSourceInformation[DbMetaDataColumnNames.CompositeIdentifierSeparatorPattern] = patternEscaped.ToString();
                ;
            }

            // update the DataSourceProductName
            object property;

            property = connection.GetDataSourcePropertyValue(OleDbPropertySetGuid.DataSourceInfo, ODB.DBPROP_DBMSNAME);
            if (property != null)
            {
                dataSourceInformation[DbMetaDataColumnNames.DataSourceProductName] = (string)property;
            }

            // update the server version strings
            dataSourceInformation[DbMetaDataColumnNames.DataSourceProductVersion]           = ServerVersion;
            dataSourceInformation[DbMetaDataColumnNames.DataSourceProductVersionNormalized] = ServerVersionNormalized;

            // values that are the same for all OLE DB Providers.
            dataSourceInformation[DbMetaDataColumnNames.ParameterMarkerFormat]  = "?";
            dataSourceInformation[DbMetaDataColumnNames.ParameterMarkerPattern] = "\\?";
            dataSourceInformation[DbMetaDataColumnNames.ParameterNameMaxLength] = 0;

            property = connection.GetDataSourcePropertyValue(OleDbPropertySetGuid.DataSourceInfo, ODB.DBPROP_GROUPBY);
            GroupByBehavior groupByBehavior = GroupByBehavior.Unknown;

            if (property != null)
            {
                switch ((int)property)
                {
                case ODB.DBPROPVAL_GB_CONTAINS_SELECT:
                    groupByBehavior = GroupByBehavior.MustContainAll;
                    break;

                case ODB.DBPROPVAL_GB_EQUALS_SELECT:
                    groupByBehavior = GroupByBehavior.ExactMatch;
                    break;

                case ODB.DBPROPVAL_GB_NO_RELATION:
                    groupByBehavior = GroupByBehavior.Unrelated;
                    break;

                case ODB.DBPROPVAL_GB_NOT_SUPPORTED:
                    groupByBehavior = GroupByBehavior.NotSupported;
                    break;
                }
            }
            dataSourceInformation[DbMetaDataColumnNames.GroupByBehavior] = groupByBehavior;

            SetIdentifierCase(DbMetaDataColumnNames.IdentifierCase, ODB.DBPROP_IDENTIFIERCASE, dataSourceInformation, connection);
            SetIdentifierCase(DbMetaDataColumnNames.QuotedIdentifierCase, ODB.DBPROP_QUOTEDIDENTIFIERCASE, dataSourceInformation, connection);

            property = connection.GetDataSourcePropertyValue(OleDbPropertySetGuid.DataSourceInfo, ODB.DBPROP_ORDERBYCOLUNSINSELECT);
            if (property != null)
            {
                dataSourceInformation[DbMetaDataColumnNames.OrderByColumnsInSelect] = (bool)property;
            }

            DataTable infoLiterals = internalConnection.BuildInfoLiterals();

            if (infoLiterals != null)
            {
                DataRow[] tableNameRow = infoLiterals.Select("Literal = " + ODB.DBLITERAL_TABLE_NAME.ToString(CultureInfo.InvariantCulture));
                if (tableNameRow != null)
                {
                    object invalidCharsObject = tableNameRow[0]["InvalidChars"];
                    if (invalidCharsObject.GetType() == typeof(string))
                    {
                        string invalidChars = (string)invalidCharsObject;
                        object invalidStartingCharsObject = tableNameRow[0]["InvalidStartingChars"];
                        string invalidStartingChars;
                        if (invalidStartingCharsObject.GetType() == typeof(string))
                        {
                            invalidStartingChars = (string)invalidStartingCharsObject;
                        }
                        else
                        {
                            invalidStartingChars = invalidChars;
                        }
                        dataSourceInformation[DbMetaDataColumnNames.IdentifierPattern] =
                            BuildRegularExpression(invalidChars, invalidStartingChars);
                    }
                }
            }

            // build the QuotedIdentifierPattern using the quote prefix and suffix from the provider and
            // assuming that the quote suffix is escaped via repetion (i.e " becomes "")
            string quotePrefix;
            string quoteSuffix;

            connection.GetLiteralQuotes(ADP.GetSchema, out quotePrefix, out quoteSuffix);

            if (quotePrefix != null)
            {
                // if the quote suffix is null assume that it is the same as the prefix (See OLEDB spec
                // IDBInfo::GetLiteralInfo DBLITERAL_QUOTE_SUFFIX.)
                if (quoteSuffix == null)
                {
                    quoteSuffix = quotePrefix;
                }

                // only know how to build the parttern if the suffix is 1 character
                // in all other cases just leave the field null
                if (quoteSuffix.Length == 1)
                {
                    StringBuilder scratchStringBuilder = new StringBuilder();
                    ADP.EscapeSpecialCharacters(quoteSuffix, scratchStringBuilder);
                    string escapedQuoteSuffixString = scratchStringBuilder.ToString();
                    scratchStringBuilder.Length = 0;

                    ADP.EscapeSpecialCharacters(quotePrefix, scratchStringBuilder);
                    scratchStringBuilder.Append("(([^");
                    scratchStringBuilder.Append(escapedQuoteSuffixString);
                    scratchStringBuilder.Append("]|");
                    scratchStringBuilder.Append(escapedQuoteSuffixString);
                    scratchStringBuilder.Append(escapedQuoteSuffixString);
                    scratchStringBuilder.Append(")*)");
                    scratchStringBuilder.Append(escapedQuoteSuffixString);
                    dataSourceInformation[DbMetaDataColumnNames.QuotedIdentifierPattern] = scratchStringBuilder.ToString();
                }
            }

            dataSourceInformationTable.AcceptChanges();

            return(dataSourceInformationTable);
        }
        private DataTable GetDataSourceInformationTable(OleDbConnection connection, OleDbConnectionInternal internalConnection)
        {
            string str3;
            string str4;
            if (base.CollectionDataSet.Tables[DbMetaDataCollectionNames.DataSourceInformation] == null)
            {
                throw ADP.UnableToBuildCollection(DbMetaDataCollectionNames.DataSourceInformation);
            }
            DataTable table = base.CloneAndFilterCollection(DbMetaDataCollectionNames.DataSourceInformation, null);
            if (table.Rows.Count != 1)
            {
                throw ADP.IncorrectNumberOfDataSourceInformationRows();
            }
            DataRow row = table.Rows[0];
            string literalInfo = internalConnection.GetLiteralInfo(3);
            string unescapedString = internalConnection.GetLiteralInfo(0x1b);
            if (literalInfo != null)
            {
                StringBuilder builder3 = new StringBuilder();
                StringBuilder escapedString = new StringBuilder();
                ADP.EscapeSpecialCharacters(literalInfo, escapedString);
                builder3.Append(escapedString.ToString());
                if ((unescapedString != null) && (unescapedString != literalInfo))
                {
                    builder3.Append("|");
                    escapedString.Length = 0;
                    ADP.EscapeSpecialCharacters(unescapedString, escapedString);
                    builder3.Append(escapedString.ToString());
                }
                row[DbMetaDataColumnNames.CompositeIdentifierSeparatorPattern] = builder3.ToString();
            }
            else if (unescapedString != null)
            {
                StringBuilder builder4 = new StringBuilder();
                ADP.EscapeSpecialCharacters(unescapedString, builder4);
                row[DbMetaDataColumnNames.CompositeIdentifierSeparatorPattern] = builder4.ToString();
            }
            object dataSourcePropertyValue = connection.GetDataSourcePropertyValue(OleDbPropertySetGuid.DataSourceInfo, 40);
            if (dataSourcePropertyValue != null)
            {
                row[DbMetaDataColumnNames.DataSourceProductName] = (string) dataSourcePropertyValue;
            }
            row[DbMetaDataColumnNames.DataSourceProductVersion] = base.ServerVersion;
            row[DbMetaDataColumnNames.DataSourceProductVersionNormalized] = base.ServerVersionNormalized;
            row[DbMetaDataColumnNames.ParameterMarkerFormat] = "?";
            row[DbMetaDataColumnNames.ParameterMarkerPattern] = @"\?";
            row[DbMetaDataColumnNames.ParameterNameMaxLength] = 0;
            dataSourcePropertyValue = connection.GetDataSourcePropertyValue(OleDbPropertySetGuid.DataSourceInfo, 0x2c);
            GroupByBehavior unknown = GroupByBehavior.Unknown;
            if (dataSourcePropertyValue != null)
            {
                switch (((int) dataSourcePropertyValue))
                {
                    case 1:
                        unknown = GroupByBehavior.NotSupported;
                        break;

                    case 2:
                        unknown = GroupByBehavior.ExactMatch;
                        break;

                    case 4:
                        unknown = GroupByBehavior.MustContainAll;
                        break;

                    case 8:
                        unknown = GroupByBehavior.Unrelated;
                        break;
                }
            }
            row[DbMetaDataColumnNames.GroupByBehavior] = unknown;
            this.SetIdentifierCase(DbMetaDataColumnNames.IdentifierCase, 0x2e, row, connection);
            this.SetIdentifierCase(DbMetaDataColumnNames.QuotedIdentifierCase, 100, row, connection);
            dataSourcePropertyValue = connection.GetDataSourcePropertyValue(OleDbPropertySetGuid.DataSourceInfo, 0x55);
            if (dataSourcePropertyValue != null)
            {
                row[DbMetaDataColumnNames.OrderByColumnsInSelect] = (bool) dataSourcePropertyValue;
            }
            DataTable table2 = internalConnection.BuildInfoLiterals();
            if (table2 != null)
            {
                DataRow[] rowArray = table2.Select("Literal = " + 0x11.ToString(CultureInfo.InvariantCulture));
                if (rowArray != null)
                {
                    object obj4 = rowArray[0]["InvalidChars"];
                    if (obj4.GetType() == typeof(string))
                    {
                        string str6;
                        string invalidChars = (string) obj4;
                        object obj3 = rowArray[0]["InvalidStartingChars"];
                        if (obj3.GetType() == typeof(string))
                        {
                            str6 = (string) obj3;
                        }
                        else
                        {
                            str6 = invalidChars;
                        }
                        row[DbMetaDataColumnNames.IdentifierPattern] = this.BuildRegularExpression(invalidChars, str6);
                    }
                }
            }
            connection.GetLiteralQuotes("GetSchema", out str4, out str3);
            if (str4 != null)
            {
                if (str3 == null)
                {
                    str3 = str4;
                }
                if (str3.Length == 1)
                {
                    StringBuilder builder = new StringBuilder();
                    ADP.EscapeSpecialCharacters(str3, builder);
                    string str2 = builder.ToString();
                    builder.Length = 0;
                    ADP.EscapeSpecialCharacters(str4, builder);
                    builder.Append("(([^");
                    builder.Append(str2);
                    builder.Append("]|");
                    builder.Append(str2);
                    builder.Append(str2);
                    builder.Append(")*)");
                    builder.Append(str2);
                    row[DbMetaDataColumnNames.QuotedIdentifierPattern] = builder.ToString();
                }
            }
            table.AcceptChanges();
            return table;
        }
        private DataTable GetDataSourceInformationTable(OleDbConnection connection, OleDbConnectionInternal internalConnection)
        {
            string str3;
            string str4;

            if (base.CollectionDataSet.Tables[DbMetaDataCollectionNames.DataSourceInformation] == null)
            {
                throw ADP.UnableToBuildCollection(DbMetaDataCollectionNames.DataSourceInformation);
            }
            DataTable table = base.CloneAndFilterCollection(DbMetaDataCollectionNames.DataSourceInformation, null);

            if (table.Rows.Count != 1)
            {
                throw ADP.IncorrectNumberOfDataSourceInformationRows();
            }
            DataRow row             = table.Rows[0];
            string  literalInfo     = internalConnection.GetLiteralInfo(3);
            string  unescapedString = internalConnection.GetLiteralInfo(0x1b);

            if (literalInfo != null)
            {
                StringBuilder builder3      = new StringBuilder();
                StringBuilder escapedString = new StringBuilder();
                ADP.EscapeSpecialCharacters(literalInfo, escapedString);
                builder3.Append(escapedString.ToString());
                if ((unescapedString != null) && (unescapedString != literalInfo))
                {
                    builder3.Append("|");
                    escapedString.Length = 0;
                    ADP.EscapeSpecialCharacters(unescapedString, escapedString);
                    builder3.Append(escapedString.ToString());
                }
                row[DbMetaDataColumnNames.CompositeIdentifierSeparatorPattern] = builder3.ToString();
            }
            else if (unescapedString != null)
            {
                StringBuilder builder4 = new StringBuilder();
                ADP.EscapeSpecialCharacters(unescapedString, builder4);
                row[DbMetaDataColumnNames.CompositeIdentifierSeparatorPattern] = builder4.ToString();
            }
            object dataSourcePropertyValue = connection.GetDataSourcePropertyValue(OleDbPropertySetGuid.DataSourceInfo, 40);

            if (dataSourcePropertyValue != null)
            {
                row[DbMetaDataColumnNames.DataSourceProductName] = (string)dataSourcePropertyValue;
            }
            row[DbMetaDataColumnNames.DataSourceProductVersion]           = base.ServerVersion;
            row[DbMetaDataColumnNames.DataSourceProductVersionNormalized] = base.ServerVersionNormalized;
            row[DbMetaDataColumnNames.ParameterMarkerFormat]  = "?";
            row[DbMetaDataColumnNames.ParameterMarkerPattern] = @"\?";
            row[DbMetaDataColumnNames.ParameterNameMaxLength] = 0;
            dataSourcePropertyValue = connection.GetDataSourcePropertyValue(OleDbPropertySetGuid.DataSourceInfo, 0x2c);
            GroupByBehavior unknown = GroupByBehavior.Unknown;

            if (dataSourcePropertyValue != null)
            {
                switch (((int)dataSourcePropertyValue))
                {
                case 1:
                    unknown = GroupByBehavior.NotSupported;
                    break;

                case 2:
                    unknown = GroupByBehavior.ExactMatch;
                    break;

                case 4:
                    unknown = GroupByBehavior.MustContainAll;
                    break;

                case 8:
                    unknown = GroupByBehavior.Unrelated;
                    break;
                }
            }
            row[DbMetaDataColumnNames.GroupByBehavior] = unknown;
            this.SetIdentifierCase(DbMetaDataColumnNames.IdentifierCase, 0x2e, row, connection);
            this.SetIdentifierCase(DbMetaDataColumnNames.QuotedIdentifierCase, 100, row, connection);
            dataSourcePropertyValue = connection.GetDataSourcePropertyValue(OleDbPropertySetGuid.DataSourceInfo, 0x55);
            if (dataSourcePropertyValue != null)
            {
                row[DbMetaDataColumnNames.OrderByColumnsInSelect] = (bool)dataSourcePropertyValue;
            }
            DataTable table2 = internalConnection.BuildInfoLiterals();

            if (table2 != null)
            {
                DataRow[] rowArray = table2.Select("Literal = " + 0x11.ToString(CultureInfo.InvariantCulture));
                if (rowArray != null)
                {
                    object obj4 = rowArray[0]["InvalidChars"];
                    if (obj4.GetType() == typeof(string))
                    {
                        string str6;
                        string invalidChars = (string)obj4;
                        object obj3         = rowArray[0]["InvalidStartingChars"];
                        if (obj3.GetType() == typeof(string))
                        {
                            str6 = (string)obj3;
                        }
                        else
                        {
                            str6 = invalidChars;
                        }
                        row[DbMetaDataColumnNames.IdentifierPattern] = this.BuildRegularExpression(invalidChars, str6);
                    }
                }
            }
            connection.GetLiteralQuotes("GetSchema", out str4, out str3);
            if (str4 != null)
            {
                if (str3 == null)
                {
                    str3 = str4;
                }
                if (str3.Length == 1)
                {
                    StringBuilder builder = new StringBuilder();
                    ADP.EscapeSpecialCharacters(str3, builder);
                    string str2 = builder.ToString();
                    builder.Length = 0;
                    ADP.EscapeSpecialCharacters(str4, builder);
                    builder.Append("(([^");
                    builder.Append(str2);
                    builder.Append("]|");
                    builder.Append(str2);
                    builder.Append(str2);
                    builder.Append(")*)");
                    builder.Append(str2);
                    row[DbMetaDataColumnNames.QuotedIdentifierPattern] = builder.ToString();
                }
            }
            table.AcceptChanges();
            return(table);
        }
        private DataTable GetDataSourceInformationTable(OleDbConnection connection, OleDbConnectionInternal internalConnection){

            // verify that the data source information table is in the data set
            DataTable dataSourceInformationTable = CollectionDataSet.Tables[DbMetaDataCollectionNames.DataSourceInformation];
            if (dataSourceInformationTable == null){
                throw ADP.UnableToBuildCollection(DbMetaDataCollectionNames.DataSourceInformation);
            }

            // copy the table filtering out any rows that don't apply to tho current version of the prrovider
            dataSourceInformationTable = CloneAndFilterCollection(DbMetaDataCollectionNames.DataSourceInformation, null);

            // after filtering there better be just one row
            if (dataSourceInformationTable.Rows.Count != 1){
                throw ADP.IncorrectNumberOfDataSourceInformationRows();
            }
            DataRow dataSourceInformation = dataSourceInformationTable.Rows[0];

            // update the identifier separator
            string catalogSeparatorPattern = internalConnection.GetLiteralInfo(ODB.DBLITERAL_CATALOG_SEPARATOR);
            string schemaSeparatorPattern = internalConnection.GetLiteralInfo(ODB.DBLITERAL_SCHEMA_SEPARATOR);

            if (catalogSeparatorPattern != null) {
                StringBuilder compositeSeparatorPattern = new StringBuilder();
                StringBuilder patternEscaped = new StringBuilder();
                ADP.EscapeSpecialCharacters(catalogSeparatorPattern,patternEscaped);
                compositeSeparatorPattern.Append(patternEscaped.ToString());
                if ((schemaSeparatorPattern != null) && (schemaSeparatorPattern != catalogSeparatorPattern)) {
                    compositeSeparatorPattern.Append("|");
                    patternEscaped.Length = 0;
                    ADP.EscapeSpecialCharacters(schemaSeparatorPattern,patternEscaped);
                    compositeSeparatorPattern.Append(patternEscaped.ToString());
                }
                    dataSourceInformation[DbMetaDataColumnNames.CompositeIdentifierSeparatorPattern] = compositeSeparatorPattern.ToString();
            }
            else if (schemaSeparatorPattern != null){
                StringBuilder patternEscaped = new StringBuilder();
                ADP.EscapeSpecialCharacters(schemaSeparatorPattern, patternEscaped);
                dataSourceInformation[DbMetaDataColumnNames.CompositeIdentifierSeparatorPattern] = patternEscaped.ToString();;
            }

            // update the DataSourceProductName
            object property;
            property = connection.GetDataSourcePropertyValue(OleDbPropertySetGuid.DataSourceInfo,ODB.DBPROP_DBMSNAME);
            if (property != null) {
                dataSourceInformation[DbMetaDataColumnNames.DataSourceProductName] = (string) property;
            }

            // update the server version strings
            dataSourceInformation[DbMetaDataColumnNames.DataSourceProductVersion] = ServerVersion;
            dataSourceInformation[DbMetaDataColumnNames.DataSourceProductVersionNormalized] = ServerVersionNormalized;


                // values that are the same for all OLE DB Providers. See SQLBU 308529
                dataSourceInformation[DbMetaDataColumnNames.ParameterMarkerFormat] =  "?";
                dataSourceInformation[DbMetaDataColumnNames.ParameterMarkerPattern] =  "\\?";
                dataSourceInformation[DbMetaDataColumnNames.ParameterNameMaxLength] = 0;


            property = connection.GetDataSourcePropertyValue(OleDbPropertySetGuid.DataSourceInfo,ODB.DBPROP_GROUPBY);
            GroupByBehavior groupByBehavior = GroupByBehavior.Unknown;
            if (property != null) {
                switch ((int)property) {

                    case ODB.DBPROPVAL_GB_CONTAINS_SELECT:
                        groupByBehavior = GroupByBehavior.MustContainAll;
                        break;

                    case ODB.DBPROPVAL_GB_EQUALS_SELECT:
                        groupByBehavior = GroupByBehavior.ExactMatch;
                        break;

                    case ODB.DBPROPVAL_GB_NO_RELATION:
                        groupByBehavior = GroupByBehavior.Unrelated;
                        break;

                    case ODB.DBPROPVAL_GB_NOT_SUPPORTED:
                        groupByBehavior = GroupByBehavior.NotSupported;
                        break;
                }
            }
            dataSourceInformation[DbMetaDataColumnNames.GroupByBehavior] = groupByBehavior;

            SetIdentifierCase(DbMetaDataColumnNames.IdentifierCase,ODB.DBPROP_IDENTIFIERCASE,dataSourceInformation, connection);
            SetIdentifierCase(DbMetaDataColumnNames.QuotedIdentifierCase,ODB.DBPROP_QUOTEDIDENTIFIERCASE,dataSourceInformation, connection);

            property = connection.GetDataSourcePropertyValue(OleDbPropertySetGuid.DataSourceInfo,ODB.DBPROP_ORDERBYCOLUNSINSELECT);
            if (property != null) {
                dataSourceInformation[DbMetaDataColumnNames.OrderByColumnsInSelect] = (bool) property;
            }

            DataTable infoLiterals = internalConnection.BuildInfoLiterals();
            if (infoLiterals != null){
                DataRow[] tableNameRow = infoLiterals.Select("Literal = " + ODB.DBLITERAL_TABLE_NAME.ToString(CultureInfo.InvariantCulture));
                if (tableNameRow != null) {
                    object invalidCharsObject = tableNameRow[0]["InvalidChars"];
                    if (invalidCharsObject.GetType() == typeof(string)) {
                        string invalidChars = (string)invalidCharsObject;
                        object invalidStartingCharsObject = tableNameRow[0]["InvalidStartingChars"];
                        string invalidStartingChars;
                        if (invalidStartingCharsObject.GetType() == typeof(string)) {
                            invalidStartingChars = (string)invalidStartingCharsObject;
                        }
                        else {
                            invalidStartingChars = invalidChars;
                        }
                        dataSourceInformation[DbMetaDataColumnNames.IdentifierPattern] =
                                                    BuildRegularExpression(invalidChars,invalidStartingChars);
                    }
                }
            }

            // build the QuotedIdentifierPattern using the quote prefix and suffix from the provider and
            // assuming that the quote suffix is escaped via repetion (i.e " becomes "")
            string quotePrefix;
            string quoteSuffix;
            connection.GetLiteralQuotes(ADP.GetSchema, out quotePrefix, out quoteSuffix);

            if (quotePrefix != null){

                // if the quote suffix is null assume that it is the same as the prefix (See OLEDB spec
                // IDBInfo::GetLiteralInfo DBLITERAL_QUOTE_SUFFIX.)
                if (quoteSuffix == null) {
                    quoteSuffix = quotePrefix;
                }

                // only know how to build the parttern if the suffix is 1 character
                // in all other cases just leave the field null
                if (quoteSuffix.Length == 1) {
                    StringBuilder scratchStringBuilder = new StringBuilder();
                    ADP.EscapeSpecialCharacters(quoteSuffix,scratchStringBuilder );
                    string escapedQuoteSuffixString = scratchStringBuilder.ToString();
                    scratchStringBuilder.Length = 0;

                    ADP.EscapeSpecialCharacters(quotePrefix, scratchStringBuilder);
                    scratchStringBuilder.Append("(([^");
                    scratchStringBuilder.Append(escapedQuoteSuffixString);
                    scratchStringBuilder.Append("]|");
                    scratchStringBuilder.Append(escapedQuoteSuffixString);
                    scratchStringBuilder.Append(escapedQuoteSuffixString);
                    scratchStringBuilder.Append(")*)");
                    scratchStringBuilder.Append(escapedQuoteSuffixString);
                    dataSourceInformation[DbMetaDataColumnNames.QuotedIdentifierPattern] = scratchStringBuilder.ToString();
                }
            }

            dataSourceInformationTable.AcceptChanges();

            return dataSourceInformationTable;
        }