Record is locked by another user

Kragg

Member²
Hi,

I upgraded DOA from 3.4.6.4 to 4.0.1 (Delphi6 + Oracle 8.1.7.4) and i get this error on a simple query edit.
To get past this problem, i had to reinstall DOA 3.4.6.4. I have the log from Oracle Monitor for both 3.4.6.4 and 4.0.1 version of the dataset if you need.

Julien
 
Marco,
may be this is the same problem as i described? Seeting refresh-option roBeforeEdit to true solved this problem.

Is LockImmediate also on true?

I suppose there is a problem with LockImmediate.

Greetings
Sven
 
Hmm, there is a problem in 4.0.1 with the record refresh functionality when using binary BLOB fields. Is this the case here?
 
No, this problem is solved. (at least on my system)

If i have Lockimmediate and roRefreshBeforeEdit=false i also get an "Record has been changed" error.

(and cachedUpdate=true)

Setting roRefreshBeforeEdit=true and the error is gone

Greetings
Sven
 
Here's the table structure

create table SVC_TSK
(
SVC_TSK_ID NUMBER(38) not null,
NME VARCHAR2(50),
TYP NUMBER(38) not null,
DELAY NUMBER(38) not null,
DET VARCHAR2(4000),
EXE_TIME DATE,
SCHEDULED NUMBER(1) default 0 not null,
PER NUMBER(1) not null,
RECURRENT NUMBER(1) default 0 not null,
LOG BLOB,
SPEC_TSK_NFO BLOB,
COMPLETED NUMBER(1) default 0 not null,
TIME_START DATE,
TIME_END DATE
)
I got the problem when I edit an existing field.

I took log with Oracle Monitor with both 3.4.6.1 and 4.0.1.0 components and I can send them if needed. Meanwhile, here's the code that fails ("Edit;" is the instruction that fails).

with odsTask do
begin
SetVariable('p_svc_tsk_id', aCrTask.ID);
try
Open;
if Eof then
Insert
else
Edit;
FieldByName('svc_tsk_id').AsInteger := aCrTask.ID;
FieldByName('nme').AsString := aCrTask.Name;
FieldByName('typ').AsInteger := Integer(aCrTask.Typ);
FieldByName('delay').AsInteger := aCrTask.Scheme.Delay;
FieldByName('det').AsString := aCrTask.Scheme.Detail.CommaText;
FieldByName('exe_time').AsDateTime := aCrTask.Scheme.ExecTime;
FieldByName('scheduled').AsInteger := Bool2Int(aCrTask.Scheduled);
FieldByName('per').AsInteger := Integer(aCrTask.Scheme.Period);
FieldByName('recurrent').AsInteger := Bool2Int(aCrTask.Scheme.Recurrent);

int := 0;
if aCrTask.State in [tsCompleted] then
int := 1;
if (aCrTask.State in [tsCompleted]) and aCrTask.WithErrors then
int := 2;
FieldByName('completed').AsInteger := int;

FieldByName('time_start').AsDateTime := aCrTask.TimeStart;
FieldByName('time_end').AsDateTime := aCrTask.TimeEnd;

Stream := TMemoryStream.Create;
try
Stream.Write(aCrTask.Log.Count, SizeOf(aCrTask.Log.Count));
for i := 0 to aCrTask.Log.Count - 1 do
begin
Stream.Write(TLogLine(aCrTask.Log).Time, SizeOf(TLogLine(aCrTask.Log).Time));
WriteStringToStream(Stream, TLogLine(aCrTask.Log).Msg);
end;
Stream.Position := 0;
TBlobField(FieldByName('log')).LoadFromStream(Stream);
finally
Stream.Free;
end;

Stream := TMemoryStream.Create;
try
aCrTask.GetSpecificProperties(Stream);
Stream.Position := 0;
TBlobField(FieldByName('spec_tsk_nfo')).LoadFromStream(Stream);
finally
Stream.Free;
end;
Post;
finally
Close;
end;
end;
 
I'll try to make a small project with it.
This code is not executed in the main thread, maybe that's part of the problem ?
 
We were able to reproduce and fix this based on a demo project from another user. We'll provide a fix shortly.
 
Back
Top