Update bot
Took 2 hours 17 minutes
This commit is contained in:
49
node_modules/mysql2/lib/commands/command.js
generated
vendored
Normal file
49
node_modules/mysql2/lib/commands/command.js
generated
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
'use strict';
|
||||
|
||||
const EventEmitter = require('events').EventEmitter;
|
||||
|
||||
class Command extends EventEmitter {
|
||||
constructor() {
|
||||
super();
|
||||
this.next = null;
|
||||
}
|
||||
|
||||
// slow. debug only
|
||||
stateName() {
|
||||
const state = this.next;
|
||||
for (const i in this) {
|
||||
if (this[i] === state && i !== 'next') {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 'unknown name';
|
||||
}
|
||||
|
||||
execute(packet, connection) {
|
||||
if (!this.next) {
|
||||
this.next = this.start;
|
||||
connection._resetSequenceId();
|
||||
}
|
||||
if (packet && packet.isError()) {
|
||||
const err = packet.asError(connection.clientEncoding);
|
||||
if (this.onResult) {
|
||||
this.onResult(err);
|
||||
this.emit('end');
|
||||
} else {
|
||||
this.emit('error', err);
|
||||
this.emit('end');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// TODO: don't return anything from execute, it's ugly and error-prone. Listen for 'end' event in connection
|
||||
this.next = this.next(packet, connection);
|
||||
if (this.next) {
|
||||
return false;
|
||||
}
|
||||
this.emit('end');
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Command;
|
Reference in New Issue
Block a user