Skip to content

Commit 644c078

Browse files
LumenWorks Compatibility Features (#41)
* Add LumenWorks compatibility methods and flags to CsvDataReader Introduces GetCurrentRawData(), CopyCurrentRecordTo(), EndOfStream, MissingFieldFlag, ParseErrorFlag, and GetFieldIndex() to CsvDataReader for LumenWorks CsvReader compatibility. Updates internal logic to set/reset new flags appropriately and adds comprehensive tests for these features. * Improve EndOfStream detection in CsvDataReader Replaces the EndOfStream property logic to rely on a new _readReturnedFalse flag, which is set when Read() returns false, ensuring more accurate end-of-stream detection. Also simplifies header name generation by using string.IsNullOrWhiteSpace.
1 parent 90d22ea commit 644c078

File tree

3 files changed

+612
-9
lines changed

3 files changed

+612
-9
lines changed

project/Dataplat.Dbatools.Csv/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111
- **Empty header name generation** - Empty or whitespace-only CSV headers are now automatically assigned default names (e.g., `Column0`, `Column1`) instead of throwing errors. This matches LumenWorks CsvReader behavior and fixes SQL bulk insert failures when CSV files have missing header names.
1212
- **`DefaultHeaderName` option** - New `CsvReaderOptions.DefaultHeaderName` property allows customizing the prefix for generated header names (default is `"Column"`).
13+
- **`GetCurrentRawData()` method** - Returns the current record as a reconstructed CSV string. Useful for debugging and error reporting. Provides LumenWorks CsvReader compatibility.
14+
- **`CopyCurrentRecordTo()` method** - Efficiently copies all field values from the current record to a string array. Provides LumenWorks CsvReader compatibility.
15+
- **`EndOfStream` property** - Indicates when the CSV stream has been fully consumed. Provides LumenWorks CsvReader compatibility.
16+
- **`MissingFieldFlag` property** - Indicates if the current record had missing fields that were padded with nulls.
17+
- **`ParseErrorFlag` property** - Indicates if the current record had a parse error that was handled by skipping.
18+
- **`GetFieldIndex()` method** - Returns the column index for a header name, or -1 if not found. Unlike `GetOrdinal()`, does not throw for unknown headers.
1319

1420
## [1.1.10] - 2025-12-26
1521

0 commit comments

Comments
 (0)