Subject Re: [IBO] FOR UPDATE ????
Author Helen Borrie
At 09:43 PM 22/02/2005 +0000, you wrote:

>What is the matters if i use a FOR UPDATE sentence in a select Query
>in IBO ???

Don't use it for scrolling datasets. It is for applications that need to
fetch rows into the buffer one at a time. TIB_Cursor uses it "under the
hood" so it won't make any difference whether you use it for your
ib_cursors or not.

>does it matters is i use IIBOQuery datasets?? What is the difference
>if i use a updateable dataset without using this FOR UPDATE sentence??

In reality, there is no such thing as "an updatable dataset". IBO
implements techniques to make output sets *appear* to be updatable. In
summary, this involves identifying the unique key of an output set and
constructing update, insert and delete statements for each output row that
you choose to perform such an operation on, whenever the dataset's
RequestLive property is True (by default, it is False). You can override
IBO's automatic construction by defining your own DML statements in a
dataset's XxxxxSQL properties. When you have joined sets, you MUST do this.

It's a wrong assumption that the FOR UPDATE clause causes datasets to be
"updatable" (if it's there) or "not updatable" (if it's not). It is a
directive with several variants, to instruct the engine about handling
server-side cursors.
-- On its own, it causes one-row-at-a-time buffering of cursor output at
the server.
-- In PSQL it has specific sub-clauses that operate on cursor sets.
-- In Firebird 1.5 FOR UPDATE WITH LOCK implements a form of pessimistic
locking that should be handled with kid gloves, with absolute understanding
of its effects, and NEVER with a scrolling dataset.

IBO uses FOR UPDATE internally for some purposes that are hidden by the
classes. You would be interested in it only if you were writing your own
direct interface to the API. In short, for your IBO applications, just
leave it alone.