Java Utililty Methods SQL ResultSet Long Read

List of utility methods to do SQL ResultSet Long Read

Description

The list of methods to do SQL ResultSet Long Read are organized into topic(s).

Method

LonggetLongFromResultSet(ResultSet rs, String field)
Returns the Long value corresponding to the given field on the given ResultSet.
Long result = null;
try {
    Object value = rs.getObject(field);
    if (value != null) {
        result = (Long) value;
} catch (Exception e) {
return result;
ListgetLongList(ResultSet resultSet, String columnName)
Returns a list of long values using a given SQL result set and column name.
List<Long> values = null;
if (resultSet != null && columnName != null) {
    values = new ArrayList<Long>();
    while (resultSet.next()) {
        values.add(getLong(resultSet, columnName));
return values;
...
LonggetLongOrNull(ResultSet rs, String column)
get Long Or Null
long lVal = rs.getLong(column);
if (rs.wasNull()) {
    return null;
return new Long(lVal);
StringgetLongString(ResultSet rs, int pos)
Get a long string, which could be a TEXT or CLOB type.
String s = rs.getString(pos);
if (s != null) {
    return s;
} else {
    try {
        Clob c = rs.getClob(pos);
        return c.getSubString(1, (int) c.length());
    } catch (Throwable th) {
...
LonggetLongValue(ResultSet resultSet, int columnIndex)
Return any long value.
long value = resultSet.getLong(columnIndex);
if (resultSet.wasNull()) {
    return null;
return Long.valueOf(value);
ObjectgetLongValue(ResultSet rs, int valueIndex)
get Long Value
return rs.getString(valueIndex);
LongreadLongFromResultSet(ResultSet rs, String column)
read Long From Result Set
long l = rs.getInt(column);
return rs.wasNull() ? null : l;