Repository navigation
Report INT_MAX instead of SQL_NO_TOTAL for SQLGetTypeInfo COLUMN_SIZE (#215) - #218
Merged
Merged
Conversation
…#215) With ByteaAsLongVarBinary=1 (the default), SQLGetTypeInfo reported COLUMN_SIZE = SQL_NO_TOTAL (-4) for bytea, and likewise for the large object type. SQL_NO_TOTAL is a length/indicator value, not a column size. MSDASQL binds COLUMN_SIZE as SQL_C_ULONG; before #210 the -4 silently wrapped to 4294967292, but since the 22003 range check was added SQLFetch fails on the bytea row, MSDASQL never learns the type, and ADO bytea parameters fail with "Type is invalid". Report INT_MAX (2147483647) instead, the largest size the INT4 column can hold. NULL is not an option: MSDASQL binds without an indicator, so a NULL would fail with 22002 instead. New typeinfo-column-size test fetches every SQLGetTypeInfo(SQL_ALL_TYPES) row with COLUMN_SIZE bound as SQL_C_ULONG and no indicator. Assisted-By: Claude
davecramer
force-pushed
the
fix-215-no-total-column-size
branch
from
October 7, 2026 15:32
42c4565 to
a8679f5
Compare
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.
Fixes #215.
With
ByteaAsLongVarBinary=1(the default),SQLGetTypeInforeportsCOLUMN_SIZE=SQL_NO_TOTAL(-4) forbytea, and likewise for the large object type.SQL_NO_TOTALis a length/indicator value, not a column size.MSDASQL binds
COLUMN_SIZEasSQL_C_ULONG. Before #210 the -4 silently wrapped to 4294967292. Since #210 added the 22003 range check,SQLFetchfails on thebytearow, MSDASQL never learns about the type, and ADObyteaparameters fail with "Type is invalid". This is a regression in 18.00.0003 and 18.00.0004.This change reports
INT_MAX(2147483647) instead, the largest size the INT4 column can hold. NULL would not help: MSDASQL binds without an indicator, so a NULL fails with 22002 instead.Test
New
typeinfo-column-sizetest fetches everySQLGetTypeInfo(SQL_ALL_TYPES)row withCOLUMN_SIZEbound asSQL_C_ULONGand no indicator:SQLFetch failed/22003=Numeric value out of rangebytea: COLUMN_SIZE=2147483647Full regression suite passes locally (65/65).
Not changed
SQLColumns,SQLSpecialColumnsandSQLProcedureColumnscan still return -4 in their size columns: forbyteaand large object columns, and for all columns underUnknownSizes=DontKnow, where -4 is the behaviour that setting selects. No failure has been reported there, so they are left for a follow-up if needed.Assisted-By: Claude