本文整理了Java中java.sql.ResultSet.getByte
方法的一些代码示例,展示了ResultSet.getByte
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResultSet.getByte
方法的具体详情如下:
包路径:java.sql.ResultSet
类名称:ResultSet
方法名:getByte
[英]Gets the value of a column specified by column index as a byte.
[中]获取由列索引指定为字节的列的值。
代码示例来源:origin: requery/requery
@Override
public Byte fromResult(ResultSet results, int column) throws SQLException {
return results.getByte(column);
}
代码示例来源:origin: requery/requery
@Override
public byte readByte(ResultSet results, int column) throws SQLException {
return results.getByte(column);
}
代码示例来源:origin: querydsl/querydsl
@Override
public byte getByte(int columnIndex) throws SQLException {
return rs.getByte(columnIndex);
}
代码示例来源:origin: querydsl/querydsl
@Override
public byte getByte(String columnLabel) throws SQLException {
return rs.getByte(columnLabel);
}
代码示例来源:origin: alibaba/canal
public static Object getRSData(ResultSet rs, String columnName, int jdbcType) throws SQLException {
if (jdbcType == Types.BIT || jdbcType == Types.BOOLEAN) {
return rs.getByte(columnName);
} else {
return rs.getObject(columnName);
}
}
代码示例来源:origin: spring-projects/spring-framework
/**
* @see java.sql.ResultSet#getByte(int)
*/
@Override
public byte getByte(int columnIndex) throws InvalidResultSetAccessException {
try {
return this.resultSet.getByte(columnIndex);
}
catch (SQLException se) {
throw new InvalidResultSetAccessException(se);
}
}
代码示例来源:origin: oblac/jodd
/**
* {@inheritDoc}
*/
@Override
public Byte get(final ResultSet rs, final int index, final int dbSqlType) throws SQLException {
return Byte.valueOf(rs.getByte(index));
}
代码示例来源:origin: alibaba/druid
@Override
public byte getByte(int columnIndex) throws SQLException {
try {
return rs.getByte(columnIndex);
} catch (Throwable t) {
throw checkException(t);
}
}
代码示例来源:origin: alibaba/druid
@Override
public byte getByte(String columnLabel) throws SQLException {
try {
return rs.getByte(columnLabel);
} catch (Throwable t) {
throw checkException(t);
}
}
代码示例来源:origin: nutzam/nutz
public Object get(ResultSet rs, String colName) throws SQLException {
byte re = rs.getByte(colName);
return rs.wasNull() ? null : re;
}
代码示例来源:origin: hibernate/hibernate-orm
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws SQLException {
return javaTypeDescriptor.wrap( rs.getByte( name ), options );
}
代码示例来源:origin: apache/ignite
@Override public void run() throws Exception {
rs.getByte("id");
}
});
代码示例来源:origin: apache/ignite
@Override public void run() throws Exception {
rs.getByte(1);
}
});
代码示例来源:origin: alibaba/druid
@Override
public byte resultSet_getByte(ResultSetProxy rs, String columnLabel) throws SQLException {
if (this.pos < filterSize) {
return nextFilter()
.resultSet_getByte(this, rs, columnLabel);
}
return rs.getResultSetRaw()
.getByte(columnLabel);
}
代码示例来源:origin: alibaba/druid
@Override
public byte resultSet_getByte(ResultSetProxy rs, int columnIndex) throws SQLException {
if (this.pos < filterSize) {
return nextFilter()
.resultSet_getByte(this, rs, columnIndex);
}
return rs.getResultSetRaw()
.getByte(columnIndex);
}
代码示例来源:origin: alibaba/canal
public Object getValFromRS(ESMapping mapping, ResultSet resultSet, String fieldName,
String columnName) throws SQLException {
String esType = getEsType(mapping, fieldName);
Object value = resultSet.getObject(columnName);
if (value instanceof Boolean) {
if (!"boolean".equals(esType)) {
value = resultSet.getByte(columnName);
}
}
// 如果是对象类型
if (mapping.getObjFields().containsKey(fieldName)) {
return ESSyncUtil.convertToEsObj(value, mapping.getObjFields().get(fieldName));
} else {
return ESSyncUtil.typeConvert(value, esType);
}
}
代码示例来源:origin: apache/ignite
@Override public void run(Connection conn) throws Exception {
try (PreparedStatement stmt = conn.prepareStatement("SELECT 'zzz'")) {
ResultSet rs = stmt.executeQuery();
rs.next();
rs.getByte(1);
}
}
}, "0700B", "Cannot convert to byte");
代码示例来源:origin: codingapi/tx-lcn
@Override
public byte getByte(String columnLabel) throws SQLException {
SQLException e = null;
try {
byte value = delegate.getByte(columnLabel);
eventListener.onAfterResultSetGet(resultSetInformation, columnLabel, value, null);
return value;
} catch (SQLException sqle) {
e = sqle;
eventListener.onAfterResultSetGet(resultSetInformation, columnLabel, null, e);
throw e;
}
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void testIgnoredWarning() throws Exception {
String sql = "SELECT forename from custmr";
SQLWarning warnings = new SQLWarning("My warning");
given(this.resultSet.next()).willReturn(false);
given(this.connection.createStatement()).willReturn(this.preparedStatement);
given(this.preparedStatement.getWarnings()).willReturn(warnings);
// Too long: truncation
this.template.setIgnoreWarnings(true);
this.template.query(sql, rs -> {
rs.getByte(1);
});
verify(this.resultSet).close();
verify(this.preparedStatement).close();
verify(this.connection).close();
}
代码示例来源:origin: spring-projects/spring-framework
/**
* Mock objects allow us to produce warnings at will
*/
@Test
public void testFatalWarning() throws Exception {
String sql = "SELECT forename from custmr";
SQLWarning warnings = new SQLWarning("My warning");
given(this.resultSet.next()).willReturn(false);
given(this.preparedStatement.getWarnings()).willReturn(warnings);
given(this.connection.createStatement()).willReturn(this.preparedStatement);
JdbcTemplate t = new JdbcTemplate(this.dataSource);
t.setIgnoreWarnings(false);
this.thrown.expect(SQLWarningException.class);
this.thrown.expect(exceptionCause(sameInstance(warnings)));
try {
t.query(sql, rs -> {
rs.getByte(1);
});
}
finally {
verify(this.resultSet).close();
verify(this.preparedStatement).close();
verify(this.connection).close();
}
}
内容来源于网络,如有侵权,请联系作者删除!