Skip to content

Commit

Permalink
Update JdbcUtil.java
Browse files Browse the repository at this point in the history
  • Loading branch information
youfanx committed Nov 14, 2024
1 parent 6f93a7d commit ec1067f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions rxlib-x/src/main/java/org/rx/jdbc/JdbcUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,16 @@ public static void print(ResultSet resultSet) {
}
}

@SneakyThrows
public static <T> T executeScalar(ResultSet resultSet) {
try (ResultSet rs = resultSet) {
if (rs.next()) {
return (T) rs.getObject(1);
}
return null;
}
}

public static final BiFunc<String, String> TO_CAMEL_COLUMN_MAPPING = p -> CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, p);

public static <T> List<T> readAs(ResultSet resultSet, Type type) {
Expand Down

0 comments on commit ec1067f

Please sign in to comment.