Mysql returning incorrect bigint result by one, very strange error

前端 未结 1 1732
北恋
北恋 2020-12-19 05:29

I really don\'t know what is going on here. I have a database table that looks like this:

\"enter

相关标签:
1条回答
  • 2020-12-19 06:07

    The maximum integer JavaScript can safely represent is Number.MAX_SAFE_INTEGER, which is 2^53 - 1. Your value is greater than that, which is causing some bits to be lost.

    node-mysql has supportBigNumbers and bigNumberStrings options that parse BIGINTs as strings.

    var connection = mysql.createConnection({
                                supportBigNumbers: true,
                                bigNumberStrings: true
                     });
    
    0 讨论(0)
提交回复
热议问题