From 8662a7be25c3bc3b3d3e86b27cd245c68b381666 Mon Sep 17 00:00:00 2001 From: Piotr Kotlicki Date: Wed, 4 Jul 2018 10:40:48 +0200 Subject: [PATCH] #65 Setting parameter to SQL NULL instead of String --- src/main/java/com/jcabi/jdbc/PrepareArgs.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/jcabi/jdbc/PrepareArgs.java b/src/main/java/com/jcabi/jdbc/PrepareArgs.java index e86313d..99138cd 100644 --- a/src/main/java/com/jcabi/jdbc/PrepareArgs.java +++ b/src/main/java/com/jcabi/jdbc/PrepareArgs.java @@ -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; @@ -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) {