Esempio n. 1
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;
            }
        }
Esempio n. 2
0
        public override void ParsePacket(PacketParser parser)
        {
            ParsePacketHeader(parser);

            _fieldCount = parser.ParseByte();
            _errno      = parser.ParseUnsigned2();//2

            if (parser.Peak() == 0x23)
            {
                _sqlStateMarker = parser.ParseChar();
                _sqlState       = parser.ParseString(5);
            }

            message = parser.ParsePacketTerminatedString();
#if DEBUG
            throw new Exception(_sqlStateMarker + _sqlState + " " + message);
#endif
        }
Esempio n. 3
0
        public override void ParsePacket(PacketParser parser)
        {
            ParsePacketHeader(parser);

            protocolVersion     = parser.ParseUnsigned1(); //1
            serverVertion       = parser.ParseNullTerminatedString();
            threadId            = parser.ParseUnsigned4(); //4
            scrambleBuff1       = parser.ParseBuffer(8);
            filler1             = parser.ParseByte();
            serverCapabilities1 = parser.ParseUnsigned2(); //2
            serverLanguage      = parser.ParseByte();
            serverStatus        = parser.ParseUnsigned2(); //2

            protocol41 = (serverCapabilities1 & (1 << 9)) > 0;
            if (protocol41)
            {
                serverCapabilities2 = parser.ParseUnsigned2();
                scrambleLength      = parser.ParseByte();
                filler2             = parser.ParseBuffer(10);

                scrambleBuff2 = parser.ParseBuffer(12);
                filler3       = parser.ParseByte();
            }
            else
            {
                filler2 = parser.ParseBuffer(13);
            }

            if (parser.Position == parser.Length)
            {
                return;
            }

            pluginData = parser.ParsePacketTerminatedString();
            var last = pluginData.Length - 1;

            if (pluginData[last] == '\0')
            {
                pluginData = pluginData.Substring(0, last);
            }
        }
Esempio n. 4
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);
            //}
        }
Esempio n. 5
0
 public override void ParsePacket(PacketParser parser)
 {
     ParsePacketHeader(parser);
     _QUERY_CMD = parser.ParseUnsigned1();//1
     _sql       = parser.ParsePacketTerminatedString();
 }