Skip to content

Poco::Data::ODBC [N]VARCHAR(MAX) wrong maxDataSize() result #3153

@obiltschnig

Description

@obiltschnig

For VARCHAR(MAX) and NVARCHAR(MAX) columns, the calculation of the maximum data size in Preparator::maxDataSize() returns a wrong result. Reason is that length is 0 for MAX. In case of a 0 length, the result of getMaxFieldSize() would be used. However, for strings, the length is incremented by 1 (to make room for the terminating NULL), so the resulting field size is 1. So, due to truncation, always an empty string is returned. Solution:

if (sz && !isBulk() && ((ODBCMetaColumn::FDT_WSTRING == type) || (ODBCMetaColumn::FDT_STRING == type))) ++sz;

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions