I have this number 76561197993482001 (64bit int) stored as a bigint(20) in my database.
But when I try to fetch it using :
//node.js
query('SELECT * FROM table',function(err,rows){
console.log(rows[0]["id"]);// I get 76561197993482000
});
I get the wrong number. I guess this is because js can't handle 64bit variables.
I know there are libraries for bigint in js but This number is directly stored in the rows variable. So How can I do?
Is there a way to convert it as a text when I send the request?
Depending on what middleware you're using, most of them have a setting that enables support for big numbers, the most common middleware uses the supportBigNumbers option for this
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'example.org',
user : 'bob',
password : 'secret',
supportBigNumbers : true
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With