Subject: | zerofill |
Date: | Sat, 26 Nov 2016 17:08:26 +0100 |
To: | bug-DBD-mysql [...] rt.cpan.org |
From: | Frank Bartels <knarf [...] knarf.de> |
Hi,
I use perl v5.24.1 together with p5-DBD-mysql-4.040.
I have a script that used to work for 10 years or more but now broke
because of the recent changes: "Fix integer types when server side
prepare statements are enabled"
I do something like this:
my $query = $dbh->prepare("SELECT Albums.Id,Tracks.Id,Albums.Artist,Albums.Title,Albums.Cddb,Albums.Genre,Albums.Year,Tracks.Trackname,Tracks.Tracknum,Tracks.Length,Tracks.VBR,Tracks.Bitrate FROM Tracks,Albums WHERE Tracks.Albumref=Albums.Id ORDER BY Tracks.Id");
$query->execute;
while ( ( $AlbumId, $TrackId, $DB{TPE1}, $DB{TALB}, $DB{CDDB}, $DB{TCON},
$DB{TYER}, $DB{TIT2}, $DB{TRCK}, $DB{TLEN}, $DB{VBR}, $DB{BITRATE} ) = $query->fetchrow_array ) {
Albums.Id is "smallint(5) unsigned zerofill" in mysql 5.5.53.
Before 4.040 $AlbumId was "00001". With 4.040 $AlbumId changed to
"1".
I know this is not the best design. :)
I fixed it doing
$AlbumId = sprintf("%05s", $AlbumId);
for now.
Do you plan to bring back the old behaviour?
Thanks,
Knarf
Message body not shown because it is not plain text.