Lazarus

Free Pascal => Database => Topic started by: egsuh on August 16, 2021, 01:40:11 am

Title: Dataset's saving to CSV format
Post by: egsuh on August 16, 2021, 01:40:11 am
I feel like it is good to have a function like SaveToCSVFile, etc. for DataSets.  Currently I can use TCSVDataSet.CopyFromDataSet, and then TCSVDataSet.SaveToCSV to export to CSV file.

This is done correctly, but as noted already, this causes some problem.

https://forum.lazarus.freepascal.org/index.php?topic=49096.0 (https://forum.lazarus.freepascal.org/index.php?topic=49096.0)

I have read that there is a package named dBExport, which I haven't tried yet.

I think saving datasets directly to CSV would be very good, via another method of TDataSet.SaveToCSV, or adding CSV format to TDataPacketFormat. 
Title: Re: Dataset's saving to CSV format
Post by: wp on August 16, 2021, 10:51:31 am
Not a good idea. Where does it stop? The next user needs export to DBF which would pull all DBF code into the standard TDataset codebase, or another user needs export to SQLite3 which would make TDataset dependent on sqlite3 etc. Just to save you from typing some code?

Yes, you should have a look at the dbExport package. This is the way to go. And you don't even have to type any code (if you're lucky).
TinyPortal © 2005-2018