aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/jdbc
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2001-05-16 17:22:25 +0000
committerBruce Momjian <bruce@momjian.us>2001-05-16 17:22:25 +0000
commit7934c93cbed4471e55924631fa92a83b4c32e395 (patch)
tree016f115872c4a0ae8dcbb713dfe6793fcc20464a /src/interfaces/jdbc
parent37b006e074f20676a2be6854047c6982b9bb91b7 (diff)
downloadpostgresql-7934c93cbed4471e55924631fa92a83b4c32e395.tar.gz
postgresql-7934c93cbed4471e55924631fa92a83b4c32e395.zip
This patch fixes a bug which occurs when setObject(1,obj) is called and obj
is of type Object, and is null Dave Cramer
Diffstat (limited to 'src/interfaces/jdbc')
-rw-r--r--src/interfaces/jdbc/org/postgresql/jdbc1/PreparedStatement.java8
-rw-r--r--src/interfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java8
2 files changed, 16 insertions, 0 deletions
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)