big fix ORM getCustomResult

This commit is contained in:
Marc Baloup 2018-10-07 01:56:42 +02:00
parent a44233bea0
commit d46d0d2890
No known key found for this signature in database
GPG Key ID: 3A4F019B6C600FDE
1 changed files with 12 additions and 10 deletions

View File

@ -165,17 +165,19 @@ public final class ORM {
public static ResultSet getCustomResult(String sql, List<Object> params) throws ORMException {
try {
try (PreparedStatement ps = connection.getNativeConnection().prepareStatement(sql)) {
int i = 1;
for (Object val : params) {
if (val instanceof Enum<?>) val = ((Enum<?>) val).name();
ps.setObject(i++, val);
}
Log.debug(ps.toString());
return ps.executeQuery();
PreparedStatement ps = connection.getNativeConnection().prepareStatement(sql);
int i = 1;
for (Object val : params) {
if (val instanceof Enum<?>) val = ((Enum<?>) val).name();
ps.setObject(i++, val);
}
Log.debug(ps.toString());
ResultSet rs = ps.executeQuery();
ps.closeOnCompletion();
return rs;
} catch (SQLException e) {
throw new ORMException(e);
}