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

Fix encoding of zero-length values for large varlen columns #315

Merged
merged 1 commit into from
Apr 23, 2024

Conversation

descawed
Copy link
Contributor

When encoding a value for a large varlen column (e.g. varchar(max), nvarchar(max), varbinary(max)), tiberius writes the value in a single chunk, then writes a zero length chunk to signal the end of the column data. However, if the value being encoded has length zero, the first chunk already ends the column data, and the server will incorrectly interpret the extra zero as part of the next column's data (or whatever follows this column in the buffer). This PR skips the terminating zero if the value has length zero.

@aersam aersam mentioned this pull request Nov 21, 2023
@andre-volvo
Copy link

Oh my god this fixed my issues, thanks a LOT! 🥰

@Weakky
Copy link
Contributor

Weakky commented Apr 23, 2024

Hey @descawed,

Apologies for the long delay in getting this PR reviewed. We're merging this now, thank you for the contribution 🙏

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 this pull request may close these issues.

4 participants