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()); } }
public override void ParsePacket(PacketParser parser) { ParsePacketHeader(parser); fieldCount = parser.ParseByte(); if (protocol41) { warningCount = parser.ParseUnsigned2(); //2 serverStatus = parser.ParseUnsigned2(); //2 } }
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); } }
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); //} }
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 }
public override void ParsePacket(PacketParser parser) { ParsePacketHeader(parser); if (protocol41) { clientFlags = parser.ParseUnsigned4(); //4 maxPacketSize = parser.ParseUnsigned4(); //4 charsetNumber = parser.ParseByte(); parser.ParseFiller(23); user = parser.ParseNullTerminatedString(); scrambleBuff = parser.ParseLengthCodedBuffer(); database = parser.ParseNullTerminatedString(); } else { clientFlags = parser.ParseUnsigned2(); //2 maxPacketSize = parser.ParseUnsigned3(); //3 user = parser.ParseNullTerminatedString(); scrambleBuff = parser.ParseBuffer(8); database = parser.ParseLengthCodedString(); } }
void ParseValues(PacketParser parser, FieldPacket fieldInfo, ref MyStructData myData) { Types fieldType = (Types)fieldInfo.type; switch (fieldType) { case Types.TIMESTAMP: // case Types.DATE: // case Types.DATETIME: // case Types.NEWDATE: // myData.myDateTime = parser.ParseLengthCodedDateTime(); myData.type = fieldType; break; case Types.TINY: //length = 1; myData.myInt32 = parser.ParseUnsigned1(); myData.type = fieldType; break; case Types.SHORT: //length = 2; case Types.YEAR: //length = 2; myData.myInt32 = (int)parser.ParseUnsigned2(); myData.type = fieldType; break; case Types.INT24: case Types.LONG: //length = 4; myData.myInt32 = (int)parser.ParseUnsigned4(); myData.type = fieldType; break; case Types.FLOAT: myData.myDouble = parser.ParseFloat(); myData.type = fieldType; break; case Types.DOUBLE: myData.myDouble = parser.ParseDouble(); myData.type = fieldType; break; case Types.NEWDECIMAL: myData.myDecimal = parser.ParseDecimal(); myData.type = fieldType; break; case Types.LONGLONG: myData.myInt64 = parser.ParseInt64(); myData.type = fieldType; break; case Types.STRING: case Types.VARCHAR: case Types.VAR_STRING: myData.myString = parser.ParseLengthCodedString(); myData.type = fieldType; break; case Types.TINY_BLOB: case Types.MEDIUM_BLOB: case Types.LONG_BLOB: case Types.BLOB: case Types.BIT: myData.myBuffer = parser.ParseLengthCodedBuffer(); myData.type = fieldType; break; case Types.GEOMETRY: default: myData.myBuffer = parser.ParseLengthCodedBuffer(); myData.type = Types.NULL; break; } }