Skip to content

ODBCMetaColumn::init() always maps integer NUMERIC/DECIMAL to Int32 #1464

@obiltschnig

Description

@obiltschnig

Mapping a NUMERIC or DECIMAL with no fractional digits to Int32 will lead to issues (exception) if an actual number stored in the column does not fit into a 32-bit integer. The method should check the size of the type, and if its > 9, map to Int64 instead.

Fix:

    case SQL_NUMERIC:
    case SQL_DECIMAL:
        if (0 == _columnDesc.decimalDigits)
        {
            if (_columnDesc.size > 9)
                setType(MetaColumn::FDT_INT64);
            else
                setType(MetaColumn::FDT_INT32);
        }
        else
        {
            setType(MetaColumn::FDT_DOUBLE);
        }
        break;

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions