Writing a TVirtualTable to a CSV file

Discussion of open issues, suggestions and bugs regarding Virtual Data Access Components for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
sde
Posts: 10
Joined: Thu 26 Mar 2015 02:02

Writing a TVirtualTable to a CSV file

Post by sde » Thu 21 Jul 2016 16:03

Hi,

I have an application that creates very large datasets (e.g., 700,000 records). I'm creating and storing the data in a TVirtualTable, but then I need to output this to a CSV file. The way I attempted to do this was go through each record in the table, convert it to a comma separated string and add it to a TStringList so I could use the TStringList.SaveToStream method to efficiently write to a file. The problem I'm running into is that I run out of memory trying to populate the TStringlist. Do you have any suggestions for a better way to go from a TVirtualTable to a CSV?

Thanks!
SDE

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: Writing a TVirtualTable to a CSV file

Post by MaximG » Wed 03 Aug 2016 09:04

The TVirtualTable component allows to save data in XML format compatible with ADO (https://www.devart.com/unidac/docs/?dev ... etoxml.htm) and in its own Virtual Table Data format (*.vtd) using the SaveToFile method. Working with both formats is shown in the Demo, that is distributed with VirtualDAC. Data saving to other formats should be implemented by you on demand.

avelivelo
Posts: 1
Joined: Wed 03 Aug 2016 13:05

Re: Writing a TVirtualTable to a CSV file

Post by avelivelo » Wed 03 Aug 2016 13:10

When the Tvirtualtable saves the data in adoxml using savetoxml, is it possible to easily convert the adoxml to UTF-8 xml format?
Thank you so much!

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: Writing a TVirtualTable to a CSV file

Post by MaximG » Thu 04 Aug 2016 08:46

Unfortunately, TVirtualTable doesn't support saving in XML UTF-8 format .Our components are designed mainly to provide access to data. Therefore data saving is implemented either for internal use (Virtual Table Data format *.vtd) or in ADO XML format.

Post Reply