I have a problem in the driver DevartInterbase can you help me?
Attached a project demonstrating the problem.
When running ClientDataSet.Refresh within a transaction, the data is not updated in ClientDataSet, the value of the changed field remains the old value. Only when the Commit runs and after a new ClientDataSet.Refresh the changed value is updated in ClientDataSet.
I know the example seems a bit confusing, but my application got it in several places. I'll try to better detail the problem:
Step one: Execute any query (using a SQLDataSet or SQLQuery) and leave the open component within the scope of the procedure:
Code: Select all
1. procedure TForm2.Button4Click(Sender: TObject); 2. begin 3. SQLDataSet2.Close; 4. SQLDataSet2.CommandText := 'select * from tb_teste'; 5. SQLDataSet2.Open; 6. end;
Second step: Within a transaction, run the update and a given, soon after, in the same transaction, run a refresh to reload the component information:
Code: Select all
1. procedure TForm2.Button1Click(Sender: TObject); 2. var 3. Transacao: TDBXTransaction; 4. begin 5. Transacao := SQLConnection_Devart.BeginTransaction 6. 7. ClientDataSet1.Open; 8. ClientDataSet1.Edit; 9. ClientDataSet1_INCREMENTO.AsInteger := ClientDataSet1_INCREMENTO.AsInteger +1; 10. ClientDataSet1.Post; 11. ShowMessage('This is the information AFTER POST: ' + ClientDataSet1_INCREMENTO.AsString); 12. 13. ClientDataSet1.ApplyUpdates(0); 14. ShowMessage('This is the information AFTER APPLY UPDATES: ' + ClientDataSet1_INCREMENTO.AsString); 15. 16. ClientDataSet1.Refresh; 17. ShowMessage('This is the information AFTER REFRESH: ' + ClientDataSet1_INCREMENTO.AsString); 18. 19. SQLConnection_Devart.CommitFreeAndNil(Transacao) 20. ShowMessage('This is the information AFTER COMMIT: ' + ClientDataSet1_INCREMENTO.AsString); 21. 22. ClientDataSet1.ReFresh; 23. ShowMessage('This is the information AFTER NEW REFRESH: ' + ClientDataSet1_INCREMENTO.AsString); 24. end;
Line 5: Start a simple transaction;
Lines 7 to 10: We performed a simple process of changing data, just to simulate the problem;
Line 13: Execute a ApplyUpdates to persist data;
Line 16: Runs a refresh in ClientDataSet, let's imagine that the Update run a trigger on the table and we need the ClientDataSet.Refresh to reload the data were updated by the trigger (this is exactly the situation I have in my application), this is the reason to execute ClientDataSet.Refresh in this point;
Line 19: Commit the changes;
Line 22: A new refresh to check whether the data has been correctly saved.
1 - The problem occurs exactly in line 16, when performing a Refresh it should load the new information, however, he maintains that the information contained above, before starting the transaction;
2 - The problem only occurs when a Query is not closed in its scope;
3 - The problem occurs only in the second iteration, the second attempt (process) involving the transaction;
4 - The problem happens only using Devart Interbase Driver;
5 - The Driver Devart PostgreSQL does not have this defect;
6 - The Firebird Driver (native in Delphi XE4) does not have this defect, characterizing a bug of Driver Devart Interbase.
If you can help me, I thank you.