List of usage examples for java.sql ResultSet findColumn
int findColumn(String columnLabel) throws SQLException;
ResultSet
column label to its ResultSet
column index. From source file:index.IncrementIndex.java
/** * ?/*from w ww .ja v a 2s .co m*/ * @param key ?? * @param res * @return */ public static boolean whetherExist(String key, ResultSet res) { try { // if (res.findColumn(key) > 0) { return true; } } catch (SQLException e) { return false; } return false; }
From source file:ch.digitalfondue.npjt.mapper.DefaultMapper.java
public Object getObject(ResultSet rs) throws SQLException { int columnIdx = rs.findColumn(name); return JdbcUtils.getResultSetValue(rs, columnIdx, paramType); }
From source file:org.sakaiproject.orm.ibatis.support.AbstractLobTypeHandler.java
/** * This implementation delegates to the getResult version * that takes a column index.//from w ww . j a v a 2s . c om * @see #getResult(java.sql.ResultSet, String) * @see java.sql.ResultSet#findColumn */ public final Object getResult(ResultSet rs, String columnName) throws SQLException { return getResult(rs, rs.findColumn(columnName)); }
From source file:com.sinosoft.one.data.jade.rowmapper.MapEntryRowMapper.java
public Object mapRow(ResultSet rs, int rowNum) throws SQLException { if (rowNum == 0) { if (StringUtils.isNotEmpty(keyColumn)) { keyColumnIndex = rs.findColumn(keyColumn); if (keyColumnIndex <= 0) { throw new IllegalArgumentException( String.format("wrong key name %s for method: %s ", keyColumn, modifier.getMethod())); }//from w w w . j a v a 2s .c o m keyColumn = null; } if (logger.isDebugEnabled()) { logger.debug(String.format("keyIndex=%s; for method: %s ", keyColumnIndex, modifier.getMethod())); } } // JDBC ResultSet ? Key Object key = JdbcUtils.getResultSetValue(rs, keyColumnIndex, keyType); if (key != null && !keyType.isInstance(key)) { ResultSetMetaData rsmd = rs.getMetaData(); throw new TypeMismatchDataAccessException( // NL "Type mismatch affecting row number " + rowNum + " and column type '" + rsmd.getColumnTypeName(keyColumnIndex) + "' expected type is '" + keyType + "'"); } return new MapEntryImpl<Object, Object>(key, mapper.mapRow(rs, rowNum)); }
From source file:com.gzj.tulip.jade.rowmapper.MapEntryRowMapper.java
@Override public Object mapRow(ResultSet rs, int rowNum) throws SQLException { if (rowNum == 0) { if (StringUtils.isNotEmpty(keyColumn)) { keyColumnIndex = rs.findColumn(keyColumn); if (keyColumnIndex <= 0) { throw new IllegalArgumentException( String.format("wrong key name %s for method: %s ", keyColumn, modifier.getMethod())); }/* w w w .j a va 2 s . c o m*/ keyColumn = null; } if (logger.isDebugEnabled()) { logger.debug(String.format("keyIndex=%s; for method: %s ", keyColumnIndex, modifier.getMethod())); } } // JDBC ResultSet ? Key Object key = JdbcUtils.getResultSetValue(rs, keyColumnIndex, keyType); if (key != null && !keyType.isInstance(key)) { ResultSetMetaData rsmd = rs.getMetaData(); throw new TypeMismatchDataAccessException( // NL "Type mismatch affecting row number " + rowNum + " and column type '" + rsmd.getColumnTypeName(keyColumnIndex) + "' expected type is '" + keyType + "'"); } return new MapEntryImpl<Object, Object>(key, mapper.mapRow(rs, rowNum)); }
From source file:com.abixen.platform.module.chart.service.impl.AbstractDatabaseService.java
private DataSourceValueWeb getValueAsDataSourceValueDateWeb(ResultSet row, String columnName) throws SQLException { Date value = row.getDate(row.findColumn(columnName)); return new DataSourceValueDateWeb() { @Override/* ww w . java 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.module.chart.service.impl.AbstractDatabaseService.java
private DataSourceValueWeb getValueAsDataSourceValueIntegerWeb(ResultSet row, String columnName) throws SQLException { Integer value = row.getInt(row.findColumn(columnName)); return new DataSourceValueIntegerWeb() { @Override/*from w ww .j av a2s . 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.module.chart.service.impl.AbstractDatabaseService.java
private DataSourceValueWeb getValueAsDataSourceValueDoubleWeb(ResultSet row, String columnName) throws SQLException { Double value = row.getDouble(row.findColumn(columnName)); return new DataSourceValueDoubleWeb() { @Override//from w w w. ja v a 2s . c om public Double getValue() { return value; } @Override public void setValue(Double value) { throw new NotImplementedException("Setter not implemented yet"); } }; }
From source file:com.abixen.platform.module.chart.service.impl.AbstractDatabaseService.java
private DataSourceValueWeb getValueAsDataSourceValueStringWeb(ResultSet row, String columnName) throws SQLException { String value = row.getString(row.findColumn(columnName)); return new DataSourceValueStringWeb() { @Override/*from ww w. j a va 2 s .c om*/ public String getValue() { return value; } @Override public void setValue(String value) { throw new NotImplementedException("Setter not implemented yet"); } }; }
From source file:com.abixen.platform.service.businessintelligence.multivisualisation.application.service.database.AbstractDatabaseService.java
private DataValueDto getValueAsDataSourceValueDateWeb(ResultSet row, String columnName) throws SQLException { Date value = row.getDate(row.findColumn(columnName)); return new DataValueDto<Date>().setValue(value); }