Merge pull request #201 from rhauch/dbz-197
DBZ-197 Corrected MySQL connector to handle invalid enum values
This commit is contained in:
commit
a2d6d62fb0
@ -306,8 +306,13 @@ protected Object convertEnumToString(List<String> options, Column column, Field
|
||||
|
||||
if (options != null) {
|
||||
// The binlog will contain an int with the 1-based index of the option in the enum value ...
|
||||
int index = ((Integer) data).intValue() - 1; // 'options' is 0-based
|
||||
if (index < options.size()) {
|
||||
int value = ((Integer)data).intValue();
|
||||
if (value == 0) {
|
||||
// an invalid value was specified, which corresponds to the empty string '' and an index of 0
|
||||
return "";
|
||||
}
|
||||
int index = value - 1; // 'options' is 0-based
|
||||
if (index < options.size() && index >= 0) {
|
||||
return options.get(index);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user