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
sqlite3_column_bytes() should be called after sqlite3_column_blob() #87415
Comments
sqlite3_column_bytes() should be called _after_ sqlite3_column_blob(). There two calls to sqlite3_column_blob() are both preceeded by calls to sqlite3_column_bytes(). Currently it does not do any harm, but it is bad API usage. I suggest to fix the two cases, and add a comment in the source code as a reminder. Berker? Quoting from https://sqlite.org/c3ref/column_blob.html:
In other words, you should call sqlite3_column_text(), sqlite3_column_blob(), or sqlite3_column_text16() first to force the result into the desired format, then invoke sqlite3_column_bytes() or sqlite3_column_bytes16() to find the size of the result. |
Good catch! Sounds good to me but I'd say designing APIs relying on call order is bad too :) |
Yes, it's too easy to mess up things with this part of the SQLite API :) I'll throw up a PR. BTW (small digression): |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: