OgrLayer::SaveChanges sets NULL fields to value of most-previous non-NULL field value

Description

Observed after receiving an error when attempting to save a record "string or binary data would be truncated".

Stepping through revealed that as SaveChanges was iterating the fields of the table, TableClass::get_CellValue was not properly clearing the incoming VARIANT value when it encountered a NULL value, and so it was left with the value of the previous field. If the previous field was larger than the current field, it resulted in storing a string that was larger than the current field could hold - and thus the 'data would be truncated' error.

Environment

None

Activity

Show:
Jerry Faust
October 23, 2018, 8:21 PM

TableClass::get_CellValue will now properly set reference VARIANT to VT_EMPTY if the current field is NULL. This was already the intent of the code, but was not having the desired effect.

Assignee

Jerry Faust

Reporter

Jerry Faust

Labels

Fix versions

Affects versions

Priority

High
Configure