List of utility methods to do SQL ResultSet
boolean | isResultEmpty(ResultSet theResult) is Result Empty if (!theResult.isBeforeFirst()) { return true; return false; |
boolean | isReturnsInvalidResultSetException(SQLException se) is Returns Invalid Result Set Exception if ((se.getMessage() != null && se.getMessage().indexOf("cannot be called with a statement that returns a ResultSet.") >= 0) || (se.getSQLState() != null && (se.getSQLState().equals("X0Y79")))) return true; return false; |
boolean | isSupportedResultSetType(Connection connection, int resultSetType) is Supported Result Set Type DatabaseMetaData dbmd = connection.getMetaData();
return dbmd.supportsResultSetType(resultSetType);
|
List | loadListMap(final ResultSet rs) load List Map List<Map<?, ?>> list = new ArrayList<Map<?, ?>>(); while (rs.next()) { list.add(loadMap(rs)); return list; |
void | logCurrentResultSetRow(Log log, String msg, ResultSet rs) log Current Result Set Row if (log.isDebugEnabled()) { ResultSetMetaData rsmd = rs.getMetaData(); if (msg != null) { log.debug(msg); for (int i = 1; i <= rsmd.getColumnCount(); i++) { log.debug(" " + rsmd.getColumnName(i) + " (" + rsmd.getColumnClassName(i) + ") = " + rs.getString(i)); ... |
Map | mapResultSet(ResultSet set) map Result Set Map<String, Object> map = new HashMap<String, Object>(); ResultSetMetaData m = set.getMetaData(); int columnCount = m.getColumnCount(); for (int i = 0; i < columnCount; i++) { map.put(m.getColumnName(i), set.getObject(i)); return map; |
void | moveToPageNo(ResultSet rs, int pageNo, int pageSize) The result set cursor move to current page number. if (pageNo > 1) { int row = (pageNo - 1) * pageSize; rs.absolute(row); |
List | parseSqlResultToListMap(ResultSet rs) parse Sql Result To List Map List<Object> list = new ArrayList<Object>(); ResultSetMetaData metaData = rs.getMetaData(); int cols_len = metaData.getColumnCount(); while (rs.next()) { list.add(getMap(rs, metaData, cols_len)); if (list.size() == 0) { return null; ... |
void | putResultSetToMap(final Hashtable Put all the keys from the resultSet into the map using the specified keys. for (String key : keys) { String val = resultSet.getString(key); if (val != null) { map.put(key, val); |
String | safeGetString(ResultSet r, String name) safe Get String String s = r.getString(name);
return (s != null) ? s : EMPTY;
|