-
Notifications
You must be signed in to change notification settings - Fork 462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BigInt incorrectly cast to int with msnodesqlv8 #1385
Comments
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 |
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: