• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Odbc.ODBC32类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

        protected OdbcHandle(ODBC32.SQL_HANDLE handleType, OdbcHandle parentHandle) : base(IntPtr.Zero, true) {

            _handleType   = handleType;

            bool mustRelease = false;
            ODBC32.RetCode retcode = ODBC32.RetCode.SUCCESS;

            // using ConstrainedRegions to make the native ODBC call and AddRef the parent
            RuntimeHelpers.PrepareConstrainedRegions();
            try {
                // validate handleType
                switch(handleType) {
                case ODBC32.SQL_HANDLE.ENV:
                    Debug.Assert(null == parentHandle, "did not expect a parent handle");
                    retcode = UnsafeNativeMethods.SQLAllocHandle(handleType, IntPtr.Zero, out base.handle);
                    break;
                case ODBC32.SQL_HANDLE.DBC:
                case ODBC32.SQL_HANDLE.STMT:
                    // must addref before calling native so it won't be released just after
                    Debug.Assert(null != parentHandle, "expected a parent handle"); // safehandle can't be null
                    parentHandle.DangerousAddRef(ref mustRelease);

                    retcode = UnsafeNativeMethods.SQLAllocHandle(handleType, parentHandle, out base.handle);
                    break;
//              case ODBC32.SQL_HANDLE.DESC:
                default:
                    Debug.Assert(false, "unexpected handleType");
                    break;
                }
            }
            finally {
                if (mustRelease) {
                    switch(handleType) {
                    case ODBC32.SQL_HANDLE.DBC:
                    case ODBC32.SQL_HANDLE.STMT:
                        if (IntPtr.Zero != base.handle) {
                            // must assign _parentHandle 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();
                        }
                        break;
                    }
                }
            }
            Bid.TraceSqlReturn("<odbc.SQLAllocHandle|API|ODBC|RET> %08X{SQLRETURN}\n", retcode);

            if((ADP.PtrZero == base.handle) || (ODBC32.RetCode.SUCCESS != retcode)) {
                // 
                throw ODBC.CantAllocateEnvironmentHandle(retcode);
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:55,代码来源:OdbcHandle.cs


示例4: MarshalToManaged

        internal object MarshalToManaged(int offset, ODBC32.SQL_C sqlctype, int cb)
        {
            switch (sqlctype)
            {
                case ODBC32.SQL_C.SLONG:
                    return base.ReadInt32(offset);

                case ODBC32.SQL_C.SSHORT:
                    return base.ReadInt16(offset);

                case ODBC32.SQL_C.SBIGINT:
                    return base.ReadInt64(offset);

                case ODBC32.SQL_C.UTINYINT:
                    return base.ReadByte(offset);

                case ODBC32.SQL_C.GUID:
                    return base.ReadGuid(offset);

                case ODBC32.SQL_C.WCHAR:
                    if (cb != -3)
                    {
                        cb = Math.Min((int) (cb / 2), (int) ((base.Length - 2) / 2));
                        return base.PtrToStringUni(offset, cb);
                    }
                    return base.PtrToStringUni(offset);

                case ODBC32.SQL_C.BIT:
                    return (base.ReadByte(offset) != 0);

                case ODBC32.SQL_C.BINARY:
                case ODBC32.SQL_C.CHAR:
                    cb = Math.Min(cb, base.Length);
                    return base.ReadBytes(offset, cb);

                case ODBC32.SQL_C.NUMERIC:
                    return base.ReadNumeric(offset);

                case ODBC32.SQL_C.REAL:
                    return base.ReadSingle(offset);

                case ODBC32.SQL_C.DOUBLE:
                    return base.ReadDouble(offset);

                case ODBC32.SQL_C.TYPE_DATE:
                    return base.ReadDate(offset);

                case ODBC32.SQL_C.TYPE_TIME:
                    return base.ReadTime(offset);

                case ODBC32.SQL_C.TYPE_TIMESTAMP:
                    return base.ReadDateTime(offset);
            }
            return null;
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:55,代码来源:CNativeBuffer.cs


示例5: 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


示例6: CreateException

        ODBC32.RETCODE _retcode;    // DO NOT REMOVE! only needed for serialization purposes, because Everett had it.

        static internal OdbcException CreateException(OdbcErrorCollection errors, ODBC32.RetCode retcode) {
            StringBuilder builder = new StringBuilder();
            foreach (OdbcError error in errors) {
                if (builder.Length > 0) {
                    builder.Append(Environment.NewLine);
                }

                builder.Append(Res.GetString(Res.Odbc_ExceptionMessage, ODBC32.RetcodeToString(retcode), error.SQLState, error.Message)); // MDAC 68337
            }
            OdbcException exception = new OdbcException(builder.ToString(), errors);
            return exception;
        }
开发者ID:uQr,项目名称:referencesource,代码行数:14,代码来源:OdbcException.cs


示例7: TypeMap

 private TypeMap(OdbcType odbcType, DbType dbType, Type type, ODBC32.SQL_TYPE sql_type, ODBC32.SQL_C sql_c, ODBC32.SQL_C param_sql_c, int bsize, int csize, bool signType)
 {
     this._odbcType = odbcType;
     this._dbType = dbType;
     this._type = type;
     this._sql_type = sql_type;
     this._sql_c = sql_c;
     this._param_sql_c = param_sql_c;
     this._bufferSize = bsize;
     this._columnSize = csize;
     this._signType = signType;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:TypeMap.cs


示例8: CreateException

 internal static OdbcException CreateException(OdbcErrorCollection errors, ODBC32.RetCode retcode)
 {
     StringBuilder builder = new StringBuilder();
     foreach (OdbcError error in errors)
     {
         if (builder.Length > 0)
         {
             builder.Append(Environment.NewLine);
         }
         builder.Append(Res.GetString("Odbc_ExceptionMessage", new object[] { ODBC32.RetcodeToString(retcode), error.SQLState, error.Message }));
     }
     return new OdbcException(builder.ToString(), errors);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:OdbcException.cs


示例9: BindParameter

 internal ODBC32.RetCode BindParameter(short ordinal, short parameterDirection, ODBC32.SQL_C sqlctype, ODBC32.SQL_TYPE sqltype, IntPtr cchSize, IntPtr scale, HandleRef buffer, IntPtr bufferLength, HandleRef intbuffer) {
     ODBC32.RetCode retcode = UnsafeNativeMethods.SQLBindParameter(this,
                             checked((ushort)ordinal),   // Parameter Number
                             parameterDirection,         // InputOutputType
                             sqlctype,                   // ValueType
                             checked((short)sqltype),    // ParameterType
                             cchSize,                    // ColumnSize
                             scale,                      // DecimalDigits
                             buffer,                     // ParameterValuePtr
                             bufferLength,               // BufferLength
                             intbuffer);                 // StrLen_or_IndPtr
     ODBC.TraceODBC(3, "SQLBindParameter", retcode);
     return retcode;
 }
开发者ID:uQr,项目名称:referencesource,代码行数:14,代码来源:OdbcStatementHandle.cs


示例10: FreeKeyInfoStatementHandle

 internal void FreeKeyInfoStatementHandle(ODBC32.STMT stmt)
 {
     OdbcStatementHandle handle = this._keyinfostmt;
     if (handle != null)
     {
         try
         {
             handle.FreeStatement(stmt);
         }
         catch (Exception exception)
         {
             if (ADP.IsCatchableExceptionType(exception))
             {
                 this._keyinfostmt = null;
                 handle.Dispose();
             }
             throw;
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:20,代码来源:CMDWrapper.cs


示例11: SetConnectionAttribute2

 internal ODBC32.RetCode SetConnectionAttribute2(ODBC32.SQL_ATTR attribute, IntPtr value, Int32 length) {
     ODBC32.RetCode retcode = UnsafeNativeMethods.SQLSetConnectAttrW(this, attribute, value, length);
     ODBC.TraceODBC(3, "SQLSetConnectAttrW", retcode);
     return retcode;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:5,代码来源:OdbcConnectionHandle.cs


示例12: GetInfo1

 internal ODBC32.RetCode GetInfo1(ODBC32.SQL_INFO info, byte[] buffer) {
     ODBC32.RetCode retcode = UnsafeNativeMethods.SQLGetInfoW(this, info, buffer, checked((short)buffer.Length), ADP.PtrZero);
     Bid.Trace("<odbc.SQLGetInfo|ODBC> SQLRETURN=%d, InfoType=%d, BufferLength=%d\n", (int)retcode, (int)info, buffer.Length);
     return retcode;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:5,代码来源:OdbcConnectionHandle.cs


示例13: FailedToGetDescriptorHandle

 static internal Exception FailedToGetDescriptorHandle(ODBC32.RetCode retcode) {
     return ADP.DataAdapter(Res.GetString(Res.Odbc_FailedToGetDescriptorHandle, ODBC32.RetcodeToString(retcode)));
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:3,代码来源:Odbc32.cs


示例14: CantAllocateEnvironmentHandle

 static internal Exception CantAllocateEnvironmentHandle(ODBC32.RetCode retcode) {
     return ADP.DataAdapter(Res.GetString(Res.Odbc_CantAllocateEnvironmentHandle, ODBC32.RetcodeToString(retcode)));
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:3,代码来源:Odbc32.cs


示例15: TypeMap

        internal readonly bool _signType;   // this type may be has signature information

        private TypeMap(OdbcType odbcType, DbType dbType, Type type, ODBC32.SQL_TYPE sql_type, ODBC32.SQL_C sql_c, ODBC32.SQL_C param_sql_c, int bsize, int csize, bool signType) {
            _odbcType = odbcType;
            _dbType = dbType;
            _type = type;

            _sql_type = sql_type;
            _sql_c = sql_c;
            _param_sql_c = param_sql_c; // alternative sql_c type for parameters

            _bufferSize = bsize;
            _columnSize = csize;
            _signType = signType;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:15,代码来源:Odbc32.cs


示例16: TraceODBC

 static internal void TraceODBC(int level, string method, ODBC32.RetCode retcode) {
     Bid.TraceSqlReturn("<odbc|API|ODBC|RET> %08X{SQLRETURN}, method=%ls\n", retcode, method);
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:3,代码来源:Odbc32.cs


示例17: SetConnectionAttribute3

 internal ODBC32.RetCode SetConnectionAttribute3(ODBC32.SQL_ATTR attribute, string buffer, Int32 length) {
     ODBC32.RetCode retcode = UnsafeNativeMethods.SQLSetConnectAttrW(this, attribute, buffer, length);
     Bid.Trace("<odbc.SQLSetConnectAttr|ODBC> SQLRETURN=%d, Attribute=%d, BufferLength=%d\n", (int)retcode, (int)attribute, buffer.Length);
     return retcode;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:5,代码来源:OdbcConnectionHandle.cs


示例18: SetConnectionAttribute4

 internal ODBC32.RetCode SetConnectionAttribute4(ODBC32.SQL_ATTR attribute, System.Transactions.IDtcTransaction transaction, Int32 length) {
     ODBC32.RetCode retcode = UnsafeNativeMethods.SQLSetConnectAttrW(this, attribute, transaction, length);
     ODBC.TraceODBC(3, "SQLSetConnectAttrW", retcode);
     return retcode;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:5,代码来源:OdbcConnectionHandle.cs


示例19: TestTypeSupport

        internal bool TestTypeSupport (ODBC32.SQL_TYPE sqltype){
            ODBC32.SQL_CONVERT sqlconvert;
            ODBC32.SQL_CVT sqlcvt;

            // we need to convert the sqltype to sqlconvert and sqlcvt first
            //
            switch (sqltype) {
                case ODBC32.SQL_TYPE.NUMERIC: {
                    sqlconvert = ODBC32.SQL_CONVERT.NUMERIC;
                    sqlcvt = ODBC32.SQL_CVT.NUMERIC;
                    break;
                }
                case ODBC32.SQL_TYPE.WCHAR: {
                    sqlconvert = ODBC32.SQL_CONVERT.CHAR;
                    sqlcvt = ODBC32.SQL_CVT.WCHAR;
                    break;
                }
                case ODBC32.SQL_TYPE.WVARCHAR: {
                    sqlconvert = ODBC32.SQL_CONVERT.VARCHAR;
                    sqlcvt = ODBC32.SQL_CVT.WVARCHAR;
                    break;
                }
                case ODBC32.SQL_TYPE.WLONGVARCHAR: {
                    sqlconvert = ODBC32.SQL_CONVERT.LONGVARCHAR;
                    sqlcvt = ODBC32.SQL_CVT.WLONGVARCHAR;
                    break;
                }
                default:
                    Debug.Assert(false, "Testing that sqltype is currently not supported");
                    return false;
            }
            // now we can check if we have already tested that type
            // if not we need to do so
            if (0 == (ProviderInfo.TestedSQLTypes & (int)sqlcvt)) {
                int flags;

                flags = GetInfoInt32Unhandled((ODBC32.SQL_INFO)sqlconvert);
                flags = flags & (int)sqlcvt;

                ProviderInfo.TestedSQLTypes |= (int)sqlcvt;
                ProviderInfo.SupportedSQLTypes |= flags;
            }

            // now check if the type is supported and return the result
            //
            return (0 != (ProviderInfo.SupportedSQLTypes & (int)sqlcvt));
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:47,代码来源:OdbcConnection.cs


示例20: MarshalToNative

        internal void MarshalToNative(int offset, object value, ODBC32.SQL_C sqlctype, int sizeorprecision, int valueOffset)
        {
            ODBC32.SQL_C sql_c = sqlctype;
            if (sql_c <= ODBC32.SQL_C.SSHORT)
            {
                if (sql_c != ODBC32.SQL_C.UTINYINT)
                {
                    switch (sql_c)
                    {
                        case ODBC32.SQL_C.SLONG:
                            base.WriteInt32(offset, (int) value);
                            return;

                        case ODBC32.SQL_C.SSHORT:
                            base.WriteInt16(offset, (short) value);
                            return;

                        case ODBC32.SQL_C.SBIGINT:
                            base.WriteInt64(offset, (long) value);
                            return;
                    }
                }
                else
                {
                    base.WriteByte(offset, (byte) value);
                }
            }
            else if (sql_c <= ODBC32.SQL_C.NUMERIC)
            {
                switch (sql_c)
                {
                    case ODBC32.SQL_C.GUID:
                        base.WriteGuid(offset, (Guid) value);
                        return;

                    case ~(ODBC32.SQL_C.CHAR | ODBC32.SQL_C.DOUBLE):
                    case ~ODBC32.SQL_C.DOUBLE:
                    case ((ODBC32.SQL_C) (-1)):
                    case ((ODBC32.SQL_C) 0):
                        return;

                    case ODBC32.SQL_C.WCHAR:
                        int num;
                        char[] chArray;
                        if (value is string)
                        {
                            num = Math.Max(0, ((string) value).Length - valueOffset);
                            if ((sizeorprecision > 0) && (sizeorprecision < num))
                            {
                                num = sizeorprecision;
                            }
                            chArray = ((string) value).ToCharArray(valueOffset, num);
                            base.WriteCharArray(offset, chArray, 0, chArray.Length);
                            base.WriteInt16(offset + (chArray.Length * 2), 0);
                            return;
                        }
                        num = Math.Max(0, ((char[]) value).Length - valueOffset);
                        if ((sizeorprecision > 0) && (sizeorprecision < num))
                        {
                            num = sizeorprecision;
                        }
                        chArray = (char[]) value;
                        base.WriteCharArray(offset, chArray, valueOffset, num);
                        base.WriteInt16(offset + (chArray.Length * 2), 0);
                        return;

                    case ODBC32.SQL_C.BIT:
                        base.WriteByte(offset, ((bool) value) ? ((byte) 1) : ((byte) 0));
                        return;

                    case ODBC32.SQL_C.BINARY:
                    case ODBC32.SQL_C.CHAR:
                    {
                        byte[] source = (byte[]) value;
                        int length = source.Length;
                        length -= valueOffset;
                        if ((sizeorprecision > 0) && (sizeorprecision < length))
                        {
                            length = sizeorprecision;
                        }
                        base.WriteBytes(offset, source, valueOffset, length);
                        return;
                    }
                    case ODBC32.SQL_C.NUMERIC:
                        base.WriteNumeric(offset, (decimal) value, (byte) sizeorprecision);
                        return;
                }
            }
            else
            {
                switch (sql_c)
                {
                    case ODBC32.SQL_C.REAL:
                        base.WriteSingle(offset, (float) value);
                        return;

                    case ODBC32.SQL_C.DOUBLE:
                        base.WriteDouble(offset, (double) value);
                        return;

//.........这里部分代码省略.........
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:101,代码来源:CNativeBuffer.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Odbc.OdbcCommand类代码示例发布时间:2022-05-26
下一篇:
C# Objects.ObjectStateEntry类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap