Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better handling of empty columns in TDF input #562

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

HughWarrington
Copy link
Contributor

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant