mysql2
Version:
fast mysql driver. Implements core protocol, prepared statements, ssl and compression in native JS
28 lines (23 loc) • 715 B
JavaScript
var Command = require('./command');
var util = require('util');
var CommandCode = require('../constants/commands');
var Packets = require('../packets');
function RegisterSlave (opts, callback)
{
Command.call(this);
this.onResult = callback;
this.opts = opts;
}
util.inherits(RegisterSlave, Command);
RegisterSlave.prototype.start = function (packet, connection) {
var packet = new Packets.RegisterSlave(this.opts);
connection.writePacket(packet.toPacket(1));
return RegisterSlave.prototype.registerResponse;
};
RegisterSlave.prototype.registerResponse = function (packet) {
if (this.onResult) {
process.nextTick(this.onResult.bind(this));
}
return null;
};
module.exports = RegisterSlave;