Skip to content

Commit

Permalink
Merge pull request #1008 from sidorares/test-1.7.0
Browse files Browse the repository at this point in the history
Test 1.7.0
  • Loading branch information
sidorares authored Aug 28, 2019
2 parents 280cf99 + cef866e commit c460c0f
Show file tree
Hide file tree
Showing 7 changed files with 1,005 additions and 2,127 deletions.
13 changes: 13 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
1.7.0
- Fix crashing when session info packet does not
start with length-coded string #1004, #989
- build: drop node 4 and 6 and add node v12 #997
- Add support for timezone connection option #996, #15, #262,
#642, #877, #888
- Make mysql2 compatible with minification #992, #890, #899,
#890
- fix serialisation of '00:00:00' time #968, #967
- Allow to set minVersion ssl option #961, #960
- Fix a MaxListenersExceededWarning with stream
local infile #965

1.6.5 (08/02/2019)
- allow to use namedPlaceholders flag per query #879
- migrate to more modern code style ( classes /
Expand Down
13 changes: 6 additions & 7 deletions benchmarks/FB/hello.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ const connMap = {
host: 'localhost'
};

Mapper.connect(
connMap,
{ verbose: false, strict: false }
);
Mapper.connect(connMap, { verbose: false, strict: false });
const World = Mapper.map('World', 'id', 'randomNumber');

const template = jade.compile(fs.readFileSync('./fortunes.jade'));
Expand Down Expand Up @@ -175,7 +172,8 @@ http
let values;
let queries;
let queryFunctions;
/* eslint-disable no-case-declarations, no-inner-declarations */
/* eslint-disable no-case-declarations */
/* eslint-disable no-inner-declarations */
switch (path) {
case '/json':
// JSON Response Test
Expand Down Expand Up @@ -293,7 +291,9 @@ http

rows[0].randomNumber = getRandomNumber();
libmysql.query(
`UPDATE World SET randomNumber = ${rows[0].randomNumber} WHERE id = ${rows[0]['id']}`,
`UPDATE World SET randomNumber = ${
rows[0].randomNumber
} WHERE id = ${rows[0]['id']}`,
err => {
if (err) {
throw err;
Expand Down Expand Up @@ -327,6 +327,5 @@ http
res.writeHead(404, { 'Content-Type': 'text/html; charset=UTF-8' });
res.end('NOT IMPLEMENTED');
}
/* eslint-enable no-case-declarations no-inner-declarations */
})
.listen(8080);
52 changes: 23 additions & 29 deletions lib/commands/server_handshake.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,36 +39,30 @@ class ServerHandshake extends Command {
// TODO check we don't have something similar already
connection.clientHelloReply = clientHelloReply;
if (this.args.authCallback) {
try {
this.args.authCallback(
{
user: clientHelloReply.user,
database: clientHelloReply.database,
address: connection.stream.remoteAddress,
authPluginData1: this.serverHello.authPluginData1,
authPluginData2: this.serverHello.authPluginData2,
authToken: clientHelloReply.authToken
},
(err, mysqlError) => {
// if (err)
if (!mysqlError) {
connection.writeOk();
} else {
// TODO create constants / errorToCode
// 1045 = ER_ACCESS_DENIED_ERROR
connection.writeError({
message: mysqlError.message || '',
code: mysqlError.code || 1045
});
connection.close();
}
this.args.authCallback(
{
user: clientHelloReply.user,
database: clientHelloReply.database,
address: connection.stream.remoteAddress,
authPluginData1: this.serverHello.authPluginData1,
authPluginData2: this.serverHello.authPluginData2,
authToken: clientHelloReply.authToken
},
(err, mysqlError) => {
// if (err)
if (!mysqlError) {
connection.writeOk();
} else {
// TODO create constants / errorToCode
// 1045 = ER_ACCESS_DENIED_ERROR
connection.writeError({
message: mysqlError.message || '',
code: mysqlError.code || 1045
});
connection.close();
}
);
} catch (err) {
throw err;
// TODO
// connection.writeError(err)
}
}
);
} else {
connection.writeOk();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Connection extends EventEmitter {
this._command = null;
this._paused = false;
this._paused_packets = new Queue();
this._statements = LRU({
this._statements = new LRU({
max: this.config.maxPreparedStatements,
dispose: function(key, statement) {
statement.close();
Expand Down
8 changes: 3 additions & 5 deletions lib/connection_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ class ConnectionConfig {
} else if (options && options.uri) {
const uriOptions = ConnectionConfig.parseUrl(options.uri);
for (const key in uriOptions) {
if (!uriOptions.hasOwnProperty(key)) continue;
if (!Object.prototype.hasOwnProperty.call(uriOptions, key)) continue;
if (options[key]) continue;
options[key] = uriOptions[key];
}
}
for (const key in options) {
if (!options.hasOwnProperty(key)) continue;
if (!Object.prototype.hasOwnProperty.call(options, key)) continue;
if (validOptions[key] !== 1) {
// REVIEW: Should this be emitted somehow?
// eslint-disable-next-line no-console
Expand Down Expand Up @@ -99,9 +99,7 @@ class ConnectionConfig {
// https://github.com/mysqljs/mysql#user-content-connection-options
// eslint-disable-next-line no-console
console.error(
`Ignoring invalid timezone passed to Connection: ${
options.timezone
}. This is currently a warning, but in future versions of MySQL2, an error will be thrown if you pass an invalid configuration option to a Connection`
`Ignoring invalid timezone passed to Connection: ${options.timezone}. This is currently a warning, but in future versions of MySQL2, an error will be thrown if you pass an invalid configuration option to a Connection`
);
// SqlStrings falls back to UTC on invalid timezone
this.timezone = 'Z';
Expand Down
Loading

0 comments on commit c460c0f

Please sign in to comment.