Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/441.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 插入的BIGINT与SQL数据库中显示的BIGINT不同_Javascript_Mysql_Discord.js - Fatal编程技术网

Javascript 插入的BIGINT与SQL数据库中显示的BIGINT不同

Javascript 插入的BIGINT与SQL数据库中显示的BIGINT不同,javascript,mysql,discord.js,Javascript,Mysql,Discord.js,我正在写一个不和谐机器人和抽搐机器人。 我目前正在编写一个函数,将用户的Twitch和Discord ID保存在数据库中 这是我目前的职能: add_discord(twitch_id, discord_id) { this.get_user(twitch_id) .then((user_data) => { this.db.query(`UPDATE userdata SET discord_id = ${discord_id} WHERE

我正在写一个不和谐机器人和抽搐机器人。 我目前正在编写一个函数,将用户的Twitch和Discord ID保存在数据库中

这是我目前的职能:

add_discord(twitch_id, discord_id) {
    this.get_user(twitch_id)
        .then((user_data) => {
            this.db.query(`UPDATE userdata SET discord_id = ${discord_id} WHERE identity_id = ${user_data[0]}`)
        })
}
我正在为每个用户使用唯一的
标识。
我在控制台上记录了
discord\u id
,它是我正确的discord id。但一旦它被放入数据库,数字就会改变

我的discord ID是522855210926735422

但数据库中显示的数字是522855210926735400

(22偏离正确值)

我正在使用BIGINT的
discord\u id
。我以前也遇到过类似的问题,我以前(我想)只是通过将其存储为VARCHAR而不是BIGINT来修复它

任何建议都很好

(这是来自查询的响应)


结果是,
discord_id
对于JavaScript来说太大了。因此JS将最后一位舍入到数字(因此以00结尾)。因此,我想我会在数据库中将discord_id设置为一个字符串

很遗憾,我没有答案,但是有没有一种方法可以在执行时打印数据库查询?所以也许在ORM或者你正在使用的任何东西中;可能在node_模块中Discord ID值太大,无法在JavaScript中作为数字处理。我一直在将输入的值与数据库中的值进行比较,我看不到任何相关性Pointy,JavaScript可以处理的最大值是多少?
OkPacket {
  fieldCount: 0,
  affectedRows: 1,
  insertId: 0,
  serverStatus: 2,
  warningCount: 0,
  message: '(Rows matched: 1  Changed: 0  Warnings: 0',
  protocol41: true,
  changedRows: 0
}