// not shown: insert new bid into bid table bidders = query("SELECT ... ORDER BY maxBid DESC, bidTime ASC") winner = bidders[0] runnerup = bidders[1] x = winner.maxBid y = (runnerup == null) ? MIN_BID : runnerup.maxBid + BID_INCREMENT return min(x, y)