mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-02 21:26:49 +02:00
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
This commit is contained in:
parent
96471bf106
commit
60553337d7
@ -862,9 +862,15 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
case Types.VARBINARY:
|
case Types.VARBINARY:
|
||||||
return getBytes(columnIndex);
|
return getBytes(columnIndex);
|
||||||
default:
|
default:
|
||||||
|
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));
|
return connection.getObject(field.getPGType(), getString(columnIndex));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the value of a column in the current row as a Java object
|
* Get the value of a column in the current row as a Java object
|
||||||
|
@ -727,9 +727,15 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
case Types.VARBINARY:
|
case Types.VARBINARY:
|
||||||
return getBytes(columnIndex);
|
return getBytes(columnIndex);
|
||||||
default:
|
default:
|
||||||
|
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));
|
return connection.getObject(field.getPGType(), getString(columnIndex));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the value of a column in the current row as a Java object
|
* Get the value of a column in the current row as a Java object
|
||||||
|
Loading…
Reference in New Issue
Block a user