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


C# OdbcConnection.SQLGetFunctions方法代码示例

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


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

示例1: OdbcMetaDataFactory

 internal OdbcMetaDataFactory(Stream XMLStream, string serverVersion, string serverVersionNormalized, OdbcConnection connection) : base(XMLStream, serverVersion, serverVersionNormalized)
 {
     this._schemaMapping = new SchemaFunctionName[] { new SchemaFunctionName(DbMetaDataCollectionNames.DataTypes, ODBC32.SQL_API.SQLGETTYPEINFO), new SchemaFunctionName(OdbcMetaDataCollectionNames.Columns, ODBC32.SQL_API.SQLCOLUMNS), new SchemaFunctionName(OdbcMetaDataCollectionNames.Indexes, ODBC32.SQL_API.SQLSTATISTICS), new SchemaFunctionName(OdbcMetaDataCollectionNames.Procedures, ODBC32.SQL_API.SQLPROCEDURES), new SchemaFunctionName(OdbcMetaDataCollectionNames.ProcedureColumns, ODBC32.SQL_API.SQLPROCEDURECOLUMNS), new SchemaFunctionName(OdbcMetaDataCollectionNames.ProcedureParameters, ODBC32.SQL_API.SQLPROCEDURECOLUMNS), new SchemaFunctionName(OdbcMetaDataCollectionNames.Tables, ODBC32.SQL_API.SQLTABLES), new SchemaFunctionName(OdbcMetaDataCollectionNames.Views, ODBC32.SQL_API.SQLTABLES) };
     if (base.CollectionDataSet.Tables[DbMetaDataCollectionNames.MetaDataCollections] == null)
     {
         throw ADP.UnableToBuildCollection(DbMetaDataCollectionNames.MetaDataCollections);
     }
     DataTable table2 = base.CloneAndFilterCollection(DbMetaDataCollectionNames.MetaDataCollections, null);
     DataTable table = base.CollectionDataSet.Tables[DbMetaDataCollectionNames.Restrictions];
     if (table != null)
     {
         table = base.CloneAndFilterCollection(DbMetaDataCollectionNames.Restrictions, null);
     }
     DataColumn column3 = table2.Columns["PopulationMechanism"];
     DataColumn column2 = table2.Columns["CollectionName"];
     DataColumn column = null;
     if (table != null)
     {
         column = table.Columns["CollectionName"];
     }
     foreach (DataRow row in table2.Rows)
     {
         if (!(((string) row[column3]) == "PrepareCollection"))
         {
             continue;
         }
         int index = -1;
         for (int i = 0; i < this._schemaMapping.Length; i++)
         {
             if (this._schemaMapping[i]._schemaName == ((string) row[column2]))
             {
                 index = i;
                 break;
             }
         }
         if ((index != -1) && !connection.SQLGetFunctions(this._schemaMapping[index]._odbcFunction))
         {
             if (table != null)
             {
                 foreach (DataRow row2 in table.Rows)
                 {
                     if (((string) row[column2]) == ((string) row2[column]))
                     {
                         row2.Delete();
                     }
                 }
                 table.AcceptChanges();
             }
             row.Delete();
         }
     }
     table2.AcceptChanges();
     base.CollectionDataSet.Tables.Remove(base.CollectionDataSet.Tables[DbMetaDataCollectionNames.MetaDataCollections]);
     base.CollectionDataSet.Tables.Add(table2);
     if (table != null)
     {
         base.CollectionDataSet.Tables.Remove(base.CollectionDataSet.Tables[DbMetaDataCollectionNames.Restrictions]);
         base.CollectionDataSet.Tables.Add(table);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:60,代码来源:OdbcMetaDataFactory.cs

示例2: OdbcMetaDataFactory

        internal OdbcMetaDataFactory(Stream XMLStream,
                                   string serverVersion,
                                   string serverVersionNormalized,
                                   OdbcConnection connection):
            base(XMLStream, serverVersion, serverVersionNormalized) {

            // set up the colletion name ODBC function mapping guid mapping
            _schemaMapping = new SchemaFunctionName[] {

                new SchemaFunctionName(DbMetaDataCollectionNames.DataTypes,ODBC32.SQL_API.SQLGETTYPEINFO),
                new SchemaFunctionName(OdbcMetaDataCollectionNames.Columns,ODBC32.SQL_API.SQLCOLUMNS),
                new SchemaFunctionName(OdbcMetaDataCollectionNames.Indexes,ODBC32.SQL_API.SQLSTATISTICS),
                new SchemaFunctionName(OdbcMetaDataCollectionNames.Procedures,ODBC32.SQL_API.SQLPROCEDURES),
                new SchemaFunctionName(OdbcMetaDataCollectionNames.ProcedureColumns,ODBC32.SQL_API.SQLPROCEDURECOLUMNS),
                new SchemaFunctionName(OdbcMetaDataCollectionNames.ProcedureParameters,ODBC32.SQL_API.SQLPROCEDURECOLUMNS),
                new SchemaFunctionName(OdbcMetaDataCollectionNames.Tables,ODBC32.SQL_API.SQLTABLES),
                new SchemaFunctionName(OdbcMetaDataCollectionNames.Views,ODBC32.SQL_API.SQLTABLES)};

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

            // copy the table filtering out any rows that don't apply to the current version of the provider
            metaDataCollectionsTable = CloneAndFilterCollection(DbMetaDataCollectionNames.MetaDataCollections, null);

            // verify the existance of the table in the data set
            DataTable restrictionsTable = CollectionDataSet.Tables[DbMetaDataCollectionNames.Restrictions];
            if (restrictionsTable != null){
                // copy the table filtering out any rows that don't apply to the current version of the provider
                restrictionsTable= CloneAndFilterCollection(DbMetaDataCollectionNames.Restrictions, null);
            }

            // need to filter out any of the collections where
            // 1) it is populated using prepare collection
            // 2) it is in the collection to odbc function mapping above
            // 3) the provider does not support the necessary odbc function


            DataColumn populationMechanism = metaDataCollectionsTable.Columns[_populationMechanism];
            DataColumn collectionName = metaDataCollectionsTable.Columns[_collectionName];
            DataColumn restrictionCollectionName = null;
            if (restrictionsTable != null){
                restrictionCollectionName = restrictionsTable.Columns[_collectionName];
            }

            foreach (DataRow collection in metaDataCollectionsTable.Rows){
                if ((string)collection[populationMechanism] == _prepareCollection) {
                    // is the collection in the mapping
                    int mapping = -1;
                    for (int i = 0; i < _schemaMapping.Length; i++){
                        if (_schemaMapping[i]._schemaName == (string)collection[collectionName]){
                           mapping = i;
                           break;
                        }
                    }
                    // no go on to the next collection
                    if (mapping == -1) {
                        continue;
                    }

                    // does the provider support the necessary odbc function
                    // if not delete the row from the table
                    if (connection.SQLGetFunctions(_schemaMapping[mapping]._odbcFunction) == false){
                        // but first delete any related restrictions
                        if (restrictionsTable != null) {
                            foreach (DataRow restriction in restrictionsTable.Rows) {
                                if ((string)collection[collectionName]==(string)restriction[restrictionCollectionName]) {
                                    restriction.Delete();
                                }
                            }
                            restrictionsTable.AcceptChanges();
                        }
                        collection.Delete();
                    }

                }
            }

            // replace the original table with the updated one
            metaDataCollectionsTable.AcceptChanges();
            CollectionDataSet.Tables.Remove(CollectionDataSet.Tables[DbMetaDataCollectionNames.MetaDataCollections]);
            CollectionDataSet.Tables.Add(metaDataCollectionsTable);

            if (restrictionsTable != null) {
                CollectionDataSet.Tables.Remove(CollectionDataSet.Tables[DbMetaDataCollectionNames.Restrictions]);
                CollectionDataSet.Tables.Add(restrictionsTable);
            }

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


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