• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mysqljs / mysql / 3954445999

pending completion
3954445999

push

github

Douglas Christopher Wilson
build: ubuntu@20.04

869 of 1014 branches covered (85.7%)

5111 of 5264 relevant lines covered (97.09%)

687.08 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

82.61
/lib/protocol/packets/OkPacket.js
1

2
// Language-neutral expression to match ER_UPDATE_INFO
3
var ER_UPDATE_INFO_REGEXP = /^[^:0-9]+: [0-9]+[^:0-9]+: ([0-9]+)[^:0-9]+: [0-9]+[^:0-9]*$/;
396✔
4

5
module.exports = OkPacket;
396✔
6
function OkPacket(options) {
7
  options = options || {};
1,284✔
8

9
  this.fieldCount   = undefined;
1,284✔
10
  this.affectedRows = undefined;
1,284✔
11
  this.insertId     = undefined;
1,284✔
12
  this.serverStatus = undefined;
1,284✔
13
  this.warningCount = undefined;
1,284✔
14
  this.message      = undefined;
1,284✔
15
  this.protocol41   = options.protocol41;
1,284✔
16
}
17

18
OkPacket.prototype.parse = function(parser) {
396✔
19
  this.fieldCount   = parser.parseUnsignedNumber(1);
922✔
20
  this.affectedRows = parser.parseLengthCodedNumber();
922✔
21
  this.insertId     = parser.parseLengthCodedNumber();
922✔
22
  if (this.protocol41) {
922!
23
    this.serverStatus = parser.parseUnsignedNumber(2);
922✔
24
    this.warningCount = parser.parseUnsignedNumber(2);
922✔
25
  }
26
  this.message      = parser.parsePacketTerminatedString();
922✔
27
  this.changedRows  = 0;
922✔
28

29
  var m = ER_UPDATE_INFO_REGEXP.exec(this.message);
922✔
30
  if (m !== null) {
922✔
31
    this.changedRows = parseInt(m[1], 10);
6✔
32
  }
33
};
34

35
OkPacket.prototype.write = function(writer) {
396✔
36
  writer.writeUnsignedNumber(1, 0x00);
362✔
37
  writer.writeLengthCodedNumber(this.affectedRows || 0);
362✔
38
  writer.writeLengthCodedNumber(this.insertId || 0);
362✔
39
  if (this.protocol41) {
362!
40
    writer.writeUnsignedNumber(2, this.serverStatus || 0);
×
41
    writer.writeUnsignedNumber(2, this.warningCount || 0);
×
42
  }
43
  writer.writeString(this.message);
362✔
44
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc