Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7934c93

Browse files
committed
This patch fixes a bug which occurs when setObject(1,obj) is called and obj
is of type Object, and is nullDave Cramer
1 parent37b006e commit7934c93

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

‎src/interfaces/jdbc/org/postgresql/jdbc1/PreparedStatement.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,10 @@ public void clearParameters() throws SQLException
455455
*/
456456
publicvoidsetObject(intparameterIndex,Objectx,inttargetSqlType,intscale)throwsSQLException
457457
{
458+
if (x ==null){
459+
setNull(parameterIndex,Types.OTHER);
460+
return;
461+
}
458462
switch (targetSqlType)
459463
{
460464
caseTypes.TINYINT:
@@ -506,6 +510,10 @@ public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQ
506510
*/
507511
publicvoidsetObject(intparameterIndex,Objectx)throwsSQLException
508512
{
513+
if (x ==null){
514+
setNull(parameterIndex,Types.OTHER);
515+
return;
516+
}
509517
if (xinstanceofString)
510518
setString(parameterIndex, (String)x);
511519
elseif (xinstanceofBigDecimal)

‎src/interfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,10 @@ public void clearParameters() throws SQLException
515515
*/
516516
publicvoidsetObject(intparameterIndex,Objectx,inttargetSqlType,intscale)throwsSQLException
517517
{
518+
if (x ==null){
519+
setNull(parameterIndex,Types.OTHER);
520+
return;
521+
}
518522
switch (targetSqlType)
519523
{
520524
caseTypes.TINYINT:
@@ -566,6 +570,10 @@ public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQ
566570
*/
567571
publicvoidsetObject(intparameterIndex,Objectx)throwsSQLException
568572
{
573+
if (x ==null){
574+
setNull(parameterIndex,Types.OTHER);
575+
return;
576+
}
569577
if (xinstanceofString)
570578
setString(parameterIndex, (String)x);
571579
elseif (xinstanceofBigDecimal)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp