Search the Community
Showing results for tags 'tclientdataset'.
Found 2 results
-
I new using TClientDataSet and would like some help. My application fetch heavy stream data from an external web-socket like API (from multiple channels), proccess it asap in worker threads and then show to the user when requested... nowdays I do it manually with lists, arrays and iterate to populate the components (manually). I want to improve and standartize the data in the application memory, the approach I thought is to go with TClientDataSet. The problem is that the application works with a heavy multithread system (which works pretty well, its not the problem), and I know that the TClientDataSet is not thread-safe, and could have alot of problems to deal with, so I would like to ask who already faced this problem before, if I on the right way. My approach: • The worker threads (which will receive the data to proccess) will write in a own TClientDataSet, only the worker thread may write data in its dataset; • Operations (insert/update/delete) in worker thread TClientDataSet wouldn't be synchronized; • Operations and cloning will be protected by a sync object (TCriticalSection like); • The UI that must shown data may clone the worker thread TClientDataSet to have a read-only copy, which can be linked in VCL controls (like TDBGrid) and also iterated, filtered, etc. Anyone that experienced this scenario (or similar) can say if I on the right way to avoid thread synchronization and deadlock problems dealing with TClientDataSet in a multi-thread system?
- 5 replies
-
- delphi
- tclientdataset
-
(and 1 more)
Tagged with:
-
TClientDataSet's odd behavior with hyphens in string fields
Navid Madani posted a topic in Databases
In the DUnitX tests below, the first 4 cases fail: the last character is omitted. It seems that for each hyphen added after the first, an extra character from the end is not written to the TClientDataSet field. Is this normal behavior? Thanks in advance. unit uCDSTest; interface uses DUnitX.TestFramework , Data.DB , Datasnap.DBClient ; type [TestFixture] TClientDataSetTest = class private fCDS: TClientDataSet; public [Setup] procedure Setup; [TearDown] procedure TearDown; [Test] [TestCase('Test0','S0002-9270(99)00035-0')] [TestCase('Test1','S0002-9270(99)00035-1')] [TestCase('Test2','S0002-9270(99)00035-2')] [TestCase('Test3','S0002-9270(99)00035-3')] [TestCase('Test4','S0002-9270(99)000353')] [TestCase('Test5','S00029270(99)00035-3')] [TestCase('Test6','S00-02-9270(99)00035-3')] [TestCase('Test7','S00-02-92-70(99)00035-3')] procedure TestCDS(const AValue : string); end; implementation const cFieldname = 'AFieldName'; procedure TClientDataSetTest.Setup; var fd: TFieldDef; begin fCDS := TClientDataSet.Create(nil); fd := fCDS.FieldDefs.AddFieldDef; fd.Name := cFieldname; fd.DataType := ftString; fCDS.CreateDataSet; end; procedure TClientDataSetTest.TearDown; begin fCDS.Free; end; procedure TClientDataSetTest.TestCDS(const AValue : string); begin fCDS.Insert; fCDS.Edit; fCDS.FieldByName(cFieldname).AsString := AValue; fCDS.Post; Assert.AreEqual(AValue, fCDS.FieldByName(cFieldname).AsString, 'Assignment failed.'); end; initialization TDUnitX.RegisterTestFixture(TClientDataSetTest); end.