You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think this should be returned as a number. Might be good to coordinate both changes here in mysql2, this is potentially a breaking backwards incompatible change
The text was updated successfully, but these errors were encountered:
Good idea. Need to make sure we don't run in to Javascript number issues. The BIT field is up to 64 bits wide and of course a plain javascript number can only be 53 bits wide. Perhaps it would just always return a BigInt?
Oh, for some reason I assumed it's always just one byte. Not so sure about this change now, really depends on what's the most common use case in real life. If it's actually used as a "bit field" a Buffer might be a good container for it
Gotcha. Yes, I don't personally use the field, so not sure all the uses folks have for it. The field itself comes back as a length-encoded string field over the text protocol and the BIT type in the database can be between 1 and 64 bits. The string contents is just the binary data of the bits, not really much different from like a BINARY field, just that the length is defined in bits instead of bytes. I guess there is probably some kind of storage optimization possible for this but 🤷
see similar discussion in sidorares/node-mysql2#1597
Currently BIT fields are always returned as single byte Buffer:
mysql/lib/protocol/packets/RowDataPacket.js
Line 107 in dc9c152
I think this should be returned as a number. Might be good to coordinate both changes here in mysql2, this is potentially a breaking backwards incompatible change
The text was updated successfully, but these errors were encountered: