{
propertyType = rs.getInt(colItemType);
if (propertyType != type)
{
throw new InvalidPropertyTypeException();
}
switch (type)
{
case PropertySet.BOOLEAN:
int boolVal = rs.getInt(colNumber);
o = new Boolean(boolVal == 1);
break;
case PropertySet.DATA:
{
//Ugly fix for old type of column in oracle which we used to run LONG RAW. We converted to blob and the code is different
String columnTypeName = rs.getMetaData().getColumnTypeName(4);
logger.info("columnTypeName: " + columnTypeName);
if(this.driverClassName.indexOf("oracle") > -1 && columnTypeName != null && columnTypeName.indexOf("RAW") == -1)
{
//System.out.println("Getting as blob");
Blob blob = rs.getBlob(colData);
//System.out.println("blob:" + blob);
if(blob != null)
{
try
{
InputStream in = blob.getBinaryStream();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[(int)blob.length()];
InputStream is = in;
while (is.read(buffer) > 0) {
baos.write(buffer);
}
baos.flush();
String s = baos.toString();
//System.out.println("S: " + s + "...");
o = s.getBytes();
}
catch (Exception e)
{
e.printStackTrace();
}
}
else
{
o = null;
}
}
else
{
o = rs.getBytes(colData);
}
break;
}
case PropertySet.DATE:
o = rs.getTimestamp(colDate);
break;
case PropertySet.DOUBLE:
o = new Double(rs.getDouble(colFloat));
break;
case PropertySet.INT:
o = new Integer(rs.getInt(colNumber));
break;
case PropertySet.LONG:
o = new Long(rs.getLong(colNumber));
break;
case PropertySet.STRING:
o = rs.getString(colString);
break;
default:
throw new InvalidPropertyTypeException("JDBCPropertySet doesn't support this type yet.");
}
}
rs.close();
ps.close();