Subject Re: [IBO] TIBOQuey and TIB_Cursor
Author Helen Borrie
At 09:02 AM 24/05/2004 +0000, you wrote:

>So in short.
>I use some Cursors to look a specific record to get some values.
>Some places in my program, this Cursor doesn't get closed when a
>Commit is being done. But later when I want to use it again, i ALWAYS
>reopen it.
>The same happens with my TIBOQuerys.
>So all in all it OK ?

Sure. In fact, an ib_cursor isn't buffered, so you don't "open and close
it". You just start fetching rows from it, one by one. If the transaction
ends, there are simply no more rows to fetch. When you call First, you
"open" the cursor, in the sense that you request the first row. You can
"open" the cursor by calling Last; in that case, IBO will fetch and
discard all of the rows except the last one.

With the query object, instead of discarding each row as the cursor moves
on, IBO stores each row in buffers, which allows you to "scroll" back and
forth through the fetched rows. If there are rows it has discarded, it
re-fetches them; if it needs rows that haven't been fetched yet, it
fetches those it needs and discards distant ones from the buffer. As long
as the statement stays prepared, IBO knows which rows you want next time
you refresh after a commit. If any new rows were inserted in the
transaction and your KeyLinks are good, IBO also fetches them.