Bug #18426: incorrect value returned for int column

Ray Zimmerman <[email protected]>
Newsgroups gmane.comp.db.mysql.perl
Message-ID <[email protected]>
See <http://bugs.mysql.com/bug.php?id=18426> and <http://rt.cpan.org/ 
Ticket/Display.html?id=18295>.

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;


-- 
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe:    http://lists.mysql.com/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.