Signed SQL_BIGINT - #164
Merged
Merged
Conversation
Signed-off-by: Mark Irish <mirish@ibm.com>
kadler
approved these changes
Mar 5, 2021
kadler
left a comment
Member
There was a problem hiding this comment.
Looks reasonable enough to me. I think most databases use signed types. I did a survey of some common databases and here's what I found for unsigned types:
MS SQL Server:
- tinyint
- tyinint identity
MariaDB:
- tinyint unsigned
- smallint unsigned
- mediumint unsigned
- integer unsigned
- bigint unsigned
PostgreSQL and Db2 have no unsigned types.
We could definitely look it up to be sure, but instead of going to SQLGetTypeInfo, SQLColattribute(SQL_DESC_UNSIGNED) should give you the same info much more easily.
Contributor
Author
|
Great call on |
markirish
pushed a commit
that referenced
this pull request
May 14, 2021
Change default SQL_BIGINT bind type from SQL_C_SBIGINT to SQL_C_UBIGINT Signed-off-by: Mark Irish <mirish@ibm.com>
This was referenced Jul 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue: #127
Current behavior is for SQL_BIGINT to bind to SQL_C_UBIGINT, which means that any negative big int will cause an error. Switch to binding to SQL_C_SBIGINT so signed bigints can be retrieved.
It might be good in the future to check whether types are signed or not using
[SQLGetTypeInfo](https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlgettypeinfo-function?view=sql-server-ver15) and use the 'UNSIGNED_ATTRIBUTE' column, but that's a task for another day...