@Override public final int findColumn(final String columnLabel) throws SQLException { return resultSets.get(0).findColumn(columnLabel); }
@Override @Nullable public byte[] getBlobAsBytes(ResultSet rs, String columnName) throws SQLException { return getBlobAsBytes(rs, rs.findColumn(columnName)); }
@Override @Nullable public InputStream getClobAsAsciiStream(ResultSet rs, String columnName) throws SQLException { return getClobAsAsciiStream(rs, rs.findColumn(columnName)); }
@Override @Nullable public String getClobAsString(ResultSet rs, String columnName) throws SQLException { return getClobAsString(rs, rs.findColumn(columnName)); }
@Override @Nullable public InputStream getBlobAsBinaryStream(ResultSet rs, String columnName) throws SQLException { return getBlobAsBinaryStream(rs, rs.findColumn(columnName)); }
@Override public Reader getClobAsCharacterStream(ResultSet rs, String columnName) throws SQLException { return getClobAsCharacterStream(rs, rs.findColumn(columnName)); }
@Override public int findColumn(String columnLabel) throws SQLException { try { return rs.findColumn(columnLabel); } catch (Throwable t) { throw checkException(t); } }
/** * @see java.sql.ResultSet#findColumn(String) */ @Override public int findColumn(String columnLabel) throws InvalidResultSetAccessException { Integer columnIndex = this.columnLabelMap.get(columnLabel); if (columnIndex != null) { return columnIndex; } else { try { return this.resultSet.findColumn(columnLabel); } catch (SQLException se) { throw new InvalidResultSetAccessException(se); } } }
public int resolveColumnPosition(String columnName) throws HibernateException { try { return resultSet.findColumn( columnName ); } catch( SQLException e ) { throw new HibernateException( "Could not resolve column name in result set [" + columnName + "]", e ); } }
@Override public Object call() throws Exception { rs.findColumn("wrong"); return null; } },
@Override public Object call() throws Exception { rs.findColumn("wrong"); return null; } },
@Override public Object call() throws Exception { rs.findColumn("wrong"); return null; } },
@Override public void run() throws Exception { rs.findColumn("id"); } });
@Override public int resultSet_findColumn(ResultSetProxy rs, String columnLabel) throws SQLException { if (this.pos < filterSize) { return nextFilter() .resultSet_findColumn(this, rs, columnLabel); } return rs.getResultSetRaw() .findColumn(columnLabel); }
@Override public MyDate nullSafeGet( ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException { return new MyDate(rs.getDate(rs.findColumn(names[0]))); }
@Override public DollarValue nullSafeGet( ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException { return new DollarValue( rs.getBigDecimal( rs.findColumn( names[0]))); }
@Override public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException { return new Age( rs.getInt( rs.findColumn( names[0] ) ) ); }
private void doTest(Method rsetMethod, Method rowsetMethod, Object arg, Object ret) throws Exception { if (arg instanceof String) { given(resultSet.findColumn((String) arg)).willReturn(1); given(rsetMethod.invoke(resultSet, 1)).willReturn(ret).willThrow(new SQLException("test")); } else { given(rsetMethod.invoke(resultSet, arg)).willReturn(ret).willThrow(new SQLException("test")); } rowsetMethod.invoke(rowSet, arg); try { rowsetMethod.invoke(rowSet, arg); fail("InvalidResultSetAccessException should have been thrown"); } catch (InvocationTargetException ex) { assertEquals(InvalidResultSetAccessException.class, ex.getTargetException().getClass()); } }
@Override public Object resultSet_getObject(FilterChain chain, ResultSetProxy result, String columnLabel) throws SQLException { ResultSet rawResultSet = result.getResultSetRaw(); ResultSetMetaData metadata = rawResultSet.getMetaData(); int columnIndex = rawResultSet.findColumn(columnLabel); int columnType = metadata.getColumnType(columnIndex); Object value = null; switch (columnType) { case Types.CHAR: value = super.resultSet_getString(chain, result, columnLabel); break; case Types.CLOB: value = super.resultSet_getString(chain, result, columnLabel); break; case Types.LONGVARCHAR: value = super.resultSet_getString(chain, result, columnLabel); break; case Types.VARCHAR: value = super.resultSet_getString(chain, result, columnLabel); break; default: value = super.resultSet_getObject(chain, result, columnLabel); } return decodeObject(result.getStatementProxy().getConnectionProxy(), value); }
@Override public Object resultSet_getObject(FilterChain chain, ResultSetProxy result, String columnLabel, java.util.Map<String, Class<?>> map) throws SQLException { ResultSet rawResultSet = result.getResultSetRaw(); ResultSetMetaData metadata = rawResultSet.getMetaData(); int columnIndex = rawResultSet.findColumn(columnLabel); int columnType = metadata.getColumnType(columnIndex); Object value = null; switch (columnType) { case Types.CHAR: value = super.resultSet_getString(chain, result, columnLabel); break; case Types.CLOB: value = super.resultSet_getString(chain, result, columnLabel); break; case Types.LONGVARCHAR: value = super.resultSet_getString(chain, result, columnLabel); break; case Types.VARCHAR: value = super.resultSet_getString(chain, result, columnLabel); break; default: value = super.resultSet_getObject(chain, result, columnLabel, map); } return decodeObject(result.getStatementProxy().getConnectionProxy(), value); }