denisenkom / pytds

Python DBAPI driver for MSSQL using pure Python TDS (Tabular Data Stream) protocol implementation
MIT License
192 stars 53 forks source link

Fix bug when a result set has more than one row of [n]varchar(max) values #96

Closed LHCGreg closed 6 years ago

LHCGreg commented 6 years ago

If the value in the first row is 'foo', and the value in the second is 'bar', and the third is 'baz', the results returned would be 'foo', 'foobar', and 'foobarbaz'. That is, each row's value gets concatenated to the previous rows.

I'm not familiar enough with the codebase to know if this is a good way to fix it or if truncating the stream in _DefaultChunkedHandler when getting the end value might have any unexpected effects.

https://github.com/denisenkom/pytds/pull/95 must be merged first in order for tests to pass.

Fixes #91

LHCGreg commented 6 years ago

As expected, appveyor tests failed because #95 (Fix bulk inserting [n]varchar(max) values) had not been merged yet at the time the tests ran.

codecov[bot] commented 6 years ago

Codecov Report

Merging #96 into master will increase coverage by <.01%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #96      +/-   ##
==========================================
+ Coverage   94.02%   94.02%   +<.01%     
==========================================
  Files          26       26              
  Lines        7818     7821       +3     
==========================================
+ Hits         7351     7354       +3     
  Misses        467      467
Impacted Files Coverage Δ
tests/connected_test.py 98.55% <100%> (ø) :arrow_up:
src/pytds/tds_types.py 92.98% <100%> (+0.01%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e11fffd...4144483. Read the comment docs.

LHCGreg commented 6 years ago

Rebased on new master after some other fixes were merged, tests pass now.

denisenkom commented 6 years ago

wow, how come nobody noticed this before, thanks!