Skip Menu |
 

This queue is for tickets about the DBD-mysql CPAN distribution.

Report information
The Basics
Id: 68374
Status: resolved
Priority: 0/
Queue: DBD-mysql

People
Owner: Nobody in particular
Requestors: BJDEAN [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: (no value)
Fixed in: (no value)



Subject: DBD::mysql::column_info fails on column type "BIT"
Download (untitled) / with headers
text/plain 1.2k
When DBD::mysql::column_info is called on a column of type "BIT" the following exception is thrown: column_info: unrecognized column type 'bit' of `table_name`.column_name (where table_name and column_name In DBD::mysql::column_info there is a chained if/elsif/.../else switch based on $basetype - there is currently (as of the latest version on CPAN) no matching case for 'bit'. I suspect this may have become a problem since MySQL version 5.0.3 - as per the MySQL docs: "As of MySQL 5.0.3, a BIT data type is available for storing bit-field values. (Before 5.0.3, MySQL interprets BIT as TINYINT(1).)" http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html I've not tested this but I'm guessing that prior to this change a column created as type BIT was described by column_info as TINYINT(1), which would have worked. The patch seems quite simple - this seems to work (though I've not tested it extensively): --- mysql.pm.orig 2010-07-18 21:42:56.000000000 +1000 +++ mysql.pm 2011-05-23 00:03:59.000000000 +1000 @@ -511,7 +511,7 @@ } $info->{"mysql_values"} = \@type_params; } - elsif ($basetype =~ /int/) + elsif ($basetype =~ /int/ || $basetype eq 'bit' ) { # big/medium/small/tiny etc + unsigned? $info->{DATA_TYPE} = SQL_INTEGER();
fixed in 4.030_01. Also added t/40bit.t Thank you!


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.