Skip to content

Commit 88b44fe

Browse files
committed
rename id to _id so it doesn't conflict with RowDataPacket
1 parent 22c2551 commit 88b44fe

32 files changed

+36
-36
lines changed

lib/protocol/Protocol.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ Protocol.prototype._enqueue = function(sequence) {
157157
self._emitPacket(packet);
158158
})
159159
.on('timeout', function() {
160-
var err = new Error(sequence.id + ' inactivity timeout');
160+
var err = new Error(sequence._id + ' inactivity timeout');
161161

162162
err.code = 'PROTOCOL_SEQUENCE_TIMEOUT';
163163
err.fatal = true;
@@ -206,7 +206,7 @@ Protocol.prototype._enqueue = function(sequence) {
206206

207207
Protocol.prototype._validateEnqueue = function _validateEnqueue(sequence) {
208208
var err;
209-
var prefix = 'Cannot enqueue ' + sequence.id;
209+
var prefix = 'Cannot enqueue ' + sequence._id;
210210

211211
if (this._fatalError) {
212212
err = new Error(prefix + ' after fatal error.');
@@ -253,7 +253,7 @@ Protocol.prototype._parsePacket = function() {
253253

254254
var Packet = this._determinePacket(sequence);
255255
var packet = new Packet({protocol41: this._config.protocol41});
256-
var packetName = packet.id;
256+
var packetName = packet._id;
257257

258258
// Special case: Faster dispatch, and parsing done inside sequence
259259
if (Packet === Packets.RowDataPacket) {
@@ -447,7 +447,7 @@ Protocol.prototype._debugPacket = function(incoming, packet) {
447447
var direction = incoming
448448
? '<--'
449449
: '-->';
450-
var packetName = packet.id;
450+
var packetName = packet._id;
451451
var threadId = connection && connection.threadId !== null
452452
? ' (' + connection.threadId + ')'
453453
: '';

lib/protocol/packets/AuthSwitchRequestPacket.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function AuthSwitchRequestPacket(options) {
77
this.authMethodData = options.authMethodData;
88
}
99

10-
AuthSwitchRequestPacket.prototype.id = 'AuthSwitchRequestPacket';
10+
AuthSwitchRequestPacket.prototype._id = 'AuthSwitchRequestPacket';
1111

1212
AuthSwitchRequestPacket.prototype.parse = function parse(parser) {
1313
this.status = parser.parseUnsignedNumber(1);

lib/protocol/packets/AuthSwitchResponsePacket.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function AuthSwitchResponsePacket(options) {
55
this.data = options.data;
66
}
77

8-
AuthSwitchResponsePacket.prototype.id = 'AuthSwitchResponsePacket';
8+
AuthSwitchResponsePacket.prototype._id = 'AuthSwitchResponsePacket';
99

1010
AuthSwitchResponsePacket.prototype.parse = function parse(parser) {
1111
this.data = parser.parsePacketTerminatedBuffer();

lib/protocol/packets/ClientAuthenticationPacket.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function ClientAuthenticationPacket(options) {
1414
this.protocol41 = options.protocol41;
1515
}
1616

17-
ClientAuthenticationPacket.prototype.id = 'ClientAuthenticationPacket';
17+
ClientAuthenticationPacket.prototype._id = 'ClientAuthenticationPacket';
1818

1919
ClientAuthenticationPacket.prototype.parse = function(parser) {
2020
if (this.protocol41) {

lib/protocol/packets/ComChangeUserPacket.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function ComChangeUserPacket(options) {
99
this.charsetNumber = options.charsetNumber;
1010
}
1111

12-
ComChangeUserPacket.prototype.id = 'ComChangeUserPacket';
12+
ComChangeUserPacket.prototype._id = 'ComChangeUserPacket';
1313

1414
ComChangeUserPacket.prototype.parse = function(parser) {
1515
this.command = parser.parseUnsignedNumber(1);

lib/protocol/packets/ComPingPacket.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function ComPingPacket() {
33
this.command = 0x0e;
44
}
55

6-
ComPingPacket.prototype.id = 'ComPingPacket';
6+
ComPingPacket.prototype._id = 'ComPingPacket';
77

88
ComPingPacket.prototype.write = function(writer) {
99
writer.writeUnsignedNumber(1, this.command);

lib/protocol/packets/ComQueryPacket.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function ComQueryPacket(sql) {
44
this.sql = sql;
55
}
66

7-
ComQueryPacket.prototype.id = 'ComQueryPacket';
7+
ComQueryPacket.prototype._id = 'ComQueryPacket';
88

99
ComQueryPacket.prototype.write = function(writer) {
1010
writer.writeUnsignedNumber(1, this.command);

lib/protocol/packets/ComQuitPacket.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function ComQuitPacket() {
33
this.command = 0x01;
44
}
55

6-
ComQuitPacket.prototype.id = 'ComQuitPacket';
6+
ComQuitPacket.prototype._id = 'ComQuitPacket';
77

88
ComQuitPacket.prototype.parse = function parse(parser) {
99
this.command = parser.parseUnsignedNumber(1);

lib/protocol/packets/ComStatisticsPacket.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function ComStatisticsPacket() {
33
this.command = 0x09;
44
}
55

6-
ComStatisticsPacket.prototype.id = 'ComStatisticsPacket';
6+
ComStatisticsPacket.prototype._id = 'ComStatisticsPacket';
77

88
ComStatisticsPacket.prototype.write = function(writer) {
99
writer.writeUnsignedNumber(1, this.command);

lib/protocol/packets/EmptyPacket.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module.exports = EmptyPacket;
22
function EmptyPacket() {
33
}
44

5-
EmptyPacket.prototype.id = 'EmptyPacket';
5+
EmptyPacket.prototype._id = 'EmptyPacket';
66

77
EmptyPacket.prototype.parse = function parse() {
88
};

lib/protocol/packets/EofPacket.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function EofPacket(options) {
88
this.protocol41 = options.protocol41;
99
}
1010

11-
EofPacket.prototype.id = 'EofPacket';
11+
EofPacket.prototype._id = 'EofPacket';
1212

1313
EofPacket.prototype.parse = function(parser) {
1414
this.fieldCount = parser.parseUnsignedNumber(1);

lib/protocol/packets/ErrorPacket.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function ErrorPacket(options) {
99
this.message = options.message;
1010
}
1111

12-
ErrorPacket.prototype.id = 'ErrorPacket';
12+
ErrorPacket.prototype._id = 'ErrorPacket';
1313

1414
ErrorPacket.prototype.parse = function(parser) {
1515
this.fieldCount = parser.parseUnsignedNumber(1);

lib/protocol/packets/Field.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function Field(options) {
1313
this.length = options.packet.length;
1414
}
1515

16-
Field.prototype.id = 'Field';
16+
Field.prototype._id = 'Field';
1717

1818
Field.prototype.string = function () {
1919
return this.parser.parseLengthCodedString();

lib/protocol/packets/FieldPacket.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function FieldPacket(options) {
1818
this.protocol41 = options.protocol41;
1919
}
2020

21-
FieldPacket.prototype.id = 'FieldPacket';
21+
FieldPacket.prototype._id = 'FieldPacket';
2222

2323
FieldPacket.prototype.parse = function(parser) {
2424
if (this.protocol41) {

lib/protocol/packets/HandshakeInitializationPacket.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function HandshakeInitializationPacket(options) {
2727
}
2828
}
2929

30-
HandshakeInitializationPacket.prototype.id = 'HandshakeInitializationPacket';
30+
HandshakeInitializationPacket.prototype._id = 'HandshakeInitializationPacket';
3131

3232
HandshakeInitializationPacket.prototype.parse = function(parser) {
3333
this.protocolVersion = parser.parseUnsignedNumber(1);

lib/protocol/packets/LocalDataFilePacket.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function LocalDataFilePacket(data) {
1010
this.data = data;
1111
}
1212

13-
LocalDataFilePacket.prototype.id = 'LocalDataFilePacket';
13+
LocalDataFilePacket.prototype._id = 'LocalDataFilePacket';
1414

1515
LocalDataFilePacket.prototype.write = function(writer) {
1616
writer.writeBuffer(this.data);

lib/protocol/packets/LocalInfileRequestPacket.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function LocalInfileRequestPacket(options) {
55
this.filename = options.filename;
66
}
77

8-
LocalInfileRequestPacket.prototype.id = 'LocalInfileRequestPacket';
8+
LocalInfileRequestPacket.prototype._id = 'LocalInfileRequestPacket';
99

1010
LocalInfileRequestPacket.prototype.parse = function parse(parser) {
1111
if (parser.parseLengthCodedNumber() !== null) {

lib/protocol/packets/OkPacket.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function OkPacket(options) {
1515
this.protocol41 = options.protocol41;
1616
}
1717

18-
OkPacket.prototype.id = 'OkPacket';
18+
OkPacket.prototype._id = 'OkPacket';
1919

2020
OkPacket.prototype.parse = function(parser) {
2121
this.fieldCount = parser.parseUnsignedNumber(1);

lib/protocol/packets/OldPasswordPacket.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function OldPasswordPacket(options) {
55
this.scrambleBuff = options.scrambleBuff;
66
}
77

8-
OldPasswordPacket.prototype.id = 'OldPasswordPacket';
8+
OldPasswordPacket.prototype._id = 'OldPasswordPacket';
99

1010
OldPasswordPacket.prototype.parse = function(parser) {
1111
this.scrambleBuff = parser.parsePacketTerminatedBuffer();

lib/protocol/packets/ResultSetHeaderPacket.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function ResultSetHeaderPacket(options) {
55
this.fieldCount = options.fieldCount;
66
}
77

8-
ResultSetHeaderPacket.prototype.id = 'ResultSetHeaderPacket';
8+
ResultSetHeaderPacket.prototype._id = 'ResultSetHeaderPacket';
99

1010
ResultSetHeaderPacket.prototype.parse = function(parser) {
1111
this.fieldCount = parser.parseLengthCodedNumber();

lib/protocol/packets/RowDataPacket.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Object.defineProperty(RowDataPacket.prototype, '_typeCast', {
1919
value : typeCast
2020
});
2121

22-
Object.defineProperty(RowDataPacket.prototype, 'id', {
22+
Object.defineProperty(RowDataPacket.prototype, '_id', {
2323
configurable : true,
2424
enumerable : false,
2525
value : 'RowDataPacket'

lib/protocol/packets/SSLRequestPacket.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function SSLRequestPacket(options) {
1212
this.charsetNumber = options.charsetNumber;
1313
}
1414

15-
SSLRequestPacket.prototype.id = 'SSLRequestPacket';
15+
SSLRequestPacket.prototype._id = 'SSLRequestPacket';
1616

1717
SSLRequestPacket.prototype.parse = function(parser) {
1818
// TODO: check SSLRequest packet v41 vs pre v41

lib/protocol/packets/StatisticsPacket.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function StatisticsPacket() {
33
this.message = undefined;
44
}
55

6-
StatisticsPacket.prototype.id = 'StatisticsPacket';
6+
StatisticsPacket.prototype._id = 'StatisticsPacket';
77

88
StatisticsPacket.prototype.parse = function(parser) {
99
this.message = parser.parsePacketTerminatedString();

lib/protocol/packets/UseOldPasswordPacket.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function UseOldPasswordPacket(options) {
55
this.firstByte = options.firstByte || 0xfe;
66
}
77

8-
UseOldPasswordPacket.prototype.id = 'UseOldPasswordPacket';
8+
UseOldPasswordPacket.prototype._id = 'UseOldPasswordPacket';
99

1010
UseOldPasswordPacket.prototype.parse = function(parser) {
1111
this.firstByte = parser.parseUnsignedNumber(1);

lib/protocol/sequences/ChangeUser.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ ChangeUser.prototype.determinePacket = function determinePacket(firstByte) {
2323
}
2424
};
2525

26-
ChangeUser.prototype.id = 'ChangeUser';
26+
ChangeUser.prototype._id = 'ChangeUser';
2727

2828
ChangeUser.prototype.start = function(handshakeInitializationPacket) {
2929
var scrambleBuff = handshakeInitializationPacket.scrambleBuff();

lib/protocol/sequences/Handshake.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Handshake.prototype.determinePacket = function determinePacket(firstByte, parser
3333
return undefined;
3434
};
3535

36-
Handshake.prototype.id = 'Handshake';
36+
Handshake.prototype._id = 'Handshake';
3737

3838
Handshake.prototype['AuthSwitchRequestPacket'] = function (packet) {
3939
var name = packet.authMethodName;

lib/protocol/sequences/Ping.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function Ping(options, callback) {
1414
Sequence.call(this, options, callback);
1515
}
1616

17-
Ping.prototype.id = 'Ping';
17+
Ping.prototype._id = 'Ping';
1818

1919
Ping.prototype.start = function() {
2020
this.emit('packet', new Packets.ComPingPacket());

lib/protocol/sequences/Query.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function Query(options, callback) {
2626
this._loadError = null;
2727
}
2828

29-
Query.prototype.id = 'Query';
29+
Query.prototype._id = 'Query';
3030

3131
Query.prototype.start = function() {
3232
this.emit('packet', new Packets.ComQueryPacket(this.sql));

lib/protocol/sequences/Quit.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function Quit(options, callback) {
1515
this._started = false;
1616
}
1717

18-
Quit.prototype.id = 'Quit';
18+
Quit.prototype._id = 'Quit';
1919

2020
Quit.prototype.end = function end(err) {
2121
if (this._ended) {

lib/protocol/sequences/Sequence.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Sequence.determinePacket = function(byte) {
3838
}
3939
};
4040

41-
Sequence.prototype.id = 'Sequence';
41+
Sequence.prototype._id = 'Sequence';
4242

4343
Sequence.prototype.hasErrorHandler = function() {
4444
return Boolean(this._callback) || listenerCount(this, 'error') > 1;

lib/protocol/sequences/Statistics.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function Statistics(options, callback) {
1313
Sequence.call(this, options, callback);
1414
}
1515

16-
Statistics.prototype.id = 'Statistics';
16+
Statistics.prototype._id = 'Statistics';
1717

1818
Statistics.prototype.start = function() {
1919
this.emit('packet', new Packets.ComStatisticsPacket());

test/FakeServer.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,8 @@ FakeConnection.prototype._parsePacket = function _parsePacket(packetHeader) {
332332
}
333333
break;
334334
default:
335-
if (!this.emit(packet.id, packet)) {
336-
throw new Error('Unexpected packet: ' + packet.id);
335+
if (!this.emit(packet._id, packet)) {
336+
throw new Error('Unexpected packet: ' + packet._id);
337337
}
338338
}
339339
};

0 commit comments

Comments
 (0)