Allocate objects only when it's necessary

Closes gh-23036
This commit is contained in:
Сергей Цыпанов
2019-05-27 12:14:25 +03:00
committed by Sam Brannen
parent 6f2f5bb8c1
commit 6964ed33bf
4 changed files with 4 additions and 4 deletions

View File

@@ -484,12 +484,12 @@ public abstract class AbstractJdbcInsert {
//Get the key
Statement keyStmt = null;
ResultSet rs = null;
Map<String, Object> keys = new HashMap<>(2);
try {
keyStmt = con.createStatement();
rs = keyStmt.executeQuery(keyQuery);
if (rs.next()) {
long key = rs.getLong(1);
Map<String, Object> keys = new HashMap<>(2);
keys.put(getGeneratedKeyNames()[0], key);
keyHolder.getKeyList().add(keys);
}