Better handling of empty columns in TDF input #562
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The TDF file format cannot distinguish between string columns that contain null vs the empty string. Both are represented in the file as a zero-length string between tab delimiters.
This change relates only to columns of type Text or Memo.
Previously, when such a column had Required=True and AllowZeroLength=False, we would interpret a zero-length input value to be null, which would cause an exception, since Required means 'cannot be null'.
This commit now assumes that in the above scenario, the zero-length input should be interpreted to mean the empty string, rather than null.
If the field has AllowZeroLength=False, but no value was provided, this is an immediate error.
That just leaves AllowZeroLength=True but Required=False. In this case, and for columns of all types other than Text and Memo, retain the existing behaviour, i.e. do not set the field .Value at all, and allow it to take its .DefaultValue.