src/main/java/de/uapcore/lightpit/dao/Functions.java

changeset 150
822b7e3d064d
parent 138
e2aa673dd473
equal deleted inserted replaced
149:30b840ed8c0e 150:822b7e3d064d
36 36
37 /** 37 /**
38 * Some DAO utilities. 38 * Some DAO utilities.
39 */ 39 */
40 public final class Functions { 40 public final class Functions {
41
42 public static String getSafeString(ResultSet rs, String column) throws SQLException {
43 return Optional.ofNullable(rs.getString(column)).orElse("");
44 }
41 45
42 public static void setStringOrNull(PreparedStatement stmt, int index, String str) throws SQLException { 46 public static void setStringOrNull(PreparedStatement stmt, int index, String str) throws SQLException {
43 if (str == null || str.isBlank()) { 47 if (str == null || str.isBlank()) {
44 stmt.setNull(index, Types.VARCHAR); 48 stmt.setNull(index, Types.VARCHAR);
45 } else { 49 } else {

mercurial