Пример #1
0
        public override void ParsePacket(PacketParser parser)
        {
            ParsePacketHeader(parser);
            if (protocol41)
            {
                catalog  = parser.ParseLengthCodedString();
                db       = parser.ParseLengthCodedString();
                table    = parser.ParseLengthCodedString();
                orgTable = parser.ParseLengthCodedString();
                name     = parser.ParseLengthCodedString();
                orgName  = parser.ParseLengthCodedString();

                if (parser.ParseLengthCodedNumber() != 0x0c)
                {
                    //var err  = new TypeError('Received invalid field length');
                    //err.code = 'PARSER_INVALID_FIELD_LENGTH';
                    //throw err;
                    throw new Exception("Received invalid field length");
                }

                charsetNr = parser.ParseUnsigned2(); //2
                length    = parser.ParseUnsigned4(); //4
                type      = parser.ParseByte();
                flags     = parser.ParseUnsigned2(); //2
                decimals  = parser.ParseByte();

                filler = parser.ParseBuffer(2);
                if (filler[0] != 0x0 || filler[1] != 0x0)
                {
                    //var err  = new TypeError('Received invalid filler');
                    //err.code = 'PARSER_INVALID_FILLER';
                    //throw err;
                    throw new Exception("Received invalid filler");
                }

                // parsed flags
                //this.zeroFill = (this.flags & 0x0040 ? true : false);
                zeroFill = ((flags & 0x0040) == 0x0040 ? true : false);

                //    if (parser.reachedPacketEnd()) {
                //      return;
                //    }
                if (parser.ReachedPacketEnd())
                {
                    return;
                }
                strDefault = parser.ParseLengthCodedString();
            }
            else
            {
                table  = parser.ParseLengthCodedString();
                name   = parser.ParseLengthCodedString();
                length = parser.ParseUnsignedNumber(parser.ParseByte());
                type   = (int)parser.ParseUnsignedNumber(parser.ParseByte());
            }
        }
Пример #2
0
        public override void ParsePacket(PacketParser parser)
        {
            ParsePacketHeader(parser);
            _fieldCount = parser.ParseLengthCodedNumber();

            if (parser.ReachedPacketEnd())
            {
                return;
            }

            if (_fieldCount == 0)
            {
                _extraStr = parser.ParsePacketTerminatedString();
            }
            else
            {
                _extraNumber = parser.ParseLengthCodedNumber();
                _extraStr    = parser.ParsePacketTerminatedString();//null;
            }
        }
Пример #3
0
        public override void ParsePacket(PacketParser parser)
        {
            ParsePacketHeader(parser);

            _fieldCount  = parser.ParseUnsigned1();
            affectedRows = parser.ParseLengthCodedNumber();
            insertId     = parser.ParseLengthCodedNumber();

            if (_protocol41)
            {
                _serverStatus = parser.ParseUnsigned2();
                _warningCount = parser.ParseUnsigned2();
            }
            _message = parser.ParsePacketTerminatedString();
            //var m = this.message.match(/\schanged:\s * (\d +) / i);

            //if (m !== null)
            //{
            //    this.changedRows = parseInt(m[1], 10);
            //}
        }