当前位置: 首页>>代码示例>>C#>>正文


C# OdbcConnection.GetInfoStringUnhandled方法代码示例

本文整理汇总了C#中System.Data.Odbc.OdbcConnection.GetInfoStringUnhandled方法的典型用法代码示例。如果您正苦于以下问题:C# OdbcConnection.GetInfoStringUnhandled方法的具体用法?C# OdbcConnection.GetInfoStringUnhandled怎么用?C# OdbcConnection.GetInfoStringUnhandled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Data.Odbc.OdbcConnection的用法示例。


在下文中一共展示了OdbcConnection.GetInfoStringUnhandled方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetReservedWordsCollection

        private DataTable GetReservedWordsCollection(string[] restrictions, OdbcConnection connection){

            if (ADP.IsEmptyArray(restrictions) == false){
               throw ADP.TooManyRestrictions(DbMetaDataCollectionNames.ReservedWords);
            }

            // verify the existance of the table in the data set
            DataTable reservedWordsTable = CollectionDataSet.Tables[DbMetaDataCollectionNames.ReservedWords];
            if (reservedWordsTable == null){
                throw ADP.UnableToBuildCollection(DbMetaDataCollectionNames.ReservedWords);
            }

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

            DataColumn reservedWordColumn = reservedWordsTable.Columns[DbMetaDataColumnNames.ReservedWord];
            if (reservedWordColumn == null){
                throw ADP.UnableToBuildCollection(DbMetaDataCollectionNames.ReservedWords);
            }

            string keywords = connection.GetInfoStringUnhandled(ODBC32.SQL_INFO.KEYWORDS);

            if (null != keywords) {
                string[] values = keywords.Split(KeywordSeparatorChar);
                for (int i = 0; i < values.Length; ++i) {
                    DataRow row = reservedWordsTable.NewRow();
                    row[reservedWordColumn] = values[i];

                    reservedWordsTable.Rows.Add(row);
                    row.AcceptChanges();
                }
            }

            return  reservedWordsTable;
        }
开发者ID:uQr,项目名称:referencesource,代码行数:35,代码来源:odbcmetadatafactory.cs

