1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-06 19:59:18 +03:00

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

is of type Object, and is null

Dave Cramer
This commit is contained in:
Bruce Momjian 2001-05-16 17:22:25 +00:00
parent 37b006e074
commit 7934c93cbe
2 changed files with 16 additions and 0 deletions

View File

@ -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)

View File

@ -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)