node-mysql2 icon indicating copy to clipboard operation
node-mysql2 copied to clipboard

fix the type of ResultSetHeader **insertId** attribute type

Open buuug7 opened this issue 4 years ago • 4 comments

database table ID either number or string

buuug7 avatar Dec 20 '20 16:12 buuug7

Nope. LastInsertId has to be number.

https://dev.mysql.com/doc/internals/en/packet-OK_Packet.html

testn avatar Nov 05 '21 07:11 testn

when bigNumberStrings setting is set to true insertId is returned as string ( when it can't fit js number )

sidorares avatar Nov 05 '21 07:11 sidorares

ah I forgot

testn avatar Nov 05 '21 07:11 testn

I'm not a fan of this polymorphic results but not quite sure how to improve ( and in backwards compatible way )

we can probably retire Long.js and return native BigInt here so the type will be number | BigInt ( still polymorphic )

sidorares avatar Nov 05 '21 08:11 sidorares