From 9e1d54caa42e7fdbb7749fd3027698f4265bc08d Mon Sep 17 00:00:00 2001 From: Andrey Sidorov Date: Thu, 24 Apr 2014 11:26:36 +1000 Subject: [PATCH 1/3] 0.11.8 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8f5b08d465..b4ff791d09 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mysql2", - "version": "0.11.7", + "version": "0.11.8", "description": "fast mysql driver. Implements core protocol, prepared statements, ssl and compression in native JS", "main": "index.js", "directories": { From ab28dfca839728dfe40d941091902185d7c19b57 Mon Sep 17 00:00:00 2001 From: Andrey Sidorov Date: Thu, 24 Apr 2014 11:31:51 +1000 Subject: [PATCH 2/3] use getDate instead of getDay. fixes #89 --- lib/packets/execute.js | 2 +- test/integration/connection/test-custom-date-parameter.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/packets/execute.js b/lib/packets/execute.js index f42608cb2a..9dbb1d358f 100644 --- a/lib/packets/execute.js +++ b/lib/packets/execute.js @@ -33,7 +33,7 @@ Execute.prototype.toPacket = function() if (toString.call(this.parameters[i]) == '[object Date]') { var d = this.parameters[i]; // TODO: move to asMysqlDateTime() - this.parameters[i] = [d.getFullYear(), d.getMonth() + 1, d.getDay()].join('-') + + this.parameters[i] = [d.getFullYear(), d.getMonth() + 1, d.getDate()].join('-') + ' ' + [d.getHours(), d.getMinutes(), d.getSeconds()].join(':'); } if (Buffer.isBuffer(this.parameters[i])) { diff --git a/test/integration/connection/test-custom-date-parameter.js b/test/integration/connection/test-custom-date-parameter.js index f417b5a06c..dae6fa7bf8 100644 --- a/test/integration/connection/test-custom-date-parameter.js +++ b/test/integration/connection/test-custom-date-parameter.js @@ -12,7 +12,7 @@ Date = function() { return CustomDate; }(); -connection.execute('SELECT UNIX_TIMESTAMP(?) t', [new Date('1990-01-01 UTC')], function(err, _rows, _fields) { +connection.execute('SELECT UNIX_TIMESTAMP(?) t', [new Date('1990-08-08 UTC')], function(err, _rows, _fields) { if (err) throw err; rows = _rows; console.log(_rows, _fields); @@ -21,5 +21,5 @@ connection.execute('SELECT UNIX_TIMESTAMP(?) t', [new Date('1990-01-01 UTC')], f connection.end(); process.on('exit', function() { - assert.deepEqual(rows, [{t: 631152000}]); + assert.deepEqual(rows, [{t: 650073600}]); }); From 74f0d1940826cdeccecfb48f7ebe4bbf76537575 Mon Sep 17 00:00:00 2001 From: Andrey Sidorov Date: Thu, 24 Apr 2014 11:33:29 +1000 Subject: [PATCH 3/3] bump --- Changelog.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Changelog.md b/Changelog.md index 9b701db272..4845d1e367 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,9 @@ Backlog: - custom typeCast handlers in generated parser #39 HEAD + - bugfix: date as parameter in prepared statement, + day of week was used incorrectly + instead of day of month #89 ab28dfca839728dfe40d941091902185d7c19b57 0.11.8