fixed max id generation for empty tables

This commit is contained in:
hns 2001-03-08 17:12:39 +00:00
parent 7b30a1cd99
commit ebba995765

View file

@ -472,6 +472,9 @@ public final class NodeManager {
String q = "SELECT MAX("+map.getIDField()+") FROM "+map.getTableName();
qds = new QueryDataSet (con, q);
qds.fetchRecords ();
// check for empty table
if (qds.size () == 0)
return "0";
long currMax = qds.getRecord (0).getValue (1).asLong ();
currMax = Math.max (currMax+1, map.lastID+1);
map.lastID = currMax;