Skip to content

Commit

Permalink
GrokConnect: Correct null value set
Browse files Browse the repository at this point in the history
  • Loading branch information
PavloPolovyi committed Jan 8, 2025
1 parent 933915d commit ced07b6
Showing 1 changed file with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,21 @@ else if (param.propertyType.equals(Types.LIST) && param.propertySubType.equals(T
else if (param.propertyType.equals(Types.BIG_INT) && param.value != null)
statement.setLong(n + i + 1, Long.parseLong(param.value.toString()));
else {
// if (param.value == null) {
// statement.setNull(n + i + 1, java.sql.Types.VARCHAR);
// }
// else
statement.setObject(n + i + 1, param.value);
if (param.value == null) {
switch (param.propertyType) {
case Types.INT:
case Types.FLOAT:
statement.setNull(n + i + 1, java.sql.Types.NUMERIC);
break;
case Types.BIG_INT:
statement.setNull(n + i + 1, java.sql.Types.BIGINT);
default:
statement.setNull(n + i + 1, java.sql.Types.VARCHAR);
break;
}
}
else
statement.setObject(n + i + 1, param.value);
}
}
queryLogger.debug(EventType.STATEMENT_PARAMETERS_REPLACEMENT.getMarker(EventType.Stage.END), "Replaced designated query parameters");
Expand Down

0 comments on commit ced07b6

Please sign in to comment.