You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the msnodesqlv8 library, values passed into a BigInt column as strings are incorrectly cast using parseInt. This results in an incorrect value.
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.
The text was updated successfully, but these errors were encountered:
I've opened a PR at #1387 to try to fix the problem, but it seems that msnodesqlv8's implementation doesn't support returning bigint values as strings (TimelordUK/node-sqlserver-v8#106) and so the precision is lost unless you explicitly cast the value as a varchar. Until that is fixed in msnodesqlv8, it won't be possible to pull bigint values out without precision loss.
I have tested that my fix does allow the input to the database to retain precision, though.
I'm going to close this as a bug in the upstream driver. I have a PR open to assert the support for numbers as strings but it looks like this is handled differently by both drivers and using strings consistently for BigInt won't work (as it stands). I'll try to find some time to open a PR against tedious to allow the use of strings for BigInt and it looks like the fix is in progress on msnodesqlv8.
When using the
msnodesqlv8
library, values passed into aBigInt
column 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.
The text was updated successfully, but these errors were encountered: