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

Incorrect handling of display size #261

Closed
traceon opened this issue Feb 19, 2020 · 2 comments · Fixed by #264
Closed

Incorrect handling of display size #261

traceon opened this issue Feb 19, 2020 · 2 comments · Fixed by #264
Labels

Comments

@traceon
Copy link
Collaborator

traceon commented Feb 19, 2020

SQL_DESC_DISPLAY_SIZE Column/Descriptor attribute is used to get the number of symbols needed to display [any] value a particular column will have (in the current result set or in general, depending on context).

For fixed-size data this value is easily calculated/available before knowing all values in the result set.

For variable size types, it can be calculated reliably only after analyzing the entire result set. But not available for general case.

Currently the driver tries to provide a "good enough" display size for variable size types (String type, mainly) by returning the biggest actual value size met so far, during retrieval of the result set. While this is helpful, if the goal is to achieve prettier output in command line utilities like isql, it looks like this doesn't play well with Tableau, which, for reasons unknown (probably a bug), unfairly attaches importance to that property and handles data as if its real size is defined by the reported display size, and not the actual size which is always available together with data.

With the current driver strategy, there could be scenarios where the display size is queried before the driver had a chance to calculate "better" value for a longer data, so that long data will be truncated by Tableau in its further manipulations, resulting in incorrect mappings, etc.

The solution would be (as always) to strictly follow specs from https://docs.microsoft.com/en-us/sql/odbc/reference/appendixes/display-size and report SQL_NO_TOTAL when the display size is not exactly known. A possible bonus would be to adjust that display size for variable size types after the entire result set is fetched. That could be useful in rare cases when application wants to know an accurate display size after it retrieved all the data.

@kfluous
Copy link

kfluous commented Apr 14, 2020

#264 causing another issues.
LOOK HERE #197

@hushiwei1993
Copy link

#264导致另一个问题。
在这里查看#197

确实导致了字符串显示被截取

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants