Java Utililty Methods SQL PreparedStatement

List of utility methods to do SQL PreparedStatement

Description

The list of methods to do SQL PreparedStatement are organized into topic(s).

Method

voidwriteMap(Connection connection, PreparedStatement preparedStatement, int keyColumn, int valueColumn, Class keyType, Class valueType, Map map)
write Map
List<K> keys = new ArrayList<>(map.keySet());
List<V> values = new ArrayList<>();
for (K key : keys) {
    values.add(map.get(key));
@SuppressWarnings("unchecked")
K[] keyArray = (K[]) keys.toArray();
@SuppressWarnings("unchecked")
...
voidwriteProperties(Connection connection, PreparedStatement preparedStatement, int keyColumn, int valueColumn, Properties properties)
write Properties
List<Object> keys = new ArrayList<>(properties.keySet());
List<Object> values = new ArrayList<>();
for (Object key : keys) {
    values.add(properties.get(key));
writeArray(connection, preparedStatement, keyColumn, Object.class, keys.toArray());
writeArray(connection, preparedStatement, valueColumn, Object.class, values.toArray());