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


C# TdsParserStateObject.ReadByteArray方法代码示例

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


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

示例1: SkipLongBytes

 internal void SkipLongBytes(ulong num, TdsParserStateObject stateObj)
 {
     int len = 0;
     while (num > 0L)
     {
         len = (num > 0x7fffffffL) ? 0x7fffffff : ((int) num);
         stateObj.ReadByteArray(null, 0, len);
         num -= len;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:TdsParser.cs

示例2: ReadTwoBinaryFields

 private void ReadTwoBinaryFields(SqlEnvChange env, TdsParserStateObject stateObj)
 {
     env.newLength = stateObj.ReadByte();
     env.newBinValue = new byte[env.newLength];
     stateObj.ReadByteArray(env.newBinValue, 0, env.newLength);
     env.oldLength = stateObj.ReadByte();
     env.oldBinValue = new byte[env.oldLength];
     stateObj.ReadByteArray(env.oldBinValue, 0, env.oldLength);
     env.length = (3 + env.newLength) + env.oldLength;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:TdsParser.cs

示例3: SkipBytes

 public void SkipBytes(int num, TdsParserStateObject stateObj)
 {
     stateObj.ReadByteArray(null, 0, num);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:4,代码来源:TdsParser.cs

示例4: ReadSqlValueInternal

        internal void ReadSqlValueInternal(SqlBuffer value, byte tdsType, int typeId, int length, TdsParserStateObject stateObj)
        {
            int num4;
            switch (tdsType)
            {
                case 0x7f:
                    goto Label_011A;

                case 0xa5:
                case 0xad:
                case 0x22:
                case 0x25:
                case 0x2d:
                {
                    byte[] buff = new byte[length];
                    stateObj.ReadByteArray(buff, 0, length);
                    value.SqlBinary = new SqlBinary(buff, true);
                    return;
                }
                case 0x6d:
                    if (length != 4)
                    {
                        goto Label_013B;
                    }
                    goto Label_012D;

                case 110:
                    if (length == 4)
                    {
                        goto Label_0173;
                    }
                    goto Label_014E;

                case 0x6f:
                    if (length != 4)
                    {
                        goto Label_01A2;
                    }
                    goto Label_0187;

                case 0x7a:
                    goto Label_0173;

                case 0x62:
                    this.ReadSqlVariant(value, length, stateObj);
                    return;

                case 0x68:
                case 50:
                    value.Boolean = stateObj.ReadByte() != 0;
                    return;

                case 0x23:
                case 0x2e:
                case 0x2f:
                case 0x31:
                case 0x33:
                case 0x35:
                case 0x36:
                case 0x37:
                case 0x39:
                    return;

                case 0x24:
                {
                    byte[] buffer2 = new byte[length];
                    stateObj.ReadByteArray(buffer2, 0, length);
                    value.SqlGuid = new SqlGuid(buffer2, true);
                    return;
                }
                case 0x26:
                    if (length == 1)
                    {
                        break;
                    }
                    if (length == 2)
                    {
                        goto Label_00FE;
                    }
                    if (length != 4)
                    {
                        goto Label_011A;
                    }
                    goto Label_010C;

                case 0x30:
                    break;

                case 0x34:
                    goto Label_00FE;

                case 0x38:
                    goto Label_010C;

                case 0x3a:
                    goto Label_0187;

                case 0x3b:
                    goto Label_012D;

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

示例5: ReadSqlValue

        internal void ReadSqlValue(SqlBuffer value, SqlMetaDataPriv md, int length, TdsParserStateObject stateObj)
        {
            if (md.metaType.IsPlp)
            {
                length = 0x7fffffff;
            }
            switch (md.tdsType)
            {
                case 0x22:
                case 0x25:
                case 0x2d:
                case 240:
                case 0xa5:
                case 0xad:
                {
                    byte[] buff = null;
                    if (md.metaType.IsPlp)
                    {
                        stateObj.ReadPlpBytes(ref buff, 0, length);
                    }
                    else
                    {
                        buff = new byte[length];
                        stateObj.ReadByteArray(buff, 0, length);
                    }
                    value.SqlBinary = new SqlBinary(buff, true);
                    return;
                }
                case 0x23:
                case 0x27:
                case 0x2f:
                case 0x63:
                case 0xef:
                case 0xe7:
                case 0xa7:
                case 0xaf:
                    this.ReadSqlStringValue(value, md.tdsType, length, md.encoding, md.metaType.IsPlp, stateObj);
                    return;

                case 40:
                case 0x29:
                case 0x2a:
                case 0x2b:
                    this.ReadSqlDateTime(value, md.tdsType, length, md.scale, stateObj);
                    return;

                case 0x6a:
                case 0x6c:
                    this.ReadSqlDecimal(value, length, md.precision, md.scale, stateObj);
                    return;

                case 0xf1:
                {
                    SqlCachedBuffer buffer2 = new SqlCachedBuffer(md, this, stateObj);
                    value.SqlCachedBuffer = buffer2;
                    return;
                }
            }
            this.ReadSqlValueInternal(value, md.tdsType, md.metaType.TypeId, length, stateObj);
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:60,代码来源:TdsParser.cs

示例6: ReadSqlDateTime

        private void ReadSqlDateTime(SqlBuffer value, byte tdsType, int length, byte scale, TdsParserStateObject stateObj)
        {
            stateObj.ReadByteArray(this.datetimeBuffer, 0, length);
            switch (tdsType)
            {
                case 40:
                    value.SetToDate(this.datetimeBuffer);
                    return;

                case 0x29:
                    value.SetToTime(this.datetimeBuffer, length, scale);
                    return;

                case 0x2a:
                    value.SetToDateTime2(this.datetimeBuffer, length, scale);
                    return;

                case 0x2b:
                    value.SetToDateTimeOffset(this.datetimeBuffer, length, scale);
                    return;
            }
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:22,代码来源:TdsParser.cs

示例7: ProcessLoginAck

        private SqlLoginAck ProcessLoginAck(TdsParserStateObject stateObj)
        {
            SqlLoginAck ack = new SqlLoginAck();
            this.SkipBytes(1, stateObj);
            byte[] buff = new byte[4];
            stateObj.ReadByteArray(buff, 0, buff.Length);
            uint num3 = (uint) ((((((buff[0] << 8) | buff[1]) << 8) | buff[2]) << 8) | buff[3]);
            uint num6 = num3 & 0xff00ffff;
            uint num2 = (num3 >> 0x10) & 0xff;
            switch (num6)
            {
                case 0x72000002:
                    if (num2 != 9)
                    {
                        throw SQL.InvalidTDSVersion();
                    }
                    this._isYukon = true;
                    break;

                case 0x73000003:
                    if (num2 != 10)
                    {
                        throw SQL.InvalidTDSVersion();
                    }
                    this._isKatmai = true;
                    break;

                case 0x7000000:
                    switch (num2)
                    {
                        case 1:
                            this._isShiloh = true;
                            goto Label_00DF;
                    }
                    throw SQL.InvalidTDSVersion();

                case 0x71000001:
                    if (num2 != 0)
                    {
                        throw SQL.InvalidTDSVersion();
                    }
                    this._isShilohSP1 = true;
                    break;

                default:
                    throw SQL.InvalidTDSVersion();
            }
        Label_00DF:
            this._isYukon |= this._isKatmai;
            this._isShilohSP1 |= this._isYukon;
            this._isShiloh |= this._isShilohSP1;
            ack.isVersion8 = this._isShiloh;
            stateObj._outBytesUsed = stateObj._outputHeaderLen;
            byte length = stateObj.ReadByte();
            ack.programName = stateObj.ReadString(length);
            ack.majorVersion = stateObj.ReadByte();
            ack.minorVersion = stateObj.ReadByte();
            ack.buildNum = (short) ((stateObj.ReadByte() << 8) + stateObj.ReadByte());
            this._state = TdsParserState.OpenLoggedIn;
            if ((this._isYukon && this._fAsync) && this._fMARS)
            {
                this._resetConnectionEvent = new AutoResetEvent(true);
            }
            if (this._connHandler.ConnectionOptions.UserInstance && ADP.IsEmpty(this._connHandler.InstanceName))
            {
                this.Errors.Add(new SqlError(0, 0, 20, this.Server, SQLMessage.UserInstanceFailure(), "", 0));
                this.ThrowExceptionAndWarning();
            }
            return ack;
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:70,代码来源:TdsParser.cs

示例8: ProcessEnvChange


//.........这里部分代码省略.........
                            env.newCollation = this.ProcessCollation(stateObj);
                            this._defaultCollation = env.newCollation;
                            int codePage = this.GetCodePage(env.newCollation, stateObj);
                            if (codePage != this._defaultCodePage)
                            {
                                this._defaultCodePage = codePage;
                                this._defaultEncoding = Encoding.GetEncoding(this._defaultCodePage);
                            }
                            this._defaultLCID = env.newCollation.LCID;
                        }
                        env.oldLength = stateObj.ReadByte();
                        if (env.oldLength == 5)
                        {
                            env.oldCollation = this.ProcessCollation(stateObj);
                        }
                        env.length = (3 + env.newLength) + env.oldLength;
                        goto Label_03E0;

                    case 8:
                    case 9:
                    case 10:
                    case 11:
                    case 12:
                    case 0x11:
                        env.newLength = stateObj.ReadByte();
                        if (env.newLength <= 0)
                        {
                            goto Label_02B0;
                        }
                        env.newLongValue = stateObj.ReadInt64();
                        goto Label_02B8;

                    case 13:
                        this.ReadTwoStringFields(env, stateObj);
                        goto Label_03E0;

                    case 15:
                        env.newLength = stateObj.ReadInt32();
                        env.newBinValue = new byte[env.newLength];
                        stateObj.ReadByteArray(env.newBinValue, 0, env.newLength);
                        env.oldLength = stateObj.ReadByte();
                        env.length = 5 + env.newLength;
                        goto Label_03E0;

                    case 0x10:
                    case 0x12:
                        this.ReadTwoBinaryFields(env, stateObj);
                        goto Label_03E0;

                    case 0x13:
                        this.ReadTwoStringFields(env, stateObj);
                        goto Label_03E0;

                    case 20:
                    {
                        env.newLength = stateObj.ReadUInt16();
                        byte protocol = stateObj.ReadByte();
                        ushort port = stateObj.ReadUInt16();
                        ushort length = stateObj.ReadUInt16();
                        string servername = stateObj.ReadString(length);
                        env.newRoutingInfo = new RoutingInfo(protocol, port, servername);
                        num5 = stateObj.ReadUInt16();
                        num3 = 0;
                        goto Label_03C9;
                    }
                    default:
                        goto Label_03E0;
                }
                string s = env.newValue.Substring(2);
                this._defaultCodePage = int.Parse(s, NumberStyles.Integer, CultureInfo.InvariantCulture);
                this._defaultEncoding = Encoding.GetEncoding(this._defaultCodePage);
                goto Label_03E0;
            Label_02B0:
                env.newLongValue = 0L;
            Label_02B8:
                env.oldLength = stateObj.ReadByte();
                if (env.oldLength > 0)
                {
                    env.oldLongValue = stateObj.ReadInt64();
                }
                else
                {
                    env.oldLongValue = 0L;
                }
                env.length = (3 + env.newLength) + env.oldLength;
                goto Label_03E0;
            Label_03BC:
                stateObj.ReadByte();
                num3++;
            Label_03C9:
                if (num3 < num5)
                {
                    goto Label_03BC;
                }
                env.length = (env.newLength + num5) + 5;
            Label_03E0:
                num4 += env.length;
            }
            return changeArray;
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:101,代码来源:TdsParser.cs


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