Subject | Re: [firebird-support] Re: Cursor FETCH in PSQL and ROW_COUNT/'fetch past last record' error |
---|---|
Author | Martijn Tonies (Upscene Productions) |
Post date | 2017-03-29T06:37:50Z |
Hello Dmitry,
Got this working in the debugger ;)
With regards,
Martijn Tonies
Upscene Productions
http://www.upscene.com
>28.03.2017 10:06, Martijn Tonies wrote:Right, thanks. Just wanted to get things straight here.
>>
>> So the first 'fetch' operation on a position that's invalid returns
>> "rowcount=0",
>> any additional fetch (which includes a move) returns an exception?
>
>Yes. Moving cursor from "last" to EOF is perfectly valid, "no data"
>condition is not an error (as per SQL spec). After that, you may fetch
>prior and get the last record back. Moving cursor from EOF further can
>be theoretically processed in two ways: (1) silent no-op (cursor remains
>its position at EOF) and (2) raise an error. The former is somewhat
>error prone (can lead to infinite loops, for example), perhaps this is
>the reason why the engine raises an error instead. This is the logic
>existing since InterBase for DSQL cursors, and it was applied to PSQL
>cursors for consistency.
Got this working in the debugger ;)
With regards,
Martijn Tonies
Upscene Productions
http://www.upscene.com