Subject Re: FOR UPDATE
Author Rhett Rodewald
Wouldn't this be the most efficent way of doing a code-only (no User
Interface) update?

i.e. Read through results of a query, and programatically check/fix values.

The only alternative that I see is a seperate "searched" update statement --
I would think it would be faster to use an existing cursor so Firebird
doesn't have to find the record all over again.

Does IBO handle this automatically? (i.e. can I add "FOR UPDATE" to my SQL
and then just use My_IB_Cursor.Edit / Post???) Or will it just send a
normal ("searched") update statement. Any comments on most efficient
methods welcome.

Thanks.

--Rhett


> Date: Tue, 10 Jun 2003 18:02:53 -0700
> From: "Jason Wharton" <jwharton@...>
> Subject: Re: FOR UPDATE
>
>> I have seen this statement at the end of some sql property of
>> TIB_query. what is that for?
>
> It tells the server to send records to the client one at a time instead
> of
> batching them together for greater efficiency. Reason it does this is so
> that the cursor can keep the record pointer (which is unidirectional) on
> the
> record just sent to the client and then, because in Firebird/InterBase
> cursors are named, it is then possible to execute an UPDATE statement
> with a
> where clause of WHERE CURRENT OF <cursorname> instead of what I call a
> searched edit which would use data values.
>
> I discourage the use of this with a buffered dataset such as TIB_Query.
> You
> may want to use it with the TIB_Cursor component but again I think it
> will
> still be somewhat inefficient.
>
> HTH,
> Jason Wharton