Skip to content

Commit

Permalink
#65 Setting parameter to SQL NULL instead of String
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrkot committed Jul 4, 2018
1 parent b4e2298 commit 8662a7b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/com/jcabi/jdbc/PrepareArgs.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Types;
import java.util.Collection;
import java.util.Collections;

Expand Down Expand Up @@ -68,7 +69,7 @@ public void prepare(final PreparedStatement stmt) throws SQLException {
int pos = 1;
for (final Object arg : this.args) {
if (arg == null) {
stmt.setString(pos, null);
stmt.setNull(pos, Types.NULL);
} else if (arg instanceof Long) {
stmt.setLong(pos, Long.class.cast(arg));
} else if (arg instanceof Boolean) {
Expand Down

0 comments on commit 8662a7b

Please sign in to comment.