Example usage for java.sql ResultSet findColumn

List of usage examples for java.sql ResultSet findColumn

Introduction

In this page you can find the example usage for java.sql ResultSet findColumn.

Prototype

int findColumn(String columnLabel) throws SQLException;

Source Link

Document

Maps the given ResultSet column label to its ResultSet column index.

Usage

From source file:com.abixen.platform.service.businessintelligence.multivisualisation.application.service.database.AbstractDatabaseService.java

private DataValueDto getValueAsDataSourceValueIntegerWeb(ResultSet row, String columnName) throws SQLException {
    Integer value = row.getInt(row.findColumn(columnName));
    return new DataValueDto<Integer>().setValue(value);
}

From source file:com.abixen.platform.service.businessintelligence.multivisualisation.application.service.database.AbstractDatabaseService.java

private DataValueDto getValueAsDataSourceValueDoubleWeb(ResultSet row, String columnName) throws SQLException {
    Double value = row.getDouble(row.findColumn(columnName));
    return new DataValueDto<Double>().setValue(value);
}

From source file:com.abixen.platform.service.businessintelligence.multivisualisation.application.service.database.AbstractDatabaseService.java

private DataValueDto getValueAsDataSourceValueStringWeb(ResultSet row, String columnName) throws SQLException {
    String value = row.getString(row.findColumn(columnName));
    return new DataValueDto<String>().setValue(value);
}

From source file:com.emc.ecs.sync.service.DbService.java

protected boolean hasColumn(ResultSet rs, String name) {
    try {/*from   w w w  .ja  v  a 2 s .co  m*/
        rs.findColumn(name);
        return true;
    } catch (SQLException e) {
        return false;
    }
}

From source file:com.healthcit.analytics.dao.rowmapper.ReportTemplateRowMapper.java

@Override
public ReportTemplate mapRow(ResultSet resultSet, int rowNum) throws SQLException {
    ReportTemplate template = new ReportTemplate(resultSet.getLong(ID_COLUMN),
            resultSet.getString(TITLE_COLUMN), resultSet.getString(REPORT_COLUMN),
            resultSet.getTimestamp(TIMESTAMP_COLUMN), resultSet.getLong(OWNER_ID_COLUMN),
            resultSet.getBoolean(SHARED_COLUMN));
    try {/*from www .  j  a va2 s .c  o  m*/
        resultSet.findColumn(USERNAME_COLUMN);
        template.setOwnerName(resultSet.getString(USERNAME_COLUMN));
    } catch (SQLException ex) {

    }

    return template;
}

From source file:com.abixen.platform.module.chart.service.impl.AbstractDatabaseService.java

private DataSourceValueWeb getDataFromColumn(ResultSet row, String columnName) {
    try {//from   w w w  .  j  a v a2  s  .  co m
        ResultSetMetaData resultSetMetaData = row.getMetaData();
        String columnTypeName = resultSetMetaData.getColumnTypeName(row.findColumn(columnName));
        if ("BIGINT".equals(columnTypeName)) {
            columnTypeName = "INTEGER";
        }
        if ("VARCHAR".equals(columnTypeName)) {
            columnTypeName = "STRING";
        }
        return getValueAsDataSourceValue(row, columnName, DataValueType.valueOf(columnTypeName));
    } catch (SQLException e) {
        throw new DataSourceValueException("Error when getting value from column. " + e.getMessage());
    }
}

From source file:com.abixen.platform.service.businessintelligence.multivisualisation.service.impl.AbstractDatabaseService.java

private DataValueWeb getValueAsDataSourceValueDateWeb(ResultSet row, String columnName) throws SQLException {
    Date value = row.getDate(row.findColumn(columnName));
    return new DataValueDateWeb() {
        @Override/*from  w w  w. j  a  v a 2 s . c  om*/
        public Date getValue() {
            return value;
        }

        @Override
        public void setValue(Date value) {
            throw new NotImplementedException("Setter not implemented yet");
        }
    };
}

From source file:com.abixen.platform.service.businessintelligence.multivisualisation.service.impl.AbstractDatabaseService.java

private DataValueWeb getValueAsDataSourceValueIntegerWeb(ResultSet row, String columnName) throws SQLException {
    Integer value = row.getInt(row.findColumn(columnName));
    return new DataValueIntegerWeb() {
        @Override/*from   w  ww .  j  av  a2 s.c o  m*/
        public Integer getValue() {
            return value;
        }

        @Override
        public void setValue(Integer value) {
            throw new NotImplementedException("Setter not implemented yet");
        }
    };
}

From source file:com.abixen.platform.service.businessintelligence.multivisualisation.service.impl.AbstractDatabaseService.java

private DataValueWeb getValueAsDataSourceValueDoubleWeb(ResultSet row, String columnName) throws SQLException {
    Double value = row.getDouble(row.findColumn(columnName));
    return new DataValueDoubleWeb() {
        @Override//from   ww w  . ja  v  a  2s  . co  m
        public Double getValue() {
            return value;
        }

        @Override
        public void setValue(Double value) {
            throw new NotImplementedException("Setter not implemented yet");
        }
    };
}

From source file:com.abixen.platform.service.businessintelligence.multivisualisation.service.impl.AbstractDatabaseService.java

private DataValueWeb getValueAsDataSourceValueStringWeb(ResultSet row, String columnName) throws SQLException {
    String value = row.getString(row.findColumn(columnName));
    return new DataValueStringWeb() {
        @Override//from   w  w w . j a va2s  .c  om
        public String getValue() {
            return value;
        }

        @Override
        public void setValue(String value) {
            throw new NotImplementedException("Setter not implemented yet");
        }
    };
}