ComQueryPacket.js 405 B

123456789101112131415
  1. module.exports = ComQueryPacket;
  2. function ComQueryPacket(sql) {
  3. this.command = 0x03;
  4. this.sql = sql;
  5. }
  6. ComQueryPacket.prototype.write = function(writer) {
  7. writer.writeUnsignedNumber(1, this.command);
  8. writer.writeString(this.sql);
  9. };
  10. ComQueryPacket.prototype.parse = function(parser) {
  11. this.command = parser.parseUnsignedNumber(1);
  12. this.sql = parser.parsePacketTerminatedString();
  13. };