-
-
Notifications
You must be signed in to change notification settings - Fork 627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BIT type is defined incorrectly #1597
Comments
this is what mysql server returns, I believe if you don't specify charset see https://dev.mysql.com/doc/refman/5.7/en/bit-value-literals.html for more examples Do you have more context why you think the behaviour you see is incorrect? |
Well because as you said |
hm, you are right. There is no switch case for When you do I guess adding following 2 lines should improve the way BIT results are returned: case Types.BIT:
return 'packet.readBuffer(2)[1]'; note that this is potentially a breaking change, but since we are in the process of releasing 3.0.0 might be a good time to add it All reference this in mysqljs/mysql as currently BIT is returned as 1 length Buffer in that driver as well |
actually, |
oh, and based on mysqljs/mysql#2559 (comment) BIT can be actually 1 to 8 bytes wide, so my code is completely incorrect |
So I was looking at trying to fix the implementation of BIT as a Temporary fix till the new RFC system comes in however upon testing and reading, I remember one of the developers saying BIT is treated like TinyInt, and they are not in fact reading the code they have there own type defined in
/lib/constants/types.js
and this is set as Hex0x10
however in creating a test case that console.log's the type in bothbinary_parser
andtext_parser
i found it's providing a type of 253 in a hex that is 0xFD, which is listed as type // aka VARCHAR, VARBINARY,Could this be that BIT has been changed from the C API-defined version and is now just classed as a VARBINARY with a length of 1?
The test I created to make sure it was using BIT, at first I tried to just use the query
SELECT b'1' as val
and that seemed to become a blob, so i made sure to test a BIT Column as you can see below.the Debugging that identified that the Type is incorrect was I added
console.log("text_parser type", type);
on line 21 of text_parser.jsThe text was updated successfully, but these errors were encountered: