Java Code Examples for com.alibaba.otter.canal.protocol.CanalEntry.Column#getIndex()

The following examples show how to use com.alibaba.otter.canal.protocol.CanalEntry.Column#getIndex() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LogEventConvert.java    From canal-1.1.3 with Apache License 2.0 6 votes vote down vote up
private boolean isUpdate(List<Column> bfColumns, String newValue, int index) {
    if (bfColumns == null) {
        throw new CanalParseException("ERROR ## the bfColumns is null");
    }

    if (index < 0) {
        return false;
    }

    for (Column column : bfColumns) {
        if (column.getIndex() == index) {// 比较before / after的column index
            if (column.getIsNull() && newValue == null) {
                // 如果全是null
                return false;
            } else if (newValue != null && (!column.getIsNull() && column.getValue().equals(newValue))) {
                // fixed issue #135, old column is Null
                // 如果不为null,并且相等
                return false;
            }
        }
    }

    // 比如nolob/minial模式下,可能找不到before记录,认为是有变化
    return true;
}
 
Example 2
Source File: LogEventConvert.java    From DBus with Apache License 2.0 6 votes vote down vote up
private boolean isUpdate(List<Column> bfColumns, String newValue, int index) {
    if (bfColumns == null) {
        throw new CanalParseException("ERROR ## the bfColumns is null");
    }

    if (index < 0) {
        return false;
    }

    for (Column column : bfColumns) {
        if (column.getIndex() == index) {// 比较before / after的column index
            if (column.getIsNull() && newValue == null) {
                // 如果全是null
                return false;
            } else if (newValue != null && (!column.getIsNull() && column.getValue().equals(newValue))) {
                // fixed issue #135, old column is Null
                // 如果不为null,并且相等
                return false;
            }
        }
    }

    // 比如nolob/minial模式下,可能找不到before记录,认为是有变化
    return true;
}
 
Example 3
Source File: LogEventConvert_old.java    From DBus with Apache License 2.0 6 votes vote down vote up
private boolean isUpdate(List<Column> bfColumns, String newValue, int index) {
    if (bfColumns == null) {
        throw new CanalParseException("ERROR ## the bfColumns is null");
    }

    if (index < 0) {
        return false;
    }

    for (Column column : bfColumns) {
        if (column.getIndex() == index) {// �Ƚ�before / after��column index
            if (column.getIsNull() && newValue == null) {
                // ���ȫ��null
                return false;
            } else if (newValue != null && (!column.getIsNull() && column.getValue().equals(newValue))) {
                // fixed issue #135, old column is Null
                // �����Ϊnull���������
                return false;
            }
        }
    }

    // ����nolob/minialģʽ��,�����Ҳ���before��¼,��Ϊ���б仯
    return true;
}
 
Example 4
Source File: LogEventConvert.java    From DBus with Apache License 2.0 6 votes vote down vote up
private boolean isUpdate(List<Column> bfColumns, String newValue, int index) {
    if (bfColumns == null) {
        throw new CanalParseException("ERROR ## the bfColumns is null");
    }

    if (index < 0) {
        return false;
    }

    for (Column column : bfColumns) {
        if (column.getIndex() == index) {// 比较before / after的column index
            if (column.getIsNull() && newValue == null) {
                // 如果全是null
                return false;
            } else if (newValue != null && (!column.getIsNull() && column.getValue().equals(newValue))) {
                // fixed issue #135, old column is Null
                // 如果不为null,并且相等
                return false;
            }
        }
    }

    // 比如nolob/minial模式下,可能找不到before记录,认为是有变化
    return true;
}
 
Example 5
Source File: LogEventConvert.java    From canal with Apache License 2.0 6 votes vote down vote up
private boolean isUpdate(List<Column> bfColumns, String newValue, int index) {
    if (bfColumns == null) {
        throw new CanalParseException("ERROR ## the bfColumns is null");
    }

    if (index < 0) {
        return false;
    }

    for (Column column : bfColumns) {
        if (column.getIndex() == index) {// 比较before / after的column index
            if (column.getIsNull() && newValue == null) {
                // 如果全是null
                return false;
            } else if (newValue != null && (!column.getIsNull() && column.getValue().equals(newValue))) {
                // fixed issue #135, old column is Null
                // 如果不为null,并且相等
                return false;
            }
        }
    }

    // 比如nolob/minial模式下,可能找不到before记录,认为是有变化
    return true;
}