Subject | Re: [IBO] Where to start debugging. Please help. |
---|---|
Author | Johannes Pretorius |
Post date | 2004-05-26T12:09:24Z |
Good day Helen
\=-=\=-\\-=-\=-\=-\\
and re-open it
to do a refresh of the data. Then this is the only call to delete and then the
Database ApplyUpdates is called. Then again the Query is closed.
What I was wondering is the Close and Open of the query not clear these
buffers ?
Here is the top part of the functions codes until where the error occurs.
Hope it can help
//================== sNiP Start =========================
procedure TfrmMain.replicateASet;
var
tmpLog : TStringList;
tmpT1,tmpT2,totSeconds : Integer;
Hour, Min, Sec, MSec: Word;
hadSomething : Boolean;
accDT : TDateTime;
lastEMessage,lastAcc : String;
begin
try
hadSomething := true;
sbStatus.SimpleText := 'Close repl set query';
DM_SysRepl.qryReplSet.Close;
if conf.useRetries then begin
sbStatus.SimpleText := 'Set filter true';
DM_SysRepl.qryReplSet.Filtered := True;
end;
sbStatus.SimpleText := 'open repl set query';
if DM_SysRepl.dbSysRepl.Connected then begin
DM_SysRepl.dbSysRepl.StartTransaction;
DM_SysRepl.dbSysRepl.Commit;
end;
DM_SysRepl.qryReplSet.Open;
if DM_SysRepl.qryReplSet.IsEmpty then begin
DM_SysRepl.qryReplSet.Close;
Exit;
end;
DM_SysRepl.qryReplSet.First;
sbStatus.SimpleText := 'Is there entries';
if not DM_SysRepl.qryReplSet.IsEmpty then begin
sbStatus.SimpleText := 'Check the account';
if trim(DM_SysRepl.qryReplSet.FieldByName('ACC_CODE').AsString) =
'' then begin
raise Exception.Create('Account is blank');
end;
sbStatus.SimpleText := 'Starting account
:'+DM_SysRepl.qryReplSet.FieldByName('ACC_CODE').AsString+' '+TimeToStr(now);
// tmpT1 :=
(strtoint(FormatDateTime('mm',now))*60)+strtoint(FormatDateTime('ss',now));
decodetime(time,Hour, Min, Sec, MSec);
tmpT1 := (hour*120)+(min*60)+sec;
replicateAccount;
DM_SysRepl.qryReplSet.Delete;
DM_SysRepl.dbSysRepl.ApplyUpdates([DM_SysRepl.qryReplSet]);
//===================== SnIp END ===================================
Thanks for your response.
Johannes Pretroius
----------
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.690 / Virus Database: 451 - Release Date: 22/05/2004
[Non-text portions of this message have been removed]
\=-=\=-\\-=-\=-\=-\\
>//==================================Basicly I need to mention that I do CLOSE the Query beforehand every time
> > DM_SysRepl.qryReplSet.Delete; <<== WHERE SECOND call creates ERROR.
> > DM_SysRepl.dbSysRepl.ApplyUpdates([DM_SysRepl.qryReplSet]);
> >//===================================
>
>You are getting the error because you are targetting a cache buffer row
>that isn't there. ApplyUpdates is a cache method. It doesn't commit
>anything. At best, it posts changes to the server (which will subsequently
>have to be committed using CommitUpdates) and deletes the rows from the
>cache buffer. When you call Delete the second time, you get an AV because
>the cache buffer is empty.
>
>Helen
and re-open it
to do a refresh of the data. Then this is the only call to delete and then the
Database ApplyUpdates is called. Then again the Query is closed.
What I was wondering is the Close and Open of the query not clear these
buffers ?
Here is the top part of the functions codes until where the error occurs.
Hope it can help
//================== sNiP Start =========================
procedure TfrmMain.replicateASet;
var
tmpLog : TStringList;
tmpT1,tmpT2,totSeconds : Integer;
Hour, Min, Sec, MSec: Word;
hadSomething : Boolean;
accDT : TDateTime;
lastEMessage,lastAcc : String;
begin
try
hadSomething := true;
sbStatus.SimpleText := 'Close repl set query';
DM_SysRepl.qryReplSet.Close;
if conf.useRetries then begin
sbStatus.SimpleText := 'Set filter true';
DM_SysRepl.qryReplSet.Filtered := True;
end;
sbStatus.SimpleText := 'open repl set query';
if DM_SysRepl.dbSysRepl.Connected then begin
DM_SysRepl.dbSysRepl.StartTransaction;
DM_SysRepl.dbSysRepl.Commit;
end;
DM_SysRepl.qryReplSet.Open;
if DM_SysRepl.qryReplSet.IsEmpty then begin
DM_SysRepl.qryReplSet.Close;
Exit;
end;
DM_SysRepl.qryReplSet.First;
sbStatus.SimpleText := 'Is there entries';
if not DM_SysRepl.qryReplSet.IsEmpty then begin
sbStatus.SimpleText := 'Check the account';
if trim(DM_SysRepl.qryReplSet.FieldByName('ACC_CODE').AsString) =
'' then begin
raise Exception.Create('Account is blank');
end;
sbStatus.SimpleText := 'Starting account
:'+DM_SysRepl.qryReplSet.FieldByName('ACC_CODE').AsString+' '+TimeToStr(now);
// tmpT1 :=
(strtoint(FormatDateTime('mm',now))*60)+strtoint(FormatDateTime('ss',now));
decodetime(time,Hour, Min, Sec, MSec);
tmpT1 := (hour*120)+(min*60)+sec;
replicateAccount;
DM_SysRepl.qryReplSet.Delete;
DM_SysRepl.dbSysRepl.ApplyUpdates([DM_SysRepl.qryReplSet]);
//===================== SnIp END ===================================
Thanks for your response.
Johannes Pretroius
----------
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.690 / Virus Database: 451 - Release Date: 22/05/2004
[Non-text portions of this message have been removed]