Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: rz10 [...] cornell.edu
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in:
  • 3.0002
  • 3.0002_4
  • 3.0002_1
  • 3.0002_2
  • 3.0002_3
  • 3.0002_5
  • 3.0003
  • 3.0003_1
  • 3.0004
  • 3.0004_1
  • 3.0005
  • 3.0005_1
  • 3.0006
  • 3.0006_1
  • 3.0007
  • 3.0007_1
  • 3.0007_2
  • 3.0008
Fixed in: (no value)



Subject: wrong type returned for DECIMAL col w/mysql 5.0.x
See also: <http://bugs.mysql.com/bug.php?id=15556> Description: When connecting to mysql 5, it returns the type of a DECIMAL column as SQL_VARCHAR, as opposed to SQL_DECIMAL returned when the mysql server is version 4.1. The details of my setup: Mac OS X Tiger 10.4.3 perl 5.8.6 DBI 1.47 DBD::mysql 3.0002 (and 3.0002_04) (built with mysql-5.0.16 libraries) mysql 5.0.16 mysql 4.1.15 See also thread at <http://lists.mysql.com/perl/3696>. How to repeat: The script below demonstrates the bug, outputing ... value 12 SQL_VARCHAR ... when connecting to a mysql 5.0.16 server on localhost, vs ... value 3 SQL_DECIMAL ... when connecting to a mysql 4.1.15 server on localhost. #!/usr/bin/perl -w use DBI; ## get DBI type map my %map; foreach (@{ $DBI::EXPORT_TAGS{sql_types} }) { $map{&{"DBI::$_"}} = $_; } my $dbh = DBI->connect('DBI:mysql:test', 'test'); my $table = 'mysql5bug'; my $drop = "DROP TABLE IF EXISTS $table"; my $create = "CREATE TABLE $table (value decimal(5,2));"; my $select = "SELECT * FROM $table WHERE 1 = 0"; ## create table and get column types $dbh->do($drop) or die $dbh->errstr; $dbh->do($create) or die $dbh->errstr; my $sth = $dbh->prepare( $select ); my $rv = $sth->execute; my $fields = $sth->{NAME}; my $types = $sth->{TYPE}; ## print out column types foreach (0..$#$fields) { printf("%8s %3d %s\n", $fields->[$_], $types->[$_], $map{$types->[$_]}); } ## cleanup $dbh->do($drop) or die $dbh->errstr; $sth->finish; $dbh->disconnect; 1;
Still confirmed in 3.0007. I need to add this to the list of things to fix for 3.0008. Patches welcome.
This is fixed in the DBD::mysql source tree, and will be part of the next release (probably 4.01). Thanks for the bug report.