Bug#15583: BIN()/OCT()/CONV() do not work with BIT values
Converting BIT to a string (an intermediate step in conversion) does not yield an ASCII numeric string, so we skip that step for BIT and get the integer value directly from the item. This site in sql/item_strfunc.cc may be ripe for refactoring for other types as well, where converting to a string is a waste of time. mysql-test/r/type_bit.result: Test that conversion functions on BIT types work properly, including NULL. mysql-test/t/type_bit.test: Test that conversion functions on BIT types work properly. sql/item_strfunc.cc: BIT is unlike the other numeric types, in that when we convert it to a String, it becomes a one-byte string with ordinal numeric value of the BIT field, not a several-byte string with the ASCII decimal representation. As a special case for conversion functions, we take the integer directly from the bit type instead of representing it as a string in an intermediate step.
Showing
Please register or sign in to comment