-
Notifications
You must be signed in to change notification settings - Fork 439
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 as Parameter works, but does this look right? #490
Comments
Can you please put together a complete script? I can take a look. Thanks. |
You bet. Create a basic table with a BitInt. CREATE DATABASE FunWithBigIntInNode; USE FunWithBigIntInNode; CREATE TABLE dbo.BigIntInNodeTest ( Then, use this script: var Connection = require('tedious').Connection; var connection = new Connection(config); var commandBigInt = new Request('dbo.InsertBigInt', function onRequest() { commandBigInt.addParameter('Id', TYPES.BigInt, '9223372036854775807'); connection.on('connect', function onConnect() { sqlConfig is a JSON key / value pair file, as such: { |
@beautifulcoder Got around to checking this out. This is essentially a JavaScript Numeric range limitation. You lose precision outside the range -(253 - 1) and (253 - 1). Using VarChar for values outside this range is the right behavior. I sent a PR to validate range on BigInt - #504. |
@beautifulcoder This change is now merged. Happy coding :-) |
Hello, when I add a BigInt type as a parameter I get weird behavior.
Say:
commandBigInt.addParameter('Id', TYPES.BigInt, '9223372036854775807');
SQL Server tells me that a -9223372036854775808 was put in this parameter. This seems weird because it is a string type in JavaScript.
But, when I do this instead:
commandBigInt.addParameter('Id', TYPES.VarChar, '9223372036854775806');
It works! But, Tedious requires a VarChar type? I get that it has to be a string in JavaScript, but why in Tedious?
The text was updated successfully, but these errors were encountered: