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

Commit6055333

Browse files
committed
Attached is a patch which deals with
select 'id' as xxx from tableThe issue is:When the driver gets a data type which does not map into the SQL.Typesit attempts to load the object into a java object. Eventually throwingan exception indicating that the type "unknown" was not found.Since the backend defaults "unknown" types to text it was suggested thatthe jdbc driver do the same.This patch does just that.I have tested it on the above select statement as well as a smallprogram that serializes, and deserializes a classDave Cramer
1 parent96471bf commit6055333

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,13 @@ public Object getObject(int columnIndex) throws SQLException
862862
caseTypes.VARBINARY:
863863
returngetBytes(columnIndex);
864864
default:
865-
returnconnection.getObject(field.getPGType(),getString(columnIndex));
865+
Stringtype =field.getPGType();
866+
// if the backend doesn't know the type then coerce to String
867+
if (type.equals("unknown")){
868+
returngetString(columnIndex);
869+
}else{
870+
returnconnection.getObject(field.getPGType(),getString(columnIndex));
871+
}
866872
}
867873
}
868874

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,13 @@ public Object getObject(int columnIndex) throws SQLException
727727
caseTypes.VARBINARY:
728728
returngetBytes(columnIndex);
729729
default:
730-
returnconnection.getObject(field.getPGType(),getString(columnIndex));
730+
Stringtype =field.getPGType();
731+
// if the backend doesn't know the type then coerce to String
732+
if (type.equals("unknown")){
733+
returngetString(columnIndex);
734+
}else{
735+
returnconnection.getObject(field.getPGType(),getString(columnIndex));
736+
}
731737
}
732738
}
733739

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp