1

I need to generate an XML file from a table with 500.000 rows and 200 columns using Firedac Query and ClientDataSet to record ClientDataSet.SaveToFile.

ClientDataSet.Close;
Query.Sql.Clear;
Query.Sql.Add ("Select * from something");
ClientDataSet.Open;
ClientDataSet.SaveToFile("destination_folder.xml");

But to save the file with SaveToFile is the insufficient memory error.

How could I save this file? There is a way to write to multiple files the ClientDataSet already loaded?

Best regards.

RRUZ
  • 134,889
  • 20
  • 356
  • 483
  • 1
    standard cds/midas wasn't designed well to handle such amount of records. can't you avoid using cds in your scenario at all? do you really need that datapacket saved in midas xml format? – Vladimir Ulchenko Mar 11 '16 at 06:16
  • I need to write the XML file in the ClientDataSet recording format. – Leonardo Gregianin Mar 11 '16 at 12:24
  • I'm afraid without rewriting its internals you won't be able to overcome its inherent problems. another idea would be to manually produce that file with your own code, you may want to see http://stackoverflow.com/questions/492198/anyone-that-has-a-partial-xsd-that-describes-the-metadata-section-of-delphi-tcli – Vladimir Ulchenko Mar 14 '16 at 14:29
  • Thanks for your comment @vavan. – Leonardo Gregianin Mar 16 '16 at 15:18

0 Answers0