diff --git a/src/interfaces/jdbc/org/postgresql/jdbc1/PreparedStatement.java b/src/interfaces/jdbc/org/postgresql/jdbc1/PreparedStatement.java index 70a0b91dbd5..84efeb09a06 100644 --- a/src/interfaces/jdbc/org/postgresql/jdbc1/PreparedStatement.java +++ b/src/interfaces/jdbc/org/postgresql/jdbc1/PreparedStatement.java @@ -455,6 +455,10 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta */ public void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException { + if (x == null){ + setNull(parameterIndex,Types.OTHER); + return; + } switch (targetSqlType) { case Types.TINYINT: @@ -506,6 +510,10 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta */ public void setObject(int parameterIndex, Object x) throws SQLException { + if (x == null){ + setNull(parameterIndex,Types.OTHER); + return; + } if (x instanceof String) setString(parameterIndex, (String)x); else if (x instanceof BigDecimal) diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java b/src/interfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java index 5cf51527552..f204490533c 100644 --- a/src/interfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java +++ b/src/interfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java @@ -515,6 +515,10 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta */ public void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException { + if (x == null){ + setNull(parameterIndex,Types.OTHER); + return; + } switch (targetSqlType) { case Types.TINYINT: @@ -566,6 +570,10 @@ public class PreparedStatement extends Statement implements java.sql.PreparedSta */ public void setObject(int parameterIndex, Object x) throws SQLException { + if (x == null){ + setNull(parameterIndex,Types.OTHER); + return; + } if (x instanceof String) setString(parameterIndex, (String)x); else if (x instanceof BigDecimal)