Bug #18426 incorrect value returned for int column
Submitted: 22 Mar 2006 16:26 Modified: 14 Jun 2006 12:07
Reporter: Ray Zimmerman Email Updates:
Status: Closed Impact on me:
None 
Category:Connectors: DBD::mysql ( Perl ) Severity:S2 (Serious)
Version:3.0002_5 OS:MacOS (Mac OS X 10.4.5 (Tiger), Linux FC3)
Assigned to: CPU Architecture:Any

[22 Mar 2006 16:26] Ray Zimmerman
Description:
An integer column with -1 stored in it returns 4294967295 instead of -1.

The details of my setup:

	Mac OS X Tiger 10.4.5 (PPC)
	perl 5.8.6
	DBI 1.49
	DBD::mysql 3.0002_5 (vs 3.0002) (built with mysql-4.1.18 libraries)
	mysql 4.1.18

It appears this bug was introduced between 3.0002 and 3.0002_1 and is still present in 3.0002_5. I tested this on Linux and could not reproduce it there, so it appears to be specific to Mac OS X.

How to repeat:
This script below, when run with DBD::mysql 3.0002 outputs ...

value is: -1

... but with DBD::mysql 3.0002_5 (and 3.0002_1) it prints ...

value is: 4294967295

#!/usr/bin/perl -w
use DBI;

my $dbh = DBI->connect('DBI:mysql:test', 'test');
my $table = 'DBDmysql30002_1bug';

$dbh->do("DROP TABLE IF EXISTS $table")     or die $dbh->errstr;
$dbh->do("CREATE TABLE $table (value int)") or die $dbh->errstr;
$dbh->do("INSERT INTO $table VALUES (-1)")  or die $dbh->errstr;
$h = $dbh->selectrow_hashref("SELECT * FROM $table");

print 'value is: ' . $h->{value} . "\n";

## cleanup
$dbh->do("DROP TABLE IF EXISTS $table")     or die $dbh->errstr;
$dbh->disconnect;

1;

Suggested fix:
No clue.
[25 Mar 2006 9:15] Domas Mituzas
Reproduced both on Mac(Intel) and Linux, with 3.0002_5, linked against 5.0-bk and 4.1-bk builds

Note: 3.0002_5 is developer version.
[15 May 2006 19:19] Ray Zimmerman
This bug appears to be fixed in DBD-mysql-3.0003. I was not able to reproduce it on Mac OS X 10.4.6 with either mysql-4.1.19 or 5.0.21. Thank you.
[14 Jun 2006 12:07] Ray Zimmerman
Marking as closed.