Opened 12 years ago

Closed 12 years ago

#4334 closed enhancement (wontfix)

[PATCH] csv: add support for DBF-style column headers

Reported by: etourigny Owned by: etourigny
Priority: normal Milestone: 1.9.0
Component: OGR_SF Version: unspecified
Severity: normal Keywords: csv dbf
Cc: Even Rouault, warmerdam

Description

I have created a patch for the csv driver to support dbf-style column headers, with the syntax used by openoffice/libreoffice.

This has the advantage over the .cvst format that only one file is needed for both description and data, and changes are easier to track in one file.

For example one csv file:

"INTCOL,N,5","REALCOL,F,10,7","INTCOL2,N","REALCOL2,F","STRINGCOL,C"
12, 5.7000000,,,foo

is the same as a csv file

INTCOL,REALCOL,INTCOL2,REALCOL2,STRINGCOL
12, 5.7000000,,,foo

and .csvt file

Integer(5),Real(10.7),Integer,Real,String

For now only Integer, Real and String are supported (Date was troublesome). Added creation option ADD_DBF_TYPES to output header with data types. On import the header is scanned for supported syntax in each column header and DBF header takes precedence over csvt file.

I haven't committed the patch to trunk, as I'm unsure if this needs an RFC. csvt support was implemented without RFC, so perhaps this can also follow the same route?

Attaching a patch with code and also an autotest and test file.

Attachments (2)

csv-dbfheaders.patch (14.7 KB ) - added by etourigny 12 years ago.
testdbf.csv (89 bytes ) - added by etourigny 12 years ago.

Download all attachments as: .zip

Change History (4)

by etourigny, 12 years ago

Attachment: csv-dbfheaders.patch added

by etourigny, 12 years ago

Attachment: testdbf.csv added

comment:1 by Even Rouault, 12 years ago

Cc: warmerdam added

I'm midly convinced by the interest of this "proprietary" extension, and my main concern would be that such an extension of CSV format could cause issues to other applications, that at best will not understand this format and use the "encoded" syntax as the column name, and at worst could misbehave.

CC'ing Frank that svn blame revealed as being the author of the csvt mechanism ;-)

comment:2 by etourigny, 12 years ago

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.