Skip to content

Conversation

@bpintea
Copy link
Collaborator

@bpintea bpintea commented Mar 27, 2020

This fixes the result rewriting of the SQLColumns due to varchar limit
setting in case the SQL_ATTR_MAX_LENGTH attribute is set. The attribute
changes the length indicator given by SQLGetData to the value of the
attribute (which a setting application expects).
Since the rewriting is serialized on the statement, simply reset this
attribute's value while doing the writing.

The types of the columns in the rewritten result are also corrected
(they were copied from ES/SQL output, which are wrong and need fixing).

This fixes the result rewriting of the SQLColumns due to varchar limit
setting in case the SQL_ATTR_MAX_LENGTH attribute is set. The attribute
changes the lenght indicator given by SQLGetData to the value of the
attribute (which a setting application expects).
Since the rewriting is serialized on the statment, simply reset this
attribute's value while doing the writing.

The types of the columns in the rewritten result are also corrected
(they were copied from ES/SQL output, which are wrong and need fixing).
wstr_st *lim = &HDRH(stmt)->dbc->varchar_limit_str;

/* save and reset SQL_ATTR_MAX_LENGTH attribute, it'll interfere with
* reading lenght of avail data with SQLGetData() otherwise. */

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: lenght -> length

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have to install a precommit check for this one. Thanks, fixed them all.

s/lenght/legth/
Copy link

@droberts195 droberts195 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bpintea bpintea merged commit c6556af into elastic:master Mar 27, 2020
@bpintea bpintea deleted the fix/varchar_lim_with_max_length branch March 27, 2020 18:33
bpintea added a commit that referenced this pull request Mar 30, 2020
* Fix varchar limitation when max-len-attr is set

This fixes the result rewriting of the SQLColumns due to varchar limit
setting in case the SQL_ATTR_MAX_LENGTH attribute is set. The attribute
changes the lenght indicator given by SQLGetData to the value of the
attribute (which a setting application expects).
Since the rewriting is serialized on the statment, simply reset this
attribute's value while doing the writing.

The types of the columns in the rewritten result are also corrected
(they were copied from ES/SQL output, which are wrong and need fixing).

(cherry picked from commit c6556af)
bpintea added a commit that referenced this pull request Mar 30, 2020
* Fix varchar limitation when max-len-attr is set

This fixes the result rewriting of the SQLColumns due to varchar limit
setting in case the SQL_ATTR_MAX_LENGTH attribute is set. The attribute
changes the lenght indicator given by SQLGetData to the value of the
attribute (which a setting application expects).
Since the rewriting is serialized on the statment, simply reset this
attribute's value while doing the writing.

The types of the columns in the rewritten result are also corrected
(they were copied from ES/SQL output, which are wrong and need fixing).

(cherry picked from commit c6556af)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants