Backend/node_modules/mysql/lib/protocol/packets/LocalInfileRequestPacket.js

22 lines
609 B
JavaScript
Raw Normal View History

2021-12-31 09:33:23 +00:00
module.exports = LocalInfileRequestPacket;
function LocalInfileRequestPacket(options) {
options = options || {};
this.filename = options.filename;
}
LocalInfileRequestPacket.prototype.parse = function parse(parser) {
if (parser.parseLengthCodedNumber() !== null) {
var err = new TypeError('Received invalid field length');
err.code = 'PARSER_INVALID_FIELD_LENGTH';
throw err;
}
this.filename = parser.parsePacketTerminatedString();
};
LocalInfileRequestPacket.prototype.write = function write(writer) {
writer.writeLengthCodedNumber(null);
writer.writeString(this.filename);
};