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


C# OdbcStatementHandle.DangerousAddRef方法代码示例

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


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

示例1: OdbcHandle

 internal OdbcHandle(OdbcStatementHandle parentHandle, ODBC32.SQL_ATTR attribute) : base(IntPtr.Zero, true)
 {
     ODBC32.RetCode code;
     this._handleType = ODBC32.SQL_HANDLE.DESC;
     bool success = false;
     RuntimeHelpers.PrepareConstrainedRegions();
     try
     {
         int num;
         parentHandle.DangerousAddRef(ref success);
         code = parentHandle.GetStatementAttribute(attribute, out this.handle, out num);
     }
     finally
     {
         if (success)
         {
             if (IntPtr.Zero != base.handle)
             {
                 this._parentHandle = parentHandle;
             }
             else
             {
                 parentHandle.DangerousRelease();
             }
         }
     }
     if (ADP.PtrZero == base.handle)
     {
         throw ODBC.FailedToGetDescriptorHandle(code);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:31,代码来源:OdbcHandle.cs

示例2: OdbcHandle

        internal OdbcHandle(OdbcStatementHandle parentHandle, ODBC32.SQL_ATTR attribute) : base(IntPtr.Zero, true) {
            Debug.Assert((ODBC32.SQL_ATTR.APP_PARAM_DESC == attribute) || (ODBC32.SQL_ATTR.APP_ROW_DESC == attribute), "invalid attribute");
            _handleType   = ODBC32.SQL_HANDLE.DESC;

            int cbActual;
            ODBC32.RetCode retcode;
            bool mustRelease = false;
            RuntimeHelpers.PrepareConstrainedRegions();
            try {
                // must addref before calling native so it won't be released just after
                parentHandle.DangerousAddRef(ref mustRelease);

                retcode = parentHandle.GetStatementAttribute(attribute, out base.handle, out cbActual);
            }
            finally {
                if (mustRelease) {
                    if (IntPtr.Zero != base.handle) {
                        // must call DangerousAddRef after a handle is actually created
                        // since ReleaseHandle will only call DangerousRelease if a handle exists
                        _parentHandle = parentHandle;
                    }
                    else {
                        // without a handle, ReleaseHandle may not be called
                        parentHandle.DangerousRelease();
                    }
                }
            }
            if (ADP.PtrZero == base.handle) {
                throw ODBC.FailedToGetDescriptorHandle(retcode);
            }
            // no info-message handle on getting a descriptor handle
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:32,代码来源:OdbcHandle.cs


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