add null as allowed value in SQL statement

This commit is contained in:
Jörg Prante 2023-08-21 09:25:05 +02:00
parent 35a058abe0
commit 98819d6577
2 changed files with 7 additions and 3 deletions

View file

@ -1,5 +1,5 @@
group = org.xbib group = org.xbib
name = database name = database
version = 1.4.1 version = 1.4.2
org.gradle.warning.mode = ALL org.gradle.warning.mode = ALL

View file

@ -485,8 +485,10 @@ public class DatabaseImpl implements Database {
sql.argLocalDate(k, (LocalDate) v); sql.argLocalDate(k, (LocalDate) v);
} else if (v instanceof LocalDateTime) { } else if (v instanceof LocalDateTime) {
sql.argLocalDateTime(k, (LocalDateTime) v); sql.argLocalDateTime(k, (LocalDateTime) v);
} else if (v == null) {
sql.argNull(k);
} else { } else {
throw new DatabaseException("unknown type for param: " + (v != null ? v.getClass() : "null")); throw new DatabaseException("unknown type for param: " + v.getClass());
} }
}); });
} }
@ -508,8 +510,10 @@ public class DatabaseImpl implements Database {
sql.argLocalDate(k, (LocalDate) v); sql.argLocalDate(k, (LocalDate) v);
} else if (v instanceof LocalDateTime) { } else if (v instanceof LocalDateTime) {
sql.argLocalDateTime(k, (LocalDateTime) v); sql.argLocalDateTime(k, (LocalDateTime) v);
} else if (v == null) {
sql.argNull(k);
} else { } else {
throw new DatabaseException("unknown type for param: " + (v != null ? v.getClass() : "null")); throw new DatabaseException("unknown type for param: " + v.getClass());
} }
}); });
} }