I need to set modified all the records loaded in a TClientDataSet to force saving. How can i do that? Delphi XE8
Asked
Active
Viewed 409 times
1
-
Add a new boolean field. – Jerry Dodge Jul 15 '15 at 18:51
-
Interesting q, +1. It'll be interesting to see if anyone comes up with a method of doing this, short of deliberately changing some field value in each of the dataset's rows, which I imagine you don't want to do, otherwise why ask?. I wouldn't be surprised if sneakier methods trip up over the internal housekeeping that's done of CDS modifications. – MartynA Jul 15 '15 at 19:47
-
1What do you really want to achieve? Saving unchanged data seems not the actual purpose here. – Uwe Raabe Jul 15 '15 at 20:22
-
I made the question short: i need to completely copy a table from MS SQL to SQLite: i load the MSSQL table in a CDS, assign CDS.DATA to a second CDS connected to the SQLite DB, but ... i can't save! I can't add fields, I can't modify values ... a loop insert, set values, post will be very SLOW ... – Giorgio Forti Jul 16 '15 at 06:39
-
1can't you avoid cds involved processing/copying at all? tdatasetprovider will process the entire delta packet on a row by row basis and issue separate insert for every other record anyway – Vladimir Ulchenko Jul 16 '15 at 08:21
-
vavan, i'm searchig "a solution", of course i can avoid CDS, please explain the use of TDataSetProvider! – Giorgio Forti Jul 16 '15 at 19:40
-
This question is totally unclear. – user763539 Jul 16 '15 at 20:54
1 Answers
0
Your actual problem seems to be "How do I efficiently transfer data from a table on MS SQL to SQLite? And secondly, can I use Delphi's TClientDataset to do this efficiently without too much fuss and bother?"
My inclination would be to say that TClientDataset isn't really going to buy you anything here, and won't be any quicker than directly doing inserts, so you might as well go that route, e.g. write a bit of code to generate some inserts for the data you want to export.
For larger quantities of data you may want some kind of bulk-load. SQLite can import CSV files: Import CSV to SQLite so in the same vein as before: Write a bit of code to dump your SQL data to CSV (or export directly from SQL server.
-
At this moment i solved loading from MSSQL in a query, looping this query and using a insert query for every record. – Giorgio Forti Jul 17 '15 at 06:45