aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2001-10-04 15:46:49 +0000
committerBruce Momjian <bruce@momjian.us>2001-10-04 15:46:49 +0000
commit60553337d72f73d663f46d0e6a62e8c81077b322 (patch)
tree2a5f7213f3b6da98c6c16d726b9d90948f952ede /src
parent96471bf1068ae757b988aa7678a70b1bb953ea66 (diff)
downloadpostgresql-60553337d72f73d663f46d0e6a62e8c81077b322.tar.gz
postgresql-60553337d72f73d663f46d0e6a62e8c81077b322.zip
Attached is a patch which deals with
select 'id' as xxx from table The issue is: When the driver gets a data type which does not map into the SQL.Types it attempts to load the object into a java object. Eventually throwing an exception indicating that the type "unknown" was not found. Since the backend defaults "unknown" types to text it was suggested that the jdbc driver do the same. This patch does just that. I have tested it on the above select statement as well as a small program that serializes, and deserializes a class Dave Cramer
Diffstat (limited to 'src')
-rw-r--r--src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java8
-rw-r--r--src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java8
2 files changed, 14 insertions, 2 deletions
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java b/src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java
index 8949eabc75b..eecce9c939c 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java
@@ -862,7 +862,13 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
case Types.VARBINARY:
return getBytes(columnIndex);
default:
- return connection.getObject(field.getPGType(), getString(columnIndex));
+ String type = field.getPGType();
+ // if the backend doesn't know the type then coerce to String
+ if (type.equals("unknown")){
+ return getString(columnIndex);
+ }else{
+ return connection.getObject(field.getPGType(), getString(columnIndex));
+ }
}
}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java b/src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java
index 9df669910da..feec8d08c26 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java
@@ -727,7 +727,13 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
case Types.VARBINARY:
return getBytes(columnIndex);
default:
- return connection.getObject(field.getPGType(), getString(columnIndex));
+ String type = field.getPGType();
+ // if the backend doesn't know the type then coerce to String
+ if (type.equals("unknown")){
+ return getString(columnIndex);
+ }else{
+ return connection.getObject(field.getPGType(), getString(columnIndex));
+ }
}
}