Comments (8)
Wtf u talk m8s kys lel lmao 420
from node-mssql.
Okay, I've found the offending value and it has to do with IEEE 754 rounding errors and how node-tedious
handles decimal values with small precision.
The value was 32.343948
. The parameter type is a decimal(9, 6)
. Tedious writes decimals with precision of <= 9 directly to the TDS stream as a single 32-bit integer, and it does so by multiplying the value by 10^scale
(the scale is 6 in this case). The code looks like this:
value = Math.abs parameter.value * Math.pow(10, parameter.scale)
The resulting value should be 32343948. However, due to floating point rounding errors, you end up with 32343947.999999996, which causes Buffer.writeUInt32LE
to throw an exception.
I believe the short term solution is to just Math.round
the value, and I'll be submitting a PR to tedious to address this.
from node-mssql.
While you have been able to resolve this specific case, the issue here is that an error is actually being thrown, crashing the app, instead of being passed back into the callback to be handled gracefully. For instance, I accidentally was passing an undefined
into an int and getting the same error.
I'll look into doing a pull request for this issue when I have time.
from node-mssql.
Floating point is now corrected by Tedious, as they now do Math.round()
https://github.com/tediousjs/tedious/blob/50e76efdcd87f687106c722d54c6ea4096f0a127/src/data-type.js#L421
from node-mssql.
I still receive this error with decimals...
from node-mssql.
make sure you don't mix up precision and scale.
decimal(precision, scale)
When I switched the two I got the out of bounds error
from node-mssql.
I get this error on Windows and node v12.13.0, but not Linux or Mac. For example while trying to save the data 1000000.4 into DataTypes.DECIMAL(18,2). The error is from the node library file buffer.js which throws an error crashing the app.
from node-mssql.
This is (was) and issue with the tedious driver which is now fixed. Please use the latest version of node-mssql if you wish to resolve this issue. locking this thread as resolved
from node-mssql.
Related Issues (20)
- Committing a transaction early, within a transaction ? HOT 4
- [Question] Does node-mssql support Kerberos authentication HOT 1
- ConnectionError: Connection not yet open. HOT 1
- How to bind a multidimensional array HOT 3
- How to add order by from user input? HOT 1
- (node:1009) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 error listeners added to [ConnectionPool]. Use emitter.setMaxListeners() to increase limit HOT 1
- Bulk Insert Time Out HOT 1
- Bulk upload with a DateTime2 column HOT 3
- error self signed certificate - Lambda function Nodejs connect to mssql on ec2 instance after migrating from 6.2.0 to 10.0.2 HOT 6
- node-mssql only works if TCP/IP for SQL Server is turned on HOT 3
- mssql suddenly stopped working with INSERTS to sql server db from AWS Lambda, with no changes anywhere. Had been working fine for years. HOT 1
- error:0A000102 when linking to database HOT 1
- Update Tedious to 18.2.1 to resolve Azure Identity vulnerabilities HOT 5
- Query execution takes more than 30 seconds using Tedious while same query using Microsoft JDBC Driver for SQL Server on DBeaver takes only 200 ms HOT 3
- mssql@v10 dropped support for Node v14 partially HOT 1
- Enable GitHub Discussions HOT 2
- Does msnodesqlv8 driver support Azure Managed Identity authentication mode HOT 1
- `CREATE DATABASE` Failing When Using the ES6 Tagged Template Literal Approach HOT 1
- Would there be memory leaks if we create a new new sql.ConnectionPool with each query and then call .close() to close all connections in the pool after the query? HOT 1
- FailureException: recvmsg EINVALStack: ConnectionError: recvmsg EINVAL - EINSTLOOKUP fails in Azure ASE v3 environment HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-mssql.