📄 jdbcresultset.java
字号:
throw logAndConvert(e);
}
}
/**
* Returns the value of the specified column as a java.sql.Time.
*
* @param columnName the name of the column label
* @return the value
* @throws SQLException if the column is not found or if the result set is closed
*/
public Time getTime(String columnName) throws SQLException {
try {
debugCodeCall("getTime", columnName);
return get(columnName).getTime();
} catch (Throwable e) {
throw logAndConvert(e);
}
}
/**
* Returns the value of the specified column as a java.sql.Timestamp.
*
* @param columnName the name of the column label
* @return the value
* @throws SQLException if the column is not found or if the result set is closed
*/
public Timestamp getTimestamp(String columnName) throws SQLException {
try {
debugCodeCall("getTimestamp", columnName);
return get(columnName).getTimestamp();
} catch (Throwable e) {
throw logAndConvert(e);
}
}
/**
* Returns a column value as a Java object. For BINARY data, the data is
* de-serialized into a Java Object.
*
* @param columnIndex (1,2,...)
* @return the value or null
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public Object getObject(int columnIndex) throws SQLException {
try {
debugCodeCall("getObject", columnIndex);
Value v = get(columnIndex);
if (Constants.SERIALIZE_JAVA_OBJECTS) {
if (v.getType() == Value.JAVA_OBJECT) {
return ObjectUtils.deserialize(v.getBytesNoCopy());
}
}
return v.getObject();
} catch (Throwable e) {
throw logAndConvert(e);
}
}
/**
* Returns a column value as a Java object. For BINARY data, the data is
* de-serialized into a Java Object.
*
* @param columnName the name of the column label
* @return the value or null
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public Object getObject(String columnName) throws SQLException {
try {
debugCodeCall("getObject", columnName);
Value v = get(columnName);
if (Constants.SERIALIZE_JAVA_OBJECTS) {
if (v.getType() == Value.JAVA_OBJECT) {
return ObjectUtils.deserialize(v.getBytesNoCopy());
}
}
return v.getObject();
} catch (Throwable e) {
throw logAndConvert(e);
}
}
/**
* Returns the value of the specified column as a boolean.
*
* @param columnIndex (1,2,...)
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public boolean getBoolean(int columnIndex) throws SQLException {
try {
debugCodeCall("getBoolean", columnIndex);
Boolean v = get(columnIndex).getBoolean();
return v == null ? false : v.booleanValue();
} catch (Throwable e) {
throw logAndConvert(e);
}
}
/**
* Returns the value of the specified column as a boolean.
*
* @param columnName the name of the column label
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public boolean getBoolean(String columnName) throws SQLException {
try {
debugCodeCall("getBoolean", columnName);
Boolean v = get(columnName).getBoolean();
return v == null ? false : v.booleanValue();
} catch (Throwable e) {
throw logAndConvert(e);
}
}
/**
* Returns the value of the specified column as a byte.
*
* @param columnIndex (1,2,...)
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public byte getByte(int columnIndex) throws SQLException {
try {
debugCodeCall("getByte", columnIndex);
return get(columnIndex).getByte();
} catch (Throwable e) {
throw logAndConvert(e);
}
}
/**
* Returns the value of the specified column as a byte.
*
* @param columnName the name of the column label
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public byte getByte(String columnName) throws SQLException {
try {
debugCodeCall("getByte", columnName);
return get(columnName).getByte();
} catch (Throwable e) {
throw logAndConvert(e);
}
}
/**
* Returns the value of the specified column as a short.
*
* @param columnIndex (1,2,...)
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public short getShort(int columnIndex) throws SQLException {
try {
debugCodeCall("getShort", columnIndex);
return get(columnIndex).getShort();
} catch (Throwable e) {
throw logAndConvert(e);
}
}
/**
* Returns the value of the specified column as a short.
*
* @param columnName the name of the column label
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public short getShort(String columnName) throws SQLException {
try {
debugCodeCall("getShort", columnName);
return get(columnName).getShort();
} catch (Throwable e) {
throw logAndConvert(e);
}
}
/**
* Returns the value of the specified column as a long.
*
* @param columnIndex (1,2,...)
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public long getLong(int columnIndex) throws SQLException {
try {
debugCodeCall("getLong", columnIndex);
return get(columnIndex).getLong();
} catch (Throwable e) {
throw logAndConvert(e);
}
}
/**
* Returns the value of the specified column as a long.
*
* @param columnName the name of the column label
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public long getLong(String columnName) throws SQLException {
try {
debugCodeCall("getLong", columnName);
return get(columnName).getLong();
} catch (Throwable e) {
throw logAndConvert(e);
}
}
/**
* Returns the value of the specified column as a float.
*
* @param columnIndex (1,2,...)
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public float getFloat(int columnIndex) throws SQLException {
try {
debugCodeCall("getFloat", columnIndex);
return get(columnIndex).getFloat();
} catch (Throwable e) {
throw logAndConvert(e);
}
}
/**
* Returns the value of the specified column as a float.
*
* @param columnName the name of the column label
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public float getFloat(String columnName) throws SQLException {
try {
debugCodeCall("getFloat", columnName);
return get(columnName).getFloat();
} catch (Throwable e) {
throw logAndConvert(e);
}
}
/**
* Returns the value of the specified column as a double.
*
* @param columnIndex (1,2,...)
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public double getDouble(int columnIndex) throws SQLException {
try {
debugCodeCall("getDouble", columnIndex);
return get(columnIndex).getDouble();
} catch (Throwable e) {
throw logAndConvert(e);
}
}
/**
* Returns the value of the specified column as a double.
*
* @param columnName the name of the column label
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public double getDouble(String columnName) throws SQLException {
try {
debugCodeCall("getDouble", columnName);
return get(columnName).getDouble();
} catch (Throwable e) {
throw logAndConvert(e);
}
}
/**
* Returns the value of the specified column as a String.
*
* @deprecated
*
* @param columnName
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException {
try {
if (debug()) {
debugCode("getBigDecimal(" + StringUtils.quoteJavaString(columnName)+", "+scale+");");
}
if (scale < 0) {
throw Message.getInvalidValueException(""+scale, "scale");
}
BigDecimal bd = get(columnName).getBigDecimal();
return bd == null ? null : MathUtils.setScale(bd, scale);
} catch (Throwable e) {
throw logAndConvert(e);
}
}
/**
* Returns the value of the specified column as a String.
*
* @deprecated
*
* @param columnIndex (1,2,...)
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException {
try {
if (debug()) {
debugCode("getBigDecimal(" + columnIndex+", "+scale+");");
}
if (scale < 0) {
throw Message.getInvalidValueException(""+scale, "scale");
}
BigDecimal bd = get(columnIndex).getBigDecimal();
return bd == null ? null : MathUtils.setScale(bd, scale);
} catch (Throwable e) {
throw logAndConvert(e);
}
}
/**
* [Not supported]
* @deprecated
*/
public InputStream getUnicodeStream(int columnIndex) throws SQLException {
try {
debugCodeCall("getUnicodeStream", columnIndex);
throw Message.getUnsupportedException();
} catch (Throwable e) {
throw logAndConvert(e);
}
}
/**
* [Not supported]
* @deprecated
*/
public InputStream getUnicodeStream(String columnName) throws SQLException {
try {
debugCodeCall("getUnicodeStream", columnName);
throw Message.getUnsupportedException();
} catch (Throwable e) {
throw logAndConvert(e);
}
}
/**
* [Not supported] Gets a column as a object using the specified type
* mapping.
*/
public Object getObject(int columnIndex, Map map) throws SQLException {
try {
if (debug()) {
debugCode("getObject(" + columnIndex + ", map);");
}
throw Message.getUnsupportedException();
} catch (Throwable e) {
throw logAndConvert(e);
}
}
/**
* [Not supported] Gets a column as a object using the specified type
* mapping.
*/
public Object getObject(String columnName, Map map) throws SQLException {
try {
if (debug()) {
debugCode("getObject(" + quote(columnName) + ", map);");
}
throw Message.getUnsupportedException();
} catch (Throwable e) {
throw logAndConvert(e);
}
}
/**
* [Not supported] Gets a column as a reference.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -