sdfDataset enhancements
Original Reporter info from Mantis: taazz
-
Reporter name: John Kozikopoulos
Original Reporter info from Mantis: taazz
- Reporter name: John Kozikopoulos
Description:
I have made a few enhancements in the sdfDataset component,
- enhanced the record parser to correctly recognize quoted value and preserve CRLF when are quoted. see TSDFStringList class.
- Changed the field parser in the StoreToBuf method to
a) recognize quoted fields regardless of their position or number in the string
eg :[ This is "a ""Double Quoted""" field and "everything ""will"" be preserved"] Should produce the result
[ This is a "double Quoted" field and everything "will" be preserved]
b) eliminated a infinite loop that was caused by incorrectly ignoring #13#10 and doing nothing at the start of the method
3) added a few extra properties to help the end user decide how to handle spaces
a) TrimLeadingSpaces
b) TrimrtailingSpaces this one is directly linked with TrimSpaces of FixedLegthDataset
c) AlwaysUnQuote when true it will remove quotes when the parser sees them if false the quotes has to be in the first character in the string for the removal process to take place. In all cases the quotes are recognized correctly and they either get removed or be part of the value presented to the end user.
- I have changed the way the FirstLineAsSchema works now if the file has no schema line and the Schema list is empty then the TfieldDefs list is used to create a schema line in all other cases Schema property takes presents.
I am attaching the sdfData.pp file along with a patch that was created against the FPC 2.6.1 svn repository as it was shared on the daily snapshots on 16/SEP/2012 with file name Lazarus-1.1-38674-fpc-2.6.1-20120916-win32.exe
I hope it is useful to someone else as well.
Mantis conversion info:
- Mantis ID: 22980
- OS: all
- OS Build: all
- Platform: all
- Version: 2.6.1
- Monitored by: » mike.cornflake (Mike Thompson)