-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#95] MUPIP LOAD on an empty ZWR file incorrectly should report 0 rec…
…ords loaded (instead of MAXSTRLEN/LDBINFMT errors) The main change is to get_load_format() in sr_unix/mupip_cvtgbl.c. It assumed that in case of a non-binary format extract file (MU_FMT_GO or MU_FMT_ZWR), there is always a non-empty 3rd line in the extract file. Although it is not possible for YottaDB (%GO or MUPIP EXTRACT) to create an empty extract file, it is possible for the user to delete entries in a ZWR or GO format extract file (which is an ascii file) effectively creating a file with just the first 2 lines (header). In that case, MUPIP LOAD currently issue a MAXSTRLEN error (in get_load_format()). This is get_load_format() assumes that a negative return from go_get() implies a string that is too long to fit in the passed in buffer. But there are 2 negative return values possible from that function, FILE_INPUT_GET_LINE2LONG and FILE_INPUT_GET_ERROR. A MAXSTRLEN error in the former case is correct but not in the latter case which effectively implies an EOF. Therefore this case is handled separately now by not issuing an error but instead returning as is to the caller function mupip_cvtgbl(). At this point, we are guaranteed *line3_len is set to 0 indicating there is no 3rd line seen. In mupip_cvtgbl(), line3_len is examined to see if it is 0 and if so it now knows the extract file only has 2 lines and so sets "end" to 2 (corresponding to the 2 lines of the extract file header) before calling go_load() which then knows not to read the extract file any more (i.e. no records to load). While at this, minor changes were done to go_load() so the last processed record in the LOADRECCNT message is displayed as 2 (and not 3) in this empty-extract-file case. A value of 3 implies there was 1 non-header line which is not correct for an empty extract file.
- Loading branch information
Showing
2 changed files
with
126 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters