Interpret 01000 sqlstate as string truncation #138
Merged
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.
See https://app.clubhouse.io/cartoteam/story/116537
We've found a case where when reading a text field containing 178665 chars (a BigQuery Geography in WKT form), the text was being truncated to 8192 characters (MAXIMUM_BUFFER_SIZE, the chunk size in this case) because after the SQLGetData call, which was returning SQL_SUCCESS_WITH_INFO, the SQLState obtained with SQLGetDiagRec was "01000".
The value used by all drivers we've been using for string truncation is "01004", but
MS Docs say drivers can do whatever they wish:
🤦
Note that according to SQLGetData documentation 01000 is a General Warning ("Driver-specific informational message").
In the case found it seems clear that the meaning is string truncation and the full string is read if we interpret it so.
So this will interpret both the usual 01004 and 01000 as string truncation. It seems unlikely that we find a driver which uses 01000 with other meaning here 🤞