mysql2 3.1.2 → 3.2.0

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/lib/connection.js CHANGED
@@ -347,7 +347,8 @@ class Connection extends EventEmitter {
347
347
  ciphers: this.config.ssl.ciphers,
348
348
  key: this.config.ssl.key,
349
349
  passphrase: this.config.ssl.passphrase,
350
- minVersion: this.config.ssl.minVersion
350
+ minVersion: this.config.ssl.minVersion,
351
+ maxVersion: this.config.ssl.maxVersion
351
352
  });
352
353
  const rejectUnauthorized = this.config.ssl.rejectUnauthorized;
353
354
  const verifyIdentity = this.config.ssl.verifyIdentity;
@@ -10,6 +10,7 @@
10
10
  const { URL } = require('url');
11
11
  const ClientConstants = require('./constants/client');
12
12
  const Charsets = require('./constants/charsets');
13
+ const { version } = require('../package.json')
13
14
  let SSLProfiles = null;
14
15
 
15
16
  const validOptions = {
@@ -169,7 +170,13 @@ class ConnectionConfig {
169
170
  ConnectionConfig.getDefaultFlags(options),
170
171
  options.flags || ''
171
172
  );
172
- this.connectAttributes = options.connectAttributes;
173
+ // Default connection attributes
174
+ // https://dev.mysql.com/doc/refman/8.0/en/performance-schema-connection-attribute-tables.html
175
+ const defaultConnectAttributes = {
176
+ _client_name: 'Node-MySQL-2',
177
+ _client_version: version
178
+ };
179
+ this.connectAttributes = { ...defaultConnectAttributes, ...(options.connectAttributes || {})};
173
180
  this.maxPreparedStatements = options.maxPreparedStatements || 16000;
174
181
  }
175
182
 
@@ -217,7 +224,8 @@ class ConnectionConfig {
217
224
  'SECURE_CONNECTION',
218
225
  'MULTI_RESULTS',
219
226
  'TRANSACTIONS',
220
- 'SESSION_TRACK'
227
+ 'SESSION_TRACK',
228
+ 'CONNECT_ATTRS'
221
229
  ];
222
230
  if (options && options.multipleStatements) {
223
231
  defaultFlags.push('MULTI_STATEMENTS');
@@ -225,9 +233,6 @@ class ConnectionConfig {
225
233
  defaultFlags.push('PLUGIN_AUTH');
226
234
  defaultFlags.push('PLUGIN_AUTH_LENENC_CLIENT_DATA');
227
235
 
228
- if (options && options.connectAttributes) {
229
- defaultFlags.push('CONNECT_ATTRS');
230
- }
231
236
  return defaultFlags;
232
237
  }
233
238
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mysql2",
3
- "version": "3.1.2",
3
+ "version": "3.2.0",
4
4
  "description": "fast mysql driver. Implements core protocol, prepared statements, ssl and compression in native JS",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -228,6 +228,11 @@ declare namespace Connection {
228
228
  */
229
229
  minVersion?: string;
230
230
 
231
+ /**
232
+ * Configure the maximum supported version of SSL, the default is TLSv1.3.
233
+ */
234
+ maxVersion?: string;
235
+
231
236
  /**
232
237
  * You can verify the server name identity presented on the server certificate when connecting to a MySQL server.
233
238
  * You should enable this but it is disabled by default right now for backwards compatibility.