TSdfDataSet bug when quote appears imediatelly after delimiter
Original Reporter info from Mantis: zeljko@holobit.net @zeljan1
-
Reporter name: Zeljan Rikalo
Original Reporter info from Mantis: zeljko@holobit.net @zeljan1
- Reporter name: Zeljan Rikalo
Description:
Attached example shows exact problem. If imported data field contains quote right after delimiter then data is cutted off.
I've found that TSdfDataSet.ExtractDelimited(const S: String; var Pos: integer): string; contains problematic code.
It simply assumes that if var DQ (") is at first position that complete field is enclosed inside quotas.
eg Delimiter = '|'
FIELD1|FIELD2|FIELD3|FIELD4|FIELD5
1 | ok |a"b"c |0 |0 (OK - FIELD3 prints a"b"c)
2 | ok |"abc" |0 |0 (OK - FIELD3 prints abc)
3 | bad |"a"bc |0 |0 (BAD - FIELD3 prints a)
So, our function ExtractDelimited() does not check if last char of field (char left of next delimiter) is quota or not and that's bug.
If it's hard to fix, or it can broke TSdfDataset then we can add property CheckQuotas: boolean , so when it's false it won't check first quota
after delimiter and it'll work ok.
Mantis conversion info:
- Mantis ID: 36190
- Version: 3.0.4