big fix ORM getCustomResult
This commit is contained in:
parent
a44233bea0
commit
d46d0d2890
@ -165,17 +165,19 @@ public final class ORM {
|
|||||||
|
|
||||||
public static ResultSet getCustomResult(String sql, List<Object> params) throws ORMException {
|
public static ResultSet getCustomResult(String sql, List<Object> params) throws ORMException {
|
||||||
try {
|
try {
|
||||||
try (PreparedStatement ps = connection.getNativeConnection().prepareStatement(sql)) {
|
PreparedStatement ps = connection.getNativeConnection().prepareStatement(sql);
|
||||||
|
int i = 1;
|
||||||
int i = 1;
|
for (Object val : params) {
|
||||||
for (Object val : params) {
|
if (val instanceof Enum<?>) val = ((Enum<?>) val).name();
|
||||||
if (val instanceof Enum<?>) val = ((Enum<?>) val).name();
|
ps.setObject(i++, val);
|
||||||
ps.setObject(i++, val);
|
|
||||||
}
|
|
||||||
Log.debug(ps.toString());
|
|
||||||
|
|
||||||
return ps.executeQuery();
|
|
||||||
}
|
}
|
||||||
|
Log.debug(ps.toString());
|
||||||
|
|
||||||
|
ResultSet rs = ps.executeQuery();
|
||||||
|
|
||||||
|
ps.closeOnCompletion();
|
||||||
|
|
||||||
|
return rs;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new ORMException(e);
|
throw new ORMException(e);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user