Fixed bug with database result iterator, hasNext returned wrong result

Signed-off-by: Alexander Book <redchrome@gmx.de>