Commit 7934c93c authored by Bruce Momjian's avatar Bruce Momjian

This patch fixes a bug which occurs when setObject(1,obj) is called and obj

is of type Object, and is null

Dave Cramer
parent 37b006e0
......@@ -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)
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment