fixing a bug in the way that max is generated when finding the next

borrowernumber. Now, using mysql 4.1 we can convert to an integer
to get an accurate next value.
This commit is contained in:
kados 2006-04-03 23:43:20 +00:00
parent 50a375cdd9
commit 056dfd10db
1 changed files with 4 additions and 1 deletions

View File

@ -259,7 +259,10 @@ sub fixup_cardnumber ($) {
$cardnumber="V$cardnumber$rem";
} else {
my $sth=$dbh->prepare("select max(borrowers.cardnumber) from borrowers");
# MODIFIED BY JF: mysql4.1 allows casting as an integer, which is probably
# better. I'll leave the original in in case it needs to be changed for you
my $sth=$dbh->prepare("select max(cast(cardnumber as signed)) from borrowers");
#my $sth=$dbh->prepare("select max(borrowers.cardnumber) from borrowers");
$sth->execute;
my ($result)=$sth->fetchrow;