On 15-02-2021 16:21, Alex Peshkoff via Firebird-devel wrote:
On 2/14/21 4:01 PM, Mark Rotteveel wrote:

For documentation purposes, I was wondering if this was intended behaviour, both the ability to position beyond the bounds of the result set using ABSOLUTE, and the remembering of the actual position for subsequent fetches. Or if this is just an artifact of implementation, and therefor might change in a future version and should not be relied on.

For me it sooner looks like a bug in implementation :)
Trying to position in non-existent place should better raise error.

Ok, I'll document that it is not behaviour you should rely on.

I'm not sure if positioning out of bounds should raise an error, because that mean things would also break when you position after the last row (which would also happen when using FETCH [NEXT] at the last row), or before the first row (which can be useful in some cases). Unless of course, you consider 0 / -(last + 1) (before first) and (last + 1) (after last) special cases that are allowed.

Currently, an error is only raised when you attempt to read from the cursor variable if it is positioned out of bounds. But positioning outside the bounds, and then repositioning within the bounds is allowed (as long as it takes one fetch to reposition within the bounds). For example, positioning '2' beyond the last items and the using a single FETCH RELATIVE -2 works, but two FETCH RELATIVE -1 does not.

Mark
--
Mark Rotteveel


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to