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


C# TdsParserStateObject.ReadByte方法代码示例

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


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

示例1: ReadSqlDecimal

 private void ReadSqlDecimal(SqlBuffer value, int length, byte precision, byte scale, TdsParserStateObject stateObj)
 {
     bool positive = 1 == stateObj.ReadByte();
     length--;
     int[] bits = this.ReadDecimalBits(length, stateObj);
     value.SetToDecimal(precision, scale, positive, bits);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:TdsParser.cs

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

示例3: ProcessUDTMetaData

 private void ProcessUDTMetaData(SqlMetaDataPriv metaData, TdsParserStateObject stateObj)
 {
     metaData.length = stateObj.ReadUInt16();
     int length = stateObj.ReadByte();
     if (length != 0)
     {
         metaData.udtDatabaseName = stateObj.ReadString(length);
     }
     length = stateObj.ReadByte();
     if (length != 0)
     {
         metaData.udtSchemaName = stateObj.ReadString(length);
     }
     length = stateObj.ReadByte();
     if (length != 0)
     {
         metaData.udtTypeName = stateObj.ReadString(length);
     }
     length = stateObj.ReadUInt16();
     if (length != 0)
     {
         metaData.udtAssemblyQualifiedName = stateObj.ReadString(length);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:24,代码来源:TdsParser.cs

示例4: ReadPlpUnicodeChars

 internal int ReadPlpUnicodeChars(ref char[] buff, int offst, int len, TdsParserStateObject stateObj)
 {
     int num = 0;
     int num2 = 0;
     int num3 = 0;
     if (stateObj._longlen != 0L)
     {
         num2 = len;
         if ((buff == null) && (stateObj._longlen != 18446744073709551614L))
         {
             buff = new char[Math.Min((int) stateObj._longlen, len)];
         }
         if (stateObj._longlenleft != 0L)
         {
             goto Label_0150;
         }
         stateObj.ReadPlpLength(false);
         if (stateObj._longlenleft != 0L)
         {
             goto Label_0150;
         }
     }
     return 0;
 Label_0150:
     while (num2 > 0)
     {
         num = (int) Math.Min((stateObj._longlenleft + 1L) >> 1, (ulong) num2);
         if ((buff == null) || (buff.Length < (offst + num)))
         {
             char[] dst = new char[offst + num];
             if (buff != null)
             {
                 Buffer.BlockCopy(buff, 0, dst, 0, offst * 2);
             }
             buff = dst;
         }
         if (num > 0)
         {
             num = this.ReadPlpUnicodeCharsChunk(buff, offst, num, stateObj);
             num2 -= num;
             offst += num;
             num3 += num;
         }
         if ((stateObj._longlenleft == 1L) && (num2 > 0))
         {
             byte num5 = stateObj.ReadByte();
             stateObj._longlenleft -= (ulong) 1L;
             stateObj.ReadPlpLength(false);
             byte num4 = stateObj.ReadByte();
             stateObj._longlenleft -= (ulong) 1L;
             buff[offst] = (char) (((num4 & 0xff) << 8) + (num5 & 0xff));
             offst++;
             num++;
             num2--;
             num3++;
         }
         if (stateObj._longlenleft == 0L)
         {
             stateObj.ReadPlpLength(false);
         }
         if (stateObj._longlenleft == 0L)
         {
             return num3;
         }
     }
     return num3;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:67,代码来源:TdsParser.cs

示例5: SkipRow

 internal void SkipRow(_SqlMetaDataSet columns, int startCol, TdsParserStateObject stateObj)
 {
     for (int i = startCol; i < columns.Length; i++)
     {
         _SqlMetaData md = columns[i];
         if (md.metaType.IsLong && !md.metaType.IsPlp)
         {
             byte num2 = stateObj.ReadByte();
             if (num2 == 0)
             {
                 continue;
             }
             this.SkipBytes(num2 + 8, stateObj);
         }
         this.SkipValue(md, stateObj);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:17,代码来源:TdsParser.cs

示例6: ProcessAltMetaData

        internal _SqlMetaDataSet ProcessAltMetaData(int cColumns, TdsParserStateObject stateObj)
        {
            _SqlMetaDataSet set = new _SqlMetaDataSet(cColumns);
            int[] numArray = new int[cColumns];
            set.id = stateObj.ReadUInt16();
            for (int i = stateObj.ReadByte(); i > 0; i--)
            {
                this.SkipBytes(2, stateObj);
            }
            for (int j = 0; j < cColumns; j++)
            {
                _SqlMetaData col = set[j];
                col.op = stateObj.ReadByte();
                col.operand = stateObj.ReadUInt16();
                this.CommonProcessMetaData(stateObj, col);
                if (ADP.IsEmpty(col.column))
                {
                    switch (col.op)
                    {
                        case 0x30:
                            col.column = "stdev";
                            break;

                        case 0x31:
                            col.column = "stdevp";
                            break;

                        case 50:
                            col.column = "var";
                            break;

                        case 0x33:
                            col.column = "varp";
                            break;

                        case 9:
                            goto Label_00FA;

                        case 0x4b:
                            col.column = "cnt";
                            break;

                        case 0x4d:
                            col.column = "sum";
                            break;

                        case 0x4f:
                            col.column = "avg";
                            break;

                        case 0x51:
                            col.column = "min";
                            break;

                        case 0x52:
                            col.column = "max";
                            break;

                        case 0x53:
                            col.column = "any";
                            break;

                        case 0x56:
                            col.column = "noop";
                            break;
                    }
                }
                goto Label_017A;
            Label_00FA:
                col.column = "cntb";
            Label_017A:
                numArray[j] = j;
            }
            set.indexMap = numArray;
            set.visibleColumns = cColumns;
            return set;
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:77,代码来源: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: ReadTwoStringFields

 private void ReadTwoStringFields(SqlEnvChange env, TdsParserStateObject stateObj)
 {
     env.newLength = stateObj.ReadByte();
     env.newValue = stateObj.ReadString(env.newLength);
     env.oldLength = stateObj.ReadByte();
     env.oldValue = stateObj.ReadString(env.oldLength);
     env.length = (3 + (env.newLength * 2)) + (env.oldLength * 2);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:TdsParser.cs

示例9: ProcessEnvChange

        private SqlEnvChange[] ProcessEnvChange(int tokenLength, TdsParserStateObject stateObj)
        {
            int num4 = 0;
            int index = 0;
            SqlEnvChange[] changeArray = new SqlEnvChange[3];
            while (tokenLength > num4)
            {
                int num3;
                ushort num5;
                if (index >= changeArray.Length)
                {
                    SqlEnvChange[] changeArray2 = new SqlEnvChange[changeArray.Length + 3];
                    for (int i = 0; i < changeArray.Length; i++)
                    {
                        changeArray2[i] = changeArray[i];
                    }
                    changeArray = changeArray2;
                }
                SqlEnvChange env = new SqlEnvChange {
                    type = stateObj.ReadByte()
                };
                changeArray[index] = env;
                index++;
                switch (env.type)
                {
                    case 1:
                    case 2:
                        this.ReadTwoStringFields(env, stateObj);
                        goto Label_03E0;

                    case 3:
                        this.ReadTwoStringFields(env, stateObj);
                        if (!(env.newValue == "iso_1"))
                        {
                            break;
                        }
                        this._defaultCodePage = 0x4e4;
                        this._defaultEncoding = Encoding.GetEncoding(this._defaultCodePage);
                        goto Label_03E0;

                    case 4:
                    {
                        this.ReadTwoStringFields(env, stateObj);
                        int size = int.Parse(env.newValue, NumberStyles.Integer, CultureInfo.InvariantCulture);
                        if (this._physicalStateObj.SetPacketSize(size))
                        {
                            this._physicalStateObj._sniPacket.Dispose();
                            uint qInfo = (uint) size;
                            SNINativeMethodWrapper.SNISetInfo(this._physicalStateObj.Handle, SNINativeMethodWrapper.QTypes.SNI_QUERY_CONN_BUFSIZE, ref qInfo);
                            this._physicalStateObj._sniPacket = new SNIPacket(this._physicalStateObj.Handle);
                        }
                        goto Label_03E0;
                    }
                    case 5:
                        this.ReadTwoStringFields(env, stateObj);
                        this._defaultLCID = int.Parse(env.newValue, NumberStyles.Integer, CultureInfo.InvariantCulture);
                        goto Label_03E0;

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

                    case 7:
                        env.newLength = stateObj.ReadByte();
                        if (env.newLength == 5)
                        {
                            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);
//.........这里部分代码省略.........
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:101,代码来源:TdsParser.cs

示例10: ProcessError

 internal SqlError ProcessError(byte token, TdsParserStateObject stateObj)
 {
     int num2;
     int infoNumber = stateObj.ReadInt32();
     byte errorState = stateObj.ReadByte();
     byte errorClass = stateObj.ReadByte();
     int length = stateObj.ReadUInt16();
     string errorMessage = stateObj.ReadString(length);
     length = stateObj.ReadByte();
     if (length != 0)
     {
         stateObj.ReadString(length);
     }
     length = stateObj.ReadByte();
     string procedure = stateObj.ReadString(length);
     if (this._isYukon)
     {
         num2 = stateObj.ReadInt32();
     }
     else
     {
         num2 = stateObj.ReadUInt16();
         if ((this._state == TdsParserState.OpenNotLoggedIn) && (stateObj.PeekByte() == 0))
         {
             num2 = (num2 << 0x10) + stateObj.ReadUInt16();
         }
     }
     return new SqlError(infoNumber, errorState, errorClass, this._server, errorMessage, procedure, num2);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:29,代码来源:TdsParser.cs

示例11: ProcessColumnHeader

 internal ulong ProcessColumnHeader(SqlMetaDataPriv col, TdsParserStateObject stateObj, out bool isNull)
 {
     if (col.metaType.IsLong && !col.metaType.IsPlp)
     {
         byte num = stateObj.ReadByte();
         if (num != 0)
         {
             this.SkipBytes(num, stateObj);
             this.SkipBytes(8, stateObj);
             isNull = false;
             return this.GetDataLength(col, stateObj);
         }
         isNull = true;
         return 0L;
     }
     ulong dataLength = this.GetDataLength(col, stateObj);
     isNull = this.IsNull(col.metaType, dataLength);
     if (!isNull)
     {
         return dataLength;
     }
     return 0L;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:23,代码来源:TdsParser.cs

示例12: ProcessCollation

 internal SqlCollation ProcessCollation(TdsParserStateObject stateObj)
 {
     return new SqlCollation { info = stateObj.ReadUInt32(), sortId = stateObj.ReadByte() };
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:4,代码来源:TdsParser.cs

示例13: ProcessColInfo

 private _SqlMetaDataSet ProcessColInfo(_SqlMetaDataSet columns, SqlDataReader reader, TdsParserStateObject stateObj)
 {
     for (int i = 0; i < columns.Length; i++)
     {
         _SqlMetaData data = columns[i];
         stateObj.ReadByte();
         data.tableNum = stateObj.ReadByte();
         byte num = stateObj.ReadByte();
         data.isDifferentName = 0x20 == (num & 0x20);
         data.isExpression = 4 == (num & 4);
         data.isKey = 8 == (num & 8);
         data.isHidden = 0x10 == (num & 0x10);
         if (data.isDifferentName)
         {
             byte length = stateObj.ReadByte();
             data.baseColumn = stateObj.ReadString(length);
         }
         if ((reader.TableNames != null) && (data.tableNum > 0))
         {
             data.multiPartTableName = reader.TableNames[data.tableNum - 1];
         }
         if (data.isExpression)
         {
             data.updatability = 0;
         }
     }
     return columns;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:TdsParser.cs

示例14: ReadSqlVariant

        internal void ReadSqlVariant(SqlBuffer value, int lenTotal, TdsParserStateObject stateObj)
        {
            byte tdsType = stateObj.ReadByte();
            byte num2 = stateObj.ReadByte();
            byte propBytes = MetaType.GetSqlDataType(tdsType, 0, 0).PropBytes;
            int num9 = 2 + num2;
            int length = lenTotal - num9;
            switch (tdsType)
            {
                case 0xe7:
                case 0xef:
                case 0xa7:
                case 0xaf:
                    this.ProcessCollation(stateObj);
                    stateObj.ReadUInt16();
                    if (num2 > propBytes)
                    {
                        this.SkipBytes(num2 - propBytes, stateObj);
                    }
                    this.ReadSqlStringValue(value, tdsType, length, null, false, stateObj);
                    return;

                case 0xa5:
                case 0xad:
                    stateObj.ReadUInt16();
                    if (num2 > propBytes)
                    {
                        this.SkipBytes(num2 - propBytes, stateObj);
                    }
                    break;

                case 0xa6:
                case 0xae:
                case 0x25:
                case 0x26:
                case 0x27:
                case 0x2c:
                case 0x2d:
                case 0x2e:
                case 0x2f:
                case 0x31:
                case 0x33:
                case 0x35:
                case 0x36:
                case 0x37:
                case 0x39:
                case 0x6b:
                    return;

                case 0x7a:
                case 0x7f:
                case 0x24:
                case 0x30:
                case 50:
                case 0x34:
                case 0x38:
                case 0x3a:
                case 0x3b:
                case 60:
                case 0x3d:
                case 0x3e:
                    break;

                case 40:
                    this.ReadSqlDateTime(value, tdsType, length, 0, stateObj);
                    return;

                case 0x29:
                case 0x2a:
                case 0x2b:
                {
                    byte scale = stateObj.ReadByte();
                    if (num2 > propBytes)
                    {
                        this.SkipBytes(num2 - propBytes, stateObj);
                    }
                    this.ReadSqlDateTime(value, tdsType, length, scale, stateObj);
                    return;
                }
                case 0x6a:
                case 0x6c:
                {
                    byte precision = stateObj.ReadByte();
                    byte num7 = stateObj.ReadByte();
                    if (num2 > propBytes)
                    {
                        this.SkipBytes(num2 - propBytes, stateObj);
                    }
                    this.ReadSqlDecimal(value, 0x11, precision, num7, stateObj);
                    return;
                }
                default:
                    return;
            }
            this.ReadSqlValueInternal(value, tdsType, 0, length, stateObj);
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:96,代码来源:TdsParser.cs

示例15: ProcessOneTable

        private MultiPartTableName ProcessOneTable(TdsParserStateObject stateObj, ref int length)
        {
            ushort num;
            if (this._isShilohSP1)
            {
                MultiPartTableName name = new MultiPartTableName();
                byte num2 = stateObj.ReadByte();
                length--;
                switch (num2)
                {
                    case 4:
                        num = stateObj.ReadUInt16();
                        length -= 2;
                        name.ServerName = stateObj.ReadString(num);
                        num2 = (byte) (num2 - 1);
                        length -= num * 2;
                        break;

                    case 3:
                        num = stateObj.ReadUInt16();
                        length -= 2;
                        name.CatalogName = stateObj.ReadString(num);
                        length -= num * 2;
                        num2 = (byte) (num2 - 1);
                        break;

                    case 2:
                        num = stateObj.ReadUInt16();
                        length -= 2;
                        name.SchemaName = stateObj.ReadString(num);
                        length -= num * 2;
                        num2 = (byte) (num2 - 1);
                        break;

                    case 1:
                        num = stateObj.ReadUInt16();
                        length -= 2;
                        name.TableName = stateObj.ReadString(num);
                        length -= num * 2;
                        num2 = (byte) (num2 - 1);
                        break;
                }
                return name;
            }
            num = stateObj.ReadUInt16();
            length -= 2;
            string str = stateObj.ReadString(num);
            length -= num * 2;
            return new MultiPartTableName(MultipartIdentifier.ParseMultipartIdentifier(str, "[\"", "]\"", "SQL_TDSParserTableName", false));
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:50,代码来源:TdsParser.cs


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