Skip to content

Commit

Permalink
Merge pull request #446 from marioestradarosa/bool-type-fix
Browse files Browse the repository at this point in the history
Fix boolean type (#325)
  • Loading branch information
dhmlau authored May 29, 2021
2 parents c5e72db + f821541 commit f80ffe8
Show file tree
Hide file tree
Showing 3 changed files with 6,001 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/mysql.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,10 @@ MySQL.prototype.fromColumnValue = function(prop, val) {
}
break;
case 'Boolean':
val = Boolean(val);
// BIT(1) case: <Buffer 01> for true and <Buffer 00> for false
// CHAR(1) case: '1' for true and '0' for false
// TINYINT(1) case: 1 for true and 0 for false
val = Buffer.isBuffer(val) && val.length === 1 ? Boolean(val[0]) : Boolean(parseInt(val));
break;
case 'GeoPoint':
case 'Point':
Expand Down
Loading

0 comments on commit f80ffe8

Please sign in to comment.