package sharin.sql.runner.converter;

import java.sql.ResultSet;

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

public class BooleanColumnConverter implements ColumnConverter {

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

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

        return value;
    }
}
