Subject Re: TIB_Cursor.RequestLive forces Explicit Record Lock on FB1.5 (RC1)?
Author rogervellacott
I have had similar problems using TIB_Cursor on FB1.5. No problems
on FB1.0. It seemed to be intermittent, but once it began, very
difficult to get rid of. I was unable to find a rational
explanation, or any feature of this object which differed from other
TIB_Cursor objects. I eventually solved it by replacing with a
TIBOQuery. Worrying though, because I have TIB_Cursors in many
places, and only the one was giving trouble.

Roger Vellacott




--- In IBObjects@yahoogroups.com, "Hugo" <hugosan@r...> wrote:
> I have post this question one month ago, but I get no reply, so I
retry
> because it's critical for me...
>
> (IBO 4.2.Hi)
> I don't know if this is a IBO-related issue, but I expose here to
find out:
>
> I have a simple project with:
> - one TIB_Connection, IB_Connection1
> - one TIB_Cursor, IB_Cursor1, linked to IB_Connection1
> - one TIB_DSQL, IB_DSQL1, linked to IB_Connection1
> - no TIB_Transactions are present
>
> Metadata:
> CREATE TABLE MYTABLE (
> MY_PK CHAR(2) NOT NULL PRIMARY KEY,
> MACHINE SMALLINT);
>
> The only record on table:
> INSERT INTO MYTABLE VALUES('AA', 1);
>
> IB_Cursor1.SQL :
> SELECT MY_PK
> , MACHINE
> FROM MYTABLE
> WHERE MY_PK='AA';
> IB_Cursor1.RequestLive := true (because maybe I'd need delete or
insert
> record)
>
> IB_DSQL1.SQL :
> DELETE
> FROM MYTABLE
> WHERE MACHINE=1;
>
> The sequence I make:
>
> IB_Connection1.Connect;
> IB_Cursor1.Prepare;
> IB_Cursor1.First; /* now it's pointing to the only record 'AA',1 */
> IB_Cursor1.Close;
> IB_DSQL1.Prepare;
> IB_DSQL1.Execute; /* raises an exception 'lock conflict on no wait
> transaction' 'deadlock' 'update conflicts with concurrent update' */
>
> The same sample on Firebird 1.0 doesn't raise the 'deadlock'
exception.
> The same sample on FB 1.5 (RC1) with IB_Cursor1.RequestLive :=
false doesn't
> raise the 'deadlock' exception.
>
> It's to say, it seems like the 'FOR UPDATE' clause on TIB_Cursor
> (RequestLive:=true) includes also the explicit record lock feature
added by
> Nickolay Samofatov to FB1.5 . But this feature, based on posts I
read on
> Firebird-devel list, requires the syntax 'FOR UPDATE WITH LOCK' .
So,
> initially I put my suspicion on IBO parser; after I search full
text on IBO
> sources, I don't find the string 'WITH LOCK' nowhere... Moreover,
this
> feature (explicit record lock) it's not related to FB config file
> (firebird.conf) , and it's not the default behaviour for the engine.
> I know FB1.5 RC1 it's not a official release; but I have this
> "error/trouble"since FB1.5Alpha5 and I've waited until Release
Candidate,
> more definitive.
> I just want to know if I can discard it as an IBO problem, and
expose it to
> firebird-devel list.
>
> Many thanks in advance,
> Hugo.