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

C-string termination #66

Open
zhkvia opened this issue Nov 13, 2017 · 1 comment
Open

C-string termination #66

zhkvia opened this issue Nov 13, 2017 · 1 comment

Comments

@zhkvia
Copy link

zhkvia commented Nov 13, 2017

I've noticed that sometimes, after SQLGetData call, alloc_buffer becomes dirty in a sense that it's not properly terminated by the \x00 character. Because of that, when you want to decode a string (let's say, it's encoded in utf-8), after truncating it by the \x00 character, you get not only a desired string but also a part of a previous string that was written to the same buffer and a decoding process may fail.

Here's a quick fix for that: PR

UPD:
OSes I use: Linux / macOS
ODBC Driver: unixODBC

@braian87b
Copy link
Collaborator

Excelent, 'sometimes' in which cases? have you find on which cases or it is a random like issue?
Are you still using unixODBC or have you tried the official Microsoft ODCB Driver for Linux / Mac https://github.com/jiangwen365/pypyodbc/wiki/How-to-use-pypyodbc-on-MacOS-OSX

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

No branches or pull requests

2 participants