Skip to content

Commit

Permalink
Merge branch 'master' of github.com:sidorares/node-mysql2
Browse files Browse the repository at this point in the history
  • Loading branch information
sidorares committed Apr 26, 2014
2 parents ebd30fd + 74f0d19 commit 22caf73
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/packets/execute.js
Original file line number Diff line number Diff line change
Expand Up @@ -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])) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
4 changes: 2 additions & 2 deletions test/integration/connection/test-custom-date-parameter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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}]);
});

0 comments on commit 22caf73

Please sign in to comment.