diff options
Diffstat (limited to 'config-db')
| -rw-r--r-- | config-db/OpenSLX/MetaDB/CSV.pm | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/config-db/OpenSLX/MetaDB/CSV.pm b/config-db/OpenSLX/MetaDB/CSV.pm index 80e9f6d5..4057355e 100644 --- a/config-db/OpenSLX/MetaDB/CSV.pm +++ b/config-db/OpenSLX/MetaDB/CSV.pm @@ -100,7 +100,15 @@ sub generateNextIdForTable if (!$nextID) { # no ID information available, we protect against users having # deleted the ID-file by fetching the highest ID from the DB: - $nextID = 1+$self->_doSelect("SELECT max(id) AS id FROM $table", 'id'); + # + # N.B.: older versions of DBD::CSV (notably the one that comes with + # SUSE-9.3) do not understand the max() function, so we determine + # the maximum ID manually: + my @IDs + = sort { $b <=> $a } + $self->_doSelect("SELECT id FROM $table", 'id'); + my $maxID = $IDs[0]; + $nextID = 1+$maxID; } seek(IDFILE, 0, 0) or confess _tr(q[Can't to seek ID-file <%s> (%s)], $idFile, $!); |
