Here you can find the source of putResultSetToMap(final Hashtable
Parameter | Description |
---|---|
map | a parameter |
resultSet | a parameter |
keys | a parameter |
Parameter | Description |
---|---|
SQLException | an exception |
Exception | an exception |
public static void putResultSetToMap(final Hashtable<String, String> map, final ResultSet resultSet, final String... keys) throws SQLException
//package com.java2s; //License from project: Open Source License import java.sql.ResultSet; import java.sql.SQLException; import java.util.Hashtable; public class Main { /**/*from ww w .ja v a 2 s .com*/ * Put all the keys from the resultSet into the map using the specified keys. * * @param map * @param resultSet * @param keys * @throws SQLException * @throws Exception */ public static void putResultSetToMap(final Hashtable<String, String> map, final ResultSet resultSet, final String... keys) throws SQLException { for (String key : keys) { String val = resultSet.getString(key); if (val != null) { map.put(key, val); } } } }