Forum OpenACS Q&A: Re: proc like ns_getcsv for char delimited files?

Collapse
Posted by Torben Brosten on
Hi Andrew,

"shouldn't parsing more or less any flavor of CSV-like text format be awfully easy in Tcl?"

sure. Rhis was more an exercise (for me) of matching the behavior of ns_getcsv.

"Why would you want to use ns_getcsv at all, is it faster and you're worried about performance problems?"

ns_getcsv is default hardcoded in the ecommerce package for uploading products, categories etc.

The csv parser I wrote is not directly applicable to uploading. It is more of a data conversion utility (csv-like to single-character delimiter). It parses csv, tracks the pattern (count and type) of field types parsed per line (warns when the field-type record pattern is different, such as a quoted field where there was no quoted field in previous records), and can provides opportunity for inserting custom procs that covert data.

Hope this answers your question,

Torben