EofPacket.js 613 B

123456789101112131415161718192021
  1. module.exports = EofPacket;
  2. function EofPacket(options) {
  3. options = options || {};
  4. this.fieldCount = undefined;
  5. this.warningCount = options.warningCount;
  6. this.serverStatus = options.serverStatus;
  7. }
  8. EofPacket.prototype.parse = function(parser) {
  9. this.fieldCount = parser.parseUnsignedNumber(1);
  10. this.warningCount = parser.parseUnsignedNumber(2);
  11. this.serverStatus = parser.parseUnsignedNumber(2);
  12. };
  13. EofPacket.prototype.write = function(writer) {
  14. writer.writeUnsignedNumber(1, 0xfe);
  15. writer.writeUnsignedNumber(2, this.warningCount);
  16. writer.writeUnsignedNumber(2, this.serverStatus);
  17. };