Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: EXPOSED-263 Null arg parameter in exec() throws if logger enabled (
#1973) The type for exec() parameterized arguments is declared as args: Iterable<Pair<IColumnType, Any?>>, so passing null as the second element correctly sets the statement parameter to SQL NULL. But if a logger is enabled, this exception is thrown: java.lang.IllegalStateException: NULL in non-nullable column. This is because all IColumnType default to being not nullable and fail the check in `ColumnType.valueToString()` when attempting to parse the parameter value. This exception can be avoided by always providing SQL NULL directly, via Op.nullOp<T>(). But given the type hints, the accepted parameter values should match what would be accepted by any other DSL statement. Even if the column in the Exposed table object is declared as being `nullable()`, the column type in `exec()` has no knowledge of this because it is meant to accept plain SQL using an anonymous Statement object. This fix sets the nullable parameter of any column type in args to true so that no exception will be thrown when the logger invokes valueToString().
- Loading branch information