package sharin.sql.runner.converter;

import java.sql.ResultSet;

import sharin.sql.runner.ColumnConverter;
import sharin.util.SqlUtils;

public class ByteColumnConverter implements ColumnConverter {

    public Object convert(ResultSet rs, int columnIndex) {
        byte value = SqlUtils.getByte(rs, columnIndex);

        if (value == 0 && SqlUtils.wasNull(rs)) {
            return null;
        }

        return value;
    }
}
