This fixes the behaviour that Felipe Schnack noticed.
The logic goes, if the statement name is null (which happens when you do
not use cursors or server prepared statements), then we have already
fetched all the rows, and there are no more.
Cheers,
Kim