-
Notifications
You must be signed in to change notification settings - Fork 474
Closed
Description
When using the msnodesqlv8
library, values passed into a BigInt
column as strings are incorrectly cast using parseInt
. This results in an incorrect value.
node-mssql/lib/msnodesqlv8/request.js
Lines 42 to 48 in 8a2fc63
case TYPES.BigInt: | |
case TYPES.SmallInt: | |
if ((typeof value !== 'number') && !(value instanceof Number)) { | |
value = parseInt(value) | |
if (isNaN(value)) { value = null } | |
} | |
break |
For example:
const value = "9223372036854775807";
console.log(value);
// 9223372036854775807
console.log(parseInt(value));
// 9223372036854776000
SQL Server can cast the string to a BIGINT implicitly, so I'm not really sure why a cast is required in the library at all. But no matter what the case, the current logic seems to result in bad data.
Metadata
Metadata
Assignees
Labels
No labels