View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003192 | JEDI VCL | 00 JVCL Components | public | 2005-09-12 07:22 | 2005-11-26 04:26 |
Reporter | batonik | Assigned To | obones | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.00 | ||||
Target Version | Fixed in Version | 3.10 | |||
Summary | 0003192: JvCsvData: ProcessCsvHeaderRow(): invalid handling of columns with options ("name:options") | ||||
Description | When opening a CSV file, procedure InternalInitFieldDefs() is called (in InternalOpen()) which sets up "FieldDefs" list. A field name is extracted from the form "<NAME>[:OPTIONS]" and added to "FieldDefs". Then, in ProcessCsvHeaderRow() procedure, options are not stripped from column's name so that a call "FCsvColumns.FindByName(...)" returns nil and an exception is raised. Since "options" in column names are pretty handy (but I found them while reading source files ;) - I've attached a patch :) | ||||
Tags | No tags attached. | ||||
2005-09-12 07:22
|
JvCsvData.patch (880 bytes)
--- JvCsvData.pas 2005-09-12 15:05:14.997239008 +0200 +++ JvCsvData_fixed.pas 2005-09-12 15:05:15.075227152 +0200 @@ -3687,6 +3687,7 @@ PtrCsvColumn: PCsvColumn; CsvFieldName: string; ColNum, I: Integer; + Pos1: Integer; //[2005-09-12] -- TP begin if not ValidateHeaderRow then begin @@ -3707,6 +3708,13 @@ // Get a string in the format COLUMNAME:Options CsvFieldName := StrEatWhiteSpace(GetCsvRowItem(@CsvFieldRec, ColNum)); + //[2005-09-12] by Tomasz Poradowski (tomasz.poradowski@roner.pl) + //BUGFIX: we need to strip options from column names, so that + // FCsvColumns.FindByName() can find the real column + Pos1 := Pos(':', CsvFieldName); + if (Pos1 > 0) then + CsvFieldName := Copy(CsvFieldName, 1, Pos1 - 1); + if CsvFieldName = '' then JvCsvDatabaseError(FTableName, RsEErrorProcessingFirstLine); |
|
I've forgotten to say that this patch is for the latest CVS version of JvCsvData.pas - 1.108. |
|
This is now fixed in CVS. Thanks for the patch, it made my life much easier as the file had evolved a bit in between. |
Date Modified | Username | Field | Change |
---|---|---|---|
2005-09-12 07:22 | batonik | New Issue | |
2005-09-12 07:22 | batonik | File Added: JvCsvData.patch | |
2005-09-12 07:28 | batonik | Note Added: 0007927 | |
2005-11-22 09:32 | obones | Status | new => assigned |
2005-11-22 09:32 | obones | Assigned To | => obones |
2005-11-26 04:26 | obones | Status | assigned => resolved |
2005-11-26 04:26 | obones | Resolution | open => fixed |
2005-11-26 04:26 | obones | Note Added: 0008159 |