Skip to content

Commit

Permalink
Issue helidon-io#8613 - Review notes applied.
Browse files Browse the repository at this point in the history
Signed-off-by: Tomáš Kraus <tomas.kraus@oracle.com>
  • Loading branch information
Tomas-Kraus committed Jul 24, 2024
1 parent af38817 commit c974591
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public abstract class DbClientBuilderBase<T extends DbClientBuilderBase<T>>
*/
protected DbClientBuilderBase() {
this.clientServices = new LinkedList<>();
this.missingMapParametersAsNull = false;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ public abstract static class BuilderBase<B extends BuilderBase<B, T>, T extends
* Creates an instance of base builder for {@link DbClientContext}.
*/
protected BuilderBase() {
this.missingMapParametersAsNull = false;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,16 @@ private PreparedStatement prepareNamedStatement(String stmtName, String stmt, Ma
for (String name : namesOrder) {
if (parameters.containsKey(name)) {
Object value = parameters.get(name);
LOGGER.log(Level.TRACE, String.format("Mapped parameter %d: %s -> %s", i, name, value));
if (LOGGER.isLoggable(Level.TRACE)) {
LOGGER.log(Level.TRACE, String.format("Mapped parameter %d: %s -> %s", i, name, value));
}
setParameter(preparedStatement, i, value);
i++;
} else {
if (context().missingMapParametersAsNull()) {
LOGGER.log(Level.TRACE, String.format("Mapped parameter %d: %s -> null", i, name));
if (LOGGER.isLoggable(Level.TRACE)) {
LOGGER.log(Level.TRACE, String.format("Mapped parameter %d: %s -> null", i, name));
}
setParameter(preparedStatement, i, null);
i++;
} else {
Expand All @@ -174,7 +178,9 @@ private PreparedStatement prepareIndexedStatement(String stmtName, String stmt,
preparedStatement = prepareStatement(stmtName, stmt);
int i = 1; // JDBC set position parameter starts from 1.
for (Object value : parameters) {
LOGGER.log(Level.TRACE, String.format("Indexed parameter %d: %s", i, value));
if (LOGGER.isLoggable(Level.TRACE)) {
LOGGER.log(Level.TRACE, String.format("Indexed parameter %d: %s", i, value));
}
setParameter(preparedStatement, i, value);
i++;
}
Expand Down

0 comments on commit c974591

Please sign in to comment.