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

Commit8af0ea9

Browse files
committed
Got two patches that were found by folks on the Castor list, that we'd like to
submit. These were done for the jdbc2 driver. The first one is for supportof the Types.BIT in the PreparedStatement class. The following lines need to beinserted in the switch statment, at around line 530:(Prepared statment, line 554, before the default: switchcase Types.BIT: if (x instanceof Boolean) { set(parameterIndex, ((Boolean)x).booleanValue() ? "TRUE" : "FALSE"); } else { throw new PSQLException("postgresql.prep.type"); } break;The second one is dealing with blobs,inserted in PreparedStatemant.java (After previous patch line, 558): case Types.BINARY: case Types.VARBINARY: setObject(parameterIndex,x); break;and in ResultSet.java (Around line 857): case Types.BINARY: case Types.VARBINARY: return getBytes(columnIndex);Ned Wolpert <ned.wolpert@knowledgenet.com>
1 parent05150e2 commit8af0ea9

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,17 @@ public void setObject(int parameterIndex, Object x, int targetSqlType, int scale
489489
caseTypes.TIMESTAMP:
490490
setTimestamp(parameterIndex, (Timestamp)x);
491491
break;
492+
caseTypes.BIT:
493+
if (xinstanceofBoolean) {
494+
set(parameterIndex, ((Boolean)x).booleanValue() ?"TRUE" :"FALSE");
495+
}else {
496+
thrownewPSQLException("postgresql.prep.type");
497+
}
498+
break;
499+
caseTypes.BINARY:
500+
caseTypes.VARBINARY:
501+
setObject(parameterIndex,x);
502+
break;
492503
caseTypes.OTHER:
493504
setString(parameterIndex, ((PGobject)x).getValue());
494505
break;

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,9 @@ public Object getObject(int columnIndex) throws SQLException
806806
returngetTime(columnIndex);
807807
caseTypes.TIMESTAMP:
808808
returngetTimestamp(columnIndex);
809+
caseTypes.BINARY:
810+
caseTypes.VARBINARY:
811+
returngetBytes(columnIndex);
809812
default:
810813
returnconnection.getObject(field.getTypeName(),getString(columnIndex));
811814
}

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,17 @@ public void setObject(int parameterIndex, Object x, int targetSqlType, int scale
549549
caseTypes.TIMESTAMP:
550550
setTimestamp(parameterIndex, (Timestamp)x);
551551
break;
552+
caseTypes.BIT:
553+
if (xinstanceofBoolean) {
554+
set(parameterIndex, ((Boolean)x).booleanValue() ?"TRUE" :"FALSE");
555+
}else {
556+
thrownewPSQLException("postgresql.prep.type");
557+
}
558+
break;
559+
caseTypes.BINARY:
560+
caseTypes.VARBINARY:
561+
setObject(parameterIndex,x);
562+
break;
552563
caseTypes.OTHER:
553564
setString(parameterIndex, ((PGobject)x).getValue());
554565
break;

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,9 @@ public Object getObject(int columnIndex) throws SQLException
855855
returngetTime(columnIndex);
856856
caseTypes.TIMESTAMP:
857857
returngetTimestamp(columnIndex);
858+
caseTypes.BINARY:
859+
caseTypes.VARBINARY:
860+
returngetBytes(columnIndex);
858861
default:
859862
returnconnection.getObject(field.getTypeName(),getString(columnIndex));
860863
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp