When using the msnodesqlv8 library, values passed into a BigInt column as strings are incorrectly cast using parseInt. This results in an incorrect value.
|
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.
When using the
msnodesqlv8library, values passed into aBigIntcolumn as strings are incorrectly cast usingparseInt. This results in an incorrect value.node-mssql/lib/msnodesqlv8/request.js
Lines 42 to 48 in 8a2fc63
For example:
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.