Platform: Win32, FreeBSD-32/64, probably all
MySQLdb version: 1.2.2
Similar Bug: https://sourceforge.net/tracker/index.php?func=detail&aid=1468725&group_id=22307&atid=374932
All the mysql docs indicate that BIT values are numbers (e.g. http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html & http://dev.mysql.com/doc/refman/5.0/en/bit-field-values.html). In the 'similar bug' above, Andy, you suggest that you will treat bit fields as integers. That is clearly the way to handle them that is consistent with the both the MySQL docs and PEP-249 (BIT not really a DB-API 2.0 BINARY type which is for BLOB, etc.. It seems more like a DB-API 2.0 NUMBER.)
In addition to consistency with the documentation, mysql (server 5.0.17 running on FreeBSD amd64)treats BIT as a number in INSERTs, UPDATEs, ALTER TABLE MODIFY COLUMN, and WHERE clauses. It is rather confusing to have MySQLdb treat the result such that an equivalent comparison in python is undefined. I guess the C-api must have this problem in some respect, because the MYSQL AB clients I use (Query Browser 1.2.3-beta Win32, ,"mysql Ver 14.12 Distrib 5.0.27, for portbld-freebsd6.0 (amd64) using 5.0") have this problem too.
I'll take this one. Looks like BIT really should a numeric type to me. Since it is intended to be used to store an array of up to 64 bits, it stands to reason that once it reaches python-land, it should become a type that has defined bitwise operations (particularly & and |).