Page 1 of 1

Post - no records in the table (sometimes)

Posted: Mon 14 May 2012 01:13
by LuizMoura
Hello everybody !!!

I have the same structure.
A loop that runs through a text file and have to write thousands of records in a table.
See this below using post.
======
tr.IsolationLevel := xilREADCOMMITTED;
dm.conexao.StartTransaction(tr);
while not eof(tTxt) do
begin
ReadLn(tTxt,sL);
dm1.cdsSld.Append;
dm1.cdsSldRef.AsString := copy(sL,01,5);
dm1.cdsSldName.AsString := copy(sL,06,30);
dm1.cdsSld.post;
end;
try
dm1.cdsSld.ApplyUpdates(0);
dm.conexao.Commit(tr);
except
dm1.cdsSld.CancelUpdates;
// dm.ConRep.Rollback(tr); The drive that I use the "Devart" when an error occurs
//transaction is closed, impeding the Rollback but this not the problem in focus now
end;
========
This structure above works well in many programs.
But in some, it gives problem, not writing on BD
Write only the last record, which is what happens immediately before the ApplyUpdates(0).
So I have to change the structure, as I show below, only that it is strange and a little slower!
========
tr.IsolationLevel := xilREADCOMMITTED;
dm.conexao.StartTransaction(tr);
while not eof(tTxt) do
begin
ReadLn(tTxt,sL);
dm1.cdsSld.Append;
dm1.cdsSldRef.AsString := copy(sL,01,5);
dm1.cdsSldName.AsString := copy(sL,06,30);
dm1.cdsSld.ApplyUpdates(0); // was->dm1.cdsSld.post;
end;
try
// was->dm1.cdsSld.ApplyUpdates(0);
dm.conexao.Commit(tr);
except
dm1.cdsSld.CancelUpdates;
// dm.ConRep.Rollback(tr);
end;
========
I've tried with the sets:
TSQLQuery or TSQLDataset + TDataSetProvider + TClientDataset,
I changing various settings such, in UpdateMode, providerFlags and other...
Can someone show me how to use only the first structure, that is, how make it always works.
Thaks !!

Re: Post - no records in the table (sometimes)

Posted: Wed 16 May 2012 07:31
by ZEuS
Hello.

Unfortunately, we cannot reproduce your problem.
Please try to handle update errors in the TDataSetProvider.OnUpdateError and TClientDataSet.OnReconcileError event handlers to find out what particular type of error occurs. You can find more information about handling update errors in the "Reconciling Update Errors" article of the Delphi documentation.
Or try to create a small sample that demonstrates the problem, including a script to create the table, and the test text file and send it to us.
Also, please specify the following:
- the exact version of Interbase/Firebird server you are using;
- the exact version of dbExpress Driver for InterBase and Firebird you are using.

Re: Post - no records in the table (sometimes)

Posted: Thu 17 May 2012 15:28
by LuizMoura
Thank you for your interest.
Delphi 2010.
FireBird 2.5.1
Devart dbxida270.exe

With this problem does not occur error,then, there is not error messages.
Silently in some routines, written in a manner identical, only that, in different tables.
The command POST sometimes records all data, sometimes not.
Always when the routine is a loop, which runs along the lines of a text file.
Like This.
while
Read
post
end
When this happens.If I put, .ApplyUpdate(0) in place of .POST, solve the problem

I ask, if exist any configution, in the components.
That I can verify, that may be related to this ?
Thank you very much.

Re: Post - no records in the table (sometimes)

Posted: Fri 18 May 2012 10:16
by ZEuS
dbExpress Driver for InterBase and Firebird doesn't have such properties configuration that would help to solve the problem.
Please check if the problem persists when using InterBase Data Access Components to determine whether the problem is caused by our driver or by dbExpress components. You can download IBDAC Trial Edition here: http://www.devart.com/ibdac/download.html