mysql2 3.9.1 → 3.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -31,12 +31,18 @@
31
31
  [docs-faq]: https://sidorares.github.io/node-mysql2/docs/faq
32
32
  [docs-documentation]: https://sidorares.github.io/node-mysql2/docs/documentation
33
33
  [docs-contributing]: https://sidorares.github.io/node-mysql2/docs/contributing/website
34
+ [coverage]: https://img.shields.io/codecov/c/github/sidorares/node-mysql2
35
+ [coverage-url]: https://app.codecov.io/github/sidorares/node-mysql2
36
+ [ci-url]: https://github.com/sidorares/node-mysql2/actions/workflows/ci-coverage.yml?query=branch%3Amaster
37
+ [ci-image]: https://img.shields.io/github/actions/workflow/status/sidorares/node-mysql2/ci-coverage.yml?event=push&style=flat&label=CI&branch=master
34
38
 
35
39
  # MySQL2
36
40
 
37
41
  [![NPM Version][npm-image]][npm-url]
38
42
  [![NPM Downloads][downloads-image]][downloads-url]
39
43
  [![Node.js Version][node-version-image]][node-version-url]
44
+ [![GitHub Workflow Status (with event)][ci-image]][ci-url]
45
+ [![Codecov][coverage]][coverage-url]
40
46
  [![License][license-image]][license-url]
41
47
 
42
48
  [English][docs-base] | [简体中文][docs-base-zh-CN] | [Português (BR)][docs-base-pt-BR]
@@ -102,7 +108,7 @@ npm install --save-dev @types/node
102
108
 
103
109
  ## Contributing
104
110
 
105
- Want to improve something in **MySQL2**?
111
+ Want to improve something in **MySQL2**?
106
112
  Please check [Contributing.md][contributing] for detailed instruction on how to get started.
107
113
 
108
114
  To contribute in **MySQL2 Documentation**, please visit the [Website Contributing Guidelines][docs-contributing] for detailed instruction on how to get started.
@@ -30,7 +30,7 @@ class Query extends Command {
30
30
  this._receivedFieldsCount = 0;
31
31
  this._resultIndex = 0;
32
32
  this._localStream = null;
33
- this._unpipeStream = function() {};
33
+ this._unpipeStream = function () { };
34
34
  this._streamFactory = options.infileStreamFactory;
35
35
  this._connection = null;
36
36
  }
@@ -155,7 +155,7 @@ class Query extends Command {
155
155
  const onPause = () => {
156
156
  this._localStream.pause();
157
157
  };
158
- const onData = function(data) {
158
+ const onData = function (data) {
159
159
  const dataWithHeader = Buffer.allocUnsafe(data.length + 4);
160
160
  data.copy(dataWithHeader, 4);
161
161
  connection.writePacket(
@@ -227,7 +227,7 @@ class Query extends Command {
227
227
  }
228
228
 
229
229
  /* eslint no-unused-vars: ["error", { "argsIgnorePattern": "^_" }] */
230
- row(packet, _connection) {
230
+ row(packet, _connection) {
231
231
  if (packet.isEOF()) {
232
232
  const status = packet.eofStatusFlags();
233
233
  const moreResults = status & ServerStatus.SERVER_MORE_RESULTS_EXISTS;
@@ -279,11 +279,13 @@ class Query extends Command {
279
279
  });
280
280
  this.on('end', () => {
281
281
  stream.push(null); // pushing null, indicating EOF
282
- setImmediate(() => stream.emit('close')); // notify readers that query has completed
283
282
  });
284
283
  this.on('fields', fields => {
285
284
  stream.emit('fields', fields); // replicate old emitter
286
285
  });
286
+ stream.on('end', () => {
287
+ stream.emit('close');
288
+ });
287
289
  return stream;
288
290
  }
289
291
 
@@ -302,7 +304,7 @@ class Query extends Command {
302
304
  Timers.clearTimeout(this.queryTimeout);
303
305
  this.queryTimeout = null;
304
306
  }
305
-
307
+
306
308
  const err = new Error('Query inactivity timeout');
307
309
  err.errorno = 'PROTOCOL_SEQUENCE_TIMEOUT';
308
310
  err.code = 'PROTOCOL_SEQUENCE_TIMEOUT';