示例2: GetReservedWordsCollection

 private DataTable GetReservedWordsCollection(string[] restrictions, OdbcConnection connection)
 {
     if (!ADP.IsEmptyArray(restrictions))
     {
         throw ADP.TooManyRestrictions(DbMetaDataCollectionNames.ReservedWords);
     }
     if (base.CollectionDataSet.Tables[DbMetaDataCollectionNames.ReservedWords] == null)
     {
         throw ADP.UnableToBuildCollection(DbMetaDataCollectionNames.ReservedWords);
     }
     DataTable table = base.CloneAndFilterCollection(DbMetaDataCollectionNames.ReservedWords, null);
     DataColumn column = table.Columns[DbMetaDataColumnNames.ReservedWord];
     if (column == null)
     {
         throw ADP.UnableToBuildCollection(DbMetaDataCollectionNames.ReservedWords);
     }
     string infoStringUnhandled = connection.GetInfoStringUnhandled(ODBC32.SQL_INFO.KEYWORDS);
     if (infoStringUnhandled != null)
     {
         string[] strArray = infoStringUnhandled.Split(KeywordSeparatorChar);
         for (int i = 0; i < strArray.Length; i++)
         {
             DataRow row = table.NewRow();
             row[column] = strArray[i];
             table.Rows.Add(row);
             row.AcceptChanges();
         }
     }
     return table;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:30,代码来源:OdbcMetaDataFactory.cs

示例3: GetDataSourceInformationCollection

        private DataTable GetDataSourceInformationCollection(string [] restrictions,
                                                             OdbcConnection connection){

            if (ADP.IsEmptyArray(restrictions) == false) {
               throw ADP.TooManyRestrictions(DbMetaDataCollectionNames.DataSourceInformation);
            }

            // 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 the current version of the provider
            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];

            string stringValue;
            Int16 int16Value;
            Int32 int32Value;
            ODBC32.RetCode retcode;

            // update the catalog separator
            stringValue = connection.GetInfoStringUnhandled(ODBC32.SQL_INFO.CATALOG_NAME_SEPARATOR);
            if (!ADP.IsEmpty(stringValue)) {
                StringBuilder patternEscaped = new StringBuilder();
                ADP.EscapeSpecialCharacters(stringValue,patternEscaped);
                dataSourceInformation[DbMetaDataColumnNames.CompositeIdentifierSeparatorPattern] = patternEscaped.ToString();
            }

            // get the DBMS Name
            stringValue = connection.GetInfoStringUnhandled(ODBC32.SQL_INFO.DBMS_NAME);
            if (stringValue != null) {
                dataSourceInformation[DbMetaDataColumnNames.DataSourceProductName] = stringValue;
            }


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

            
            // values that are the same for all ODBC drivers. See 
            dataSourceInformation[DbMetaDataColumnNames.ParameterMarkerFormat] =  "?";
            dataSourceInformation[DbMetaDataColumnNames.ParameterMarkerPattern] =  "\\?";
            dataSourceInformation[DbMetaDataColumnNames.ParameterNameMaxLength] = 0;

            // determine the supportedJoinOperators
            // leave the column null if the GetInfo fails. There is no explicit value for
            // unknown.
            if (connection.IsV3Driver) {
                    
                retcode = connection.GetInfoInt32Unhandled(ODBC32.SQL_INFO.SQL_OJ_CAPABILITIES_30,out int32Value);
            }
            else {
                retcode = connection.GetInfoInt32Unhandled(ODBC32.SQL_INFO.SQL_OJ_CAPABILITIES_20, out int32Value);
            }
                 
            if ((retcode == ODBC32.RetCode.SUCCESS) || (retcode == ODBC32.RetCode.SUCCESS_WITH_INFO)){

                Common. SupportedJoinOperators supportedJoinOperators = Common.SupportedJoinOperators.None;
                if ((int32Value & (Int32)ODBC32.SQL_OJ_CAPABILITIES.LEFT) != 0){
                    supportedJoinOperators = supportedJoinOperators | Common.SupportedJoinOperators.LeftOuter;
                }
                if ((int32Value & (Int32)ODBC32.SQL_OJ_CAPABILITIES.RIGHT) != 0){
                    supportedJoinOperators = supportedJoinOperators | Common.SupportedJoinOperators.RightOuter;
                } 
                if ((int32Value & (Int32)ODBC32.SQL_OJ_CAPABILITIES.FULL) != 0){
                    supportedJoinOperators = supportedJoinOperators | Common.SupportedJoinOperators.FullOuter;
                }
                if ((int32Value & (Int32)ODBC32.SQL_OJ_CAPABILITIES.INNER) != 0){
                    supportedJoinOperators = supportedJoinOperators | Common.SupportedJoinOperators.Inner;
                }
                        
                dataSourceInformation[DbMetaDataColumnNames.SupportedJoinOperators] = supportedJoinOperators;
            }

            // determine the GroupByBehavior
            retcode = connection.GetInfoInt16Unhandled(ODBC32.SQL_INFO.GROUP_BY, out int16Value);
            Common.GroupByBehavior groupByBehavior = Common.GroupByBehavior.Unknown;

            if ((retcode == ODBC32.RetCode.SUCCESS) || (retcode == ODBC32.RetCode.SUCCESS_WITH_INFO)){

                switch (int16Value) {

                    case (Int16)ODBC32.SQL_GROUP_BY.NOT_SUPPORTED:
                        groupByBehavior = Common.GroupByBehavior.NotSupported;
                        break;

                    case (Int16)ODBC32.SQL_GROUP_BY.GROUP_BY_EQUALS_SELECT:
                        groupByBehavior = Common.GroupByBehavior.ExactMatch;
                        break;

                    case (Int16)ODBC32.SQL_GROUP_BY.GROUP_BY_CONTAINS_SELECT:
                        groupByBehavior = Common.GroupByBehavior.MustContainAll;
//.........这里部分代码省略.........
开发者ID:uQr,项目名称:referencesource,代码行数:101,代码来源:odbcmetadatafactory.cs

示例4: GetDataSourceInformationCollection

        private DataTable GetDataSourceInformationCollection(string[] restrictions, OdbcConnection connection)
        {
            ODBC32.RetCode code;
            int num;
            short num2;
            if (!ADP.IsEmptyArray(restrictions))
            {
                throw ADP.TooManyRestrictions(DbMetaDataCollectionNames.DataSourceInformation);
            }
            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 infoStringUnhandled = connection.GetInfoStringUnhandled(ODBC32.SQL_INFO.CATALOG_NAME_SEPARATOR);
            if (!ADP.IsEmpty(infoStringUnhandled))
            {
                StringBuilder escapedString = new StringBuilder();
                ADP.EscapeSpecialCharacters(infoStringUnhandled, escapedString);
                row[DbMetaDataColumnNames.CompositeIdentifierSeparatorPattern] = escapedString.ToString();
            }
            infoStringUnhandled = connection.GetInfoStringUnhandled(ODBC32.SQL_INFO.DBMS_NAME);
            if (infoStringUnhandled != null)
            {
                row[DbMetaDataColumnNames.DataSourceProductName] = infoStringUnhandled;
            }
            row[DbMetaDataColumnNames.DataSourceProductVersion] = base.ServerVersion;
            row[DbMetaDataColumnNames.DataSourceProductVersionNormalized] = base.ServerVersionNormalized;
            row[DbMetaDataColumnNames.ParameterMarkerFormat] = "?";
            row[DbMetaDataColumnNames.ParameterMarkerPattern] = @"\?";
            row[DbMetaDataColumnNames.ParameterNameMaxLength] = 0;
            if (connection.IsV3Driver)
            {
                code = connection.GetInfoInt32Unhandled(ODBC32.SQL_INFO.SQL_OJ_CAPABILITIES_30, out num);
            }
            else
            {
                code = connection.GetInfoInt32Unhandled(ODBC32.SQL_INFO.SQL_OJ_CAPABILITIES_20, out num);
            }
            if ((code == ODBC32.RetCode.SUCCESS) || (code == ODBC32.RetCode.SUCCESS_WITH_INFO))
            {
                SupportedJoinOperators none = SupportedJoinOperators.None;
                if ((num & 1) != 0)
                {
                    none |= SupportedJoinOperators.LeftOuter;
                }
                if ((num & 2) != 0)
                {
                    none |= SupportedJoinOperators.RightOuter;
                }
                if ((num & 4) != 0)
                {
                    none |= SupportedJoinOperators.FullOuter;
                }
                if ((num & 0x20) != 0)
                {
                    none |= SupportedJoinOperators.Inner;
                }
                row[DbMetaDataColumnNames.SupportedJoinOperators] = none;
            }
            code = connection.GetInfoInt16Unhandled(ODBC32.SQL_INFO.GROUP_BY, out num2);
            GroupByBehavior unknown = GroupByBehavior.Unknown;
            if ((code == ODBC32.RetCode.SUCCESS) || (code == ODBC32.RetCode.SUCCESS_WITH_INFO))
            {
                switch (num2)
                {
                    case 0:
                        unknown = GroupByBehavior.NotSupported;
                        break;

                    case 1:
                        unknown = GroupByBehavior.ExactMatch;
                        break;

                    case 2:
                        unknown = GroupByBehavior.MustContainAll;
                        break;

                    case 3:
                        unknown = GroupByBehavior.Unrelated;
                        break;
                }
            }
            row[DbMetaDataColumnNames.GroupByBehavior] = unknown;
            code = connection.GetInfoInt16Unhandled(ODBC32.SQL_INFO.IDENTIFIER_CASE, out num2);
            IdentifierCase insensitive = IdentifierCase.Unknown;
            if ((code == ODBC32.RetCode.SUCCESS) || (code == ODBC32.RetCode.SUCCESS_WITH_INFO))
            {
                switch (num2)
                {
                    case 1:
                    case 2:
                    case 4:
                        insensitive = IdentifierCase.Insensitive;
                        break;
//.........这里部分代码省略.........
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:101,代码来源:OdbcMetaDataFactory.cs


注:本文中的System.Data.Odbc.OdbcConnection.GetInfoStringUnhandled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。