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


C# Odbc.OdbcStatementHandle类代码示例

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


OdbcStatementHandle类属于System.Data.Odbc命名空间,在下文中一共展示了OdbcStatementHandle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: SQLBindCol

 static internal extern /*SQLRETURN*/ODBC32.RetCode SQLBindCol(
     /*SQLHSTMT*/OdbcStatementHandle StatementHandle,
     /*SQLUSMALLINT*/UInt16 ColumnNumber,
     /*SQLSMALLINT*/ODBC32.SQL_C TargetType,
     /*SQLPOINTER*/IntPtr TargetValue,
     /*SQLLEN*/IntPtr BufferLength,
     /*SQLLEN* */IntPtr StrLen_or_Ind);
开发者ID:uQr,项目名称:referencesource,代码行数:7,代码来源:UnsafeNativeMethods.cs

示例3: DisposeKeyInfoStatementHandle

 internal void DisposeKeyInfoStatementHandle()
 {
     OdbcStatementHandle handle = this._keyinfostmt;
     if (handle != null)
     {
         this._keyinfostmt = null;
         handle.Dispose();
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:CMDWrapper.cs

示例4: SQLBindParameter

 static internal extern /*SQLRETURN*/ODBC32.RetCode SQLBindParameter(
     /*SQLHSTMT*/OdbcStatementHandle StatementHandle,
     /*SQLUSMALLINT*/UInt16 ParameterNumber,
     /*SQLSMALLINT*/Int16 ParamDirection,
     /*SQLSMALLINT*/ODBC32.SQL_C SQLCType,
     /*SQLSMALLINT*/Int16 SQLType,
     /*SQLULEN*/IntPtr    cbColDef,
     /*SQLSMALLINT*/IntPtr ibScale,
     /*SQLPOINTER*/HandleRef rgbValue,
     /*SQLLEN*/IntPtr BufferLength,
     /*SQLLEN* */HandleRef StrLen_or_Ind);
开发者ID:uQr,项目名称:referencesource,代码行数:11,代码来源:UnsafeNativeMethods.cs

示例5: DisposeStatementHandle

 internal void DisposeStatementHandle()
 {
     this.DisposeKeyInfoStatementHandle();
     this.DisposeDescriptorHandle();
     OdbcStatementHandle handle = this._stmt;
     if (handle != null)
     {
         this._stmt = null;
         handle.Dispose();
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:CMDWrapper.cs

示例6: SQLNumResultCols

 static internal extern /*SQLRETURN*/ODBC32.RetCode SQLNumResultCols(
     /*SQLHSTMT*/OdbcStatementHandle  StatementHandle,
     /*SQLSMALLINT* */out Int16 ColumnCount);
开发者ID:uQr,项目名称:referencesource,代码行数:3,代码来源:UnsafeNativeMethods.cs

示例7: SQLMoreResults

 static internal extern /*SQLRETURN*/ODBC32.RetCode SQLMoreResults(
     /*SQLHSTMT*/OdbcStatementHandle  StatementHandle);
开发者ID:uQr,项目名称:referencesource,代码行数:2,代码来源:UnsafeNativeMethods.cs

示例8: Bind

 internal void Bind(OdbcStatementHandle hstmt, OdbcCommand command, short ordinal, CNativeBuffer parameterBuffer, bool allowReentrance)
 {
     ODBC32.SQL_C sql_c = this._prepared_Sql_C_Type;
     ODBC32.SQL_PARAM sql_param = this.SqlDirectionFromParameterDirection();
     int offset = this._preparedOffset;
     int sizeorprecision = this._preparedSize;
     object obj2 = this._preparedValue;
     int valueSize = this.GetValueSize(obj2, offset);
     int num4 = this.GetColumnSize(obj2, offset, ordinal);
     byte parameterPrecision = this.GetParameterPrecision(obj2);
     byte parameterScale = this.GetParameterScale(obj2);
     HandleRef buffer = parameterBuffer.PtrOffset(this._preparedValueOffset, this._preparedBufferSize);
     HandleRef intbuffer = parameterBuffer.PtrOffset(this._preparedIntOffset, IntPtr.Size);
     if (ODBC32.SQL_C.NUMERIC == sql_c)
     {
         if (((ODBC32.SQL_PARAM.INPUT_OUTPUT == sql_param) && (obj2 is decimal)) && (parameterScale < this._internalScale))
         {
             while (parameterScale < this._internalScale)
             {
                 obj2 = ((decimal) obj2) * 10M;
                 parameterScale = (byte) (parameterScale + 1);
             }
         }
         this.SetInputValue(obj2, sql_c, valueSize, parameterPrecision, 0, parameterBuffer);
         if (ODBC32.SQL_PARAM.INPUT != sql_param)
         {
             parameterBuffer.WriteInt16(this._preparedValueOffset, (short) ((parameterScale << 8) | parameterPrecision));
         }
     }
     else
     {
         this.SetInputValue(obj2, sql_c, valueSize, sizeorprecision, offset, parameterBuffer);
     }
     if (((this._hasChanged || (this._boundSqlCType != sql_c)) || ((this._boundParameterType != this._bindtype._sql_type) || (this._boundSize != num4))) || (((this._boundScale != parameterScale) || (this._boundBuffer != buffer.Handle)) || (this._boundIntbuffer != intbuffer.Handle)))
     {
         ODBC32.RetCode retcode = hstmt.BindParameter(ordinal, (short) sql_param, sql_c, this._bindtype._sql_type, (IntPtr) num4, (IntPtr) parameterScale, buffer, (IntPtr) this._preparedBufferSize, intbuffer);
         if (retcode != ODBC32.RetCode.SUCCESS)
         {
             if ("07006" == command.GetDiagSqlState())
             {
                 Bid.Trace("<odbc.OdbcParameter.Bind|ERR> Call to BindParameter returned errorcode [07006]\n");
                 command.Connection.FlagRestrictedSqlBindType(this._bindtype._sql_type);
                 if (allowReentrance)
                 {
                     this.Bind(hstmt, command, ordinal, parameterBuffer, false);
                     return;
                 }
             }
             command.Connection.HandleError(hstmt, retcode);
         }
         this._hasChanged = false;
         this._boundSqlCType = sql_c;
         this._boundParameterType = this._bindtype._sql_type;
         this._boundSize = num4;
         this._boundScale = parameterScale;
         this._boundBuffer = buffer.Handle;
         this._boundIntbuffer = intbuffer.Handle;
         if (ODBC32.SQL_C.NUMERIC == sql_c)
         {
             OdbcDescriptorHandle descriptorHandle = command.GetDescriptorHandle(ODBC32.SQL_ATTR.APP_PARAM_DESC);
             retcode = descriptorHandle.SetDescriptionField1(ordinal, ODBC32.SQL_DESC.TYPE, (IntPtr) 2L);
             if (retcode != ODBC32.RetCode.SUCCESS)
             {
                 command.Connection.HandleError(hstmt, retcode);
             }
             int num2 = parameterPrecision;
             retcode = descriptorHandle.SetDescriptionField1(ordinal, ODBC32.SQL_DESC.PRECISION, (IntPtr) num2);
             if (retcode != ODBC32.RetCode.SUCCESS)
             {
                 command.Connection.HandleError(hstmt, retcode);
             }
             num2 = parameterScale;
             retcode = descriptorHandle.SetDescriptionField1(ordinal, ODBC32.SQL_DESC.SCALE, (IntPtr) num2);
             if (retcode != ODBC32.RetCode.SUCCESS)
             {
                 command.Connection.HandleError(hstmt, retcode);
             }
             retcode = descriptorHandle.SetDescriptionField2(ordinal, ODBC32.SQL_DESC.DATA_PTR, buffer);
             if (retcode != ODBC32.RetCode.SUCCESS)
             {
                 command.Connection.HandleError(hstmt, retcode);
             }
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:85,代码来源:OdbcParameter.cs

示例9: FreeKeyInfoStatementHandle

        internal void FreeKeyInfoStatementHandle(ODBC32.STMT stmt) {
            OdbcStatementHandle handle = _keyinfostmt;
            if (null != handle) {
                try {
                    handle.FreeStatement(stmt);
                }
                catch (Exception e) {
                    // 
                    if (ADP.IsCatchableExceptionType(e)) {
                        _keyinfostmt = null;
                        handle.Dispose();
                    }

                    throw;
                }
            }
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:17,代码来源:OdbcCommand.cs

示例10: SQLTablesW

 static internal extern /*SQLRETURN*/ODBC32.RetCode SQLTablesW (
     /*SQLHSTMT*/OdbcStatementHandle StatementHandle,
     [In, MarshalAs(UnmanagedType.LPWStr)]
     /*SQLCHAR* */string CatalogName,
     /*SQLSMALLINT*/Int16 NameLen1,
     [In, MarshalAs(UnmanagedType.LPWStr)]
     /*SQLCHAR* */string SchemaName,
     /*SQLSMALLINT*/Int16 NameLen2,
     [In, MarshalAs(UnmanagedType.LPWStr)]
     /*SQLCHAR* */string TableName,
     /*SQLSMALLINT*/Int16 NameLen3,
     [In, MarshalAs(UnmanagedType.LPWStr)]
     /*SQLCHAR* */string TableType,
     /*SQLSMALLINT*/Int16 NameLen4);
开发者ID:uQr,项目名称:referencesource,代码行数:14,代码来源:UnsafeNativeMethods.cs

示例11: SQLSetStmtAttrW

 static internal extern /*SQLRETURN*/ODBC32.RetCode SQLSetStmtAttrW(
     /*SQLHSTMT*/OdbcStatementHandle          StatementHandle,
     /*SQLINTEGER*/Int32      Attribute,
     /*SQLPOINTER*/IntPtr     Value,
     /*SQLINTEGER*/Int32      StringLength);
开发者ID:uQr,项目名称:referencesource,代码行数:5,代码来源:UnsafeNativeMethods.cs

示例12: FreeStatementHandle

        internal void FreeStatementHandle(ODBC32.STMT stmt) {
            DisposeDescriptorHandle();

            OdbcStatementHandle handle = _stmt;
            if (null != handle) {
                try {
                    ODBC32.RetCode retcode;
                    retcode = handle.FreeStatement(stmt);
                    StatementErrorHandler(retcode);
                }
                catch (Exception e) {
                    // 
                    if (ADP.IsCatchableExceptionType(e)) {
                        _stmt = null;
                        handle.Dispose();
                    }

                    throw;
                }
            }
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:21,代码来源:OdbcCommand.cs

示例13: DisposeKeyInfoStatementHandle

 internal void DisposeKeyInfoStatementHandle() {
     OdbcStatementHandle handle = _keyinfostmt;
     if (null != handle) {
         _keyinfostmt = null;
         handle.Dispose();
     }
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:7,代码来源:OdbcCommand.cs

示例14: DisposeStatementHandle

        internal void DisposeStatementHandle() {
            DisposeKeyInfoStatementHandle();
            DisposeDescriptorHandle();

            OdbcStatementHandle handle = _stmt;
            if (null != handle) {
                _stmt = null;
                handle.Dispose();
            }
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:10,代码来源:OdbcCommand.cs

示例15: TrySetStatementAttribute

        void TrySetStatementAttribute (OdbcStatementHandle stmt, ODBC32.SQL_ATTR stmtAttribute, IntPtr value) {

            ODBC32.RetCode retcode = stmt.SetStatementAttribute(
                stmtAttribute,
                value,
                ODBC32.SQL_IS.UINTEGER);

            if (retcode == ODBC32.RetCode.ERROR) {

                string sqlState;
                stmt.GetDiagnosticField(out sqlState);

                if ((sqlState == "HYC00") || (sqlState == "HY092")) {
                    Connection.FlagUnsupportedStmtAttr(stmtAttribute);
                }
                else {
                    // now what? Should we throw?
                }
            }
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:20,代码来源:OdbcCommand.cs


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