close_statement.js 454 B

123456789101112131415161718192021
  1. 'use strict';
  2. const Packet = require('../packets/packet');
  3. const CommandCodes = require('../constants/commands');
  4. class CloseStatement {
  5. constructor(id) {
  6. this.id = id;
  7. }
  8. // note: no response sent back
  9. toPacket() {
  10. const packet = new Packet(0, Buffer.allocUnsafe(9), 0, 9);
  11. packet.offset = 4;
  12. packet.writeInt8(CommandCodes.STMT_CLOSE);
  13. packet.writeInt32(this.id);
  14. return packet;
  15. }
  16. }
  17. module.exports = CloseStatement;