mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 15:03:18 +00:00
[DS-734] Fix parsing problems from last check-in
git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5713 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -1197,94 +1197,93 @@ public class DatabaseManager
|
|||||||
String name = meta.getColumnName(i);
|
String name = meta.getColumnName(i);
|
||||||
int jdbctype = meta.getColumnType(i);
|
int jdbctype = meta.getColumnType(i);
|
||||||
|
|
||||||
if (results.wasNull())
|
switch (jdbctype)
|
||||||
{
|
{
|
||||||
row.setColumnNull(name);
|
case Types.BIT:
|
||||||
}
|
row.setColumn(name, results.getBoolean(i));
|
||||||
else
|
break;
|
||||||
{
|
|
||||||
switch (jdbctype)
|
|
||||||
{
|
|
||||||
case Types.BIT:
|
|
||||||
row.setColumn(name, results.getBoolean(i));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Types.INTEGER:
|
case Types.INTEGER:
|
||||||
if (isOracle)
|
if (isOracle)
|
||||||
|
{
|
||||||
|
long longValue = results.getLong(i);
|
||||||
|
if (longValue <= (long)Integer.MAX_VALUE)
|
||||||
{
|
{
|
||||||
long longValue = results.getLong(i);
|
row.setColumn(name, (int) longValue);
|
||||||
if (longValue <= (long)Integer.MAX_VALUE)
|
|
||||||
{
|
|
||||||
row.setColumn(name, (int) longValue);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
row.setColumn(name, longValue);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
row.setColumn(name, results.getInt(i));
|
row.setColumn(name, longValue);
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
row.setColumn(name, results.getInt(i));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case Types.NUMERIC:
|
case Types.NUMERIC:
|
||||||
case Types.DECIMAL:
|
case Types.DECIMAL:
|
||||||
case Types.BIGINT:
|
case Types.BIGINT:
|
||||||
row.setColumn(name, results.getLong(i));
|
row.setColumn(name, results.getLong(i));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Types.DOUBLE:
|
case Types.DOUBLE:
|
||||||
row.setColumn(name, results.getDouble(i));
|
row.setColumn(name, results.getDouble(i));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Types.CLOB:
|
case Types.CLOB:
|
||||||
if (isOracle)
|
if (isOracle)
|
||||||
|
{
|
||||||
|
row.setColumn(name, results.getString(i));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new IllegalArgumentException("Unsupported JDBC type: " + jdbctype);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Types.VARCHAR:
|
||||||
|
try
|
||||||
|
{
|
||||||
|
byte[] bytes = results.getBytes(i);
|
||||||
|
|
||||||
|
if (bytes != null)
|
||||||
|
{
|
||||||
|
String mystring = new String(results.getBytes(i), "UTF-8");
|
||||||
|
row.setColumn(name, mystring);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
row.setColumn(name, results.getString(i));
|
row.setColumn(name, results.getString(i));
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
catch (UnsupportedEncodingException e)
|
||||||
throw new IllegalArgumentException("Unsupported JDBC type: " + jdbctype);
|
{
|
||||||
}
|
log.error("Unable to parse text from database", e);
|
||||||
break;
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case Types.VARCHAR:
|
case Types.DATE:
|
||||||
try
|
row.setColumn(name, results.getDate(i));
|
||||||
{
|
break;
|
||||||
byte[] bytes = results.getBytes(i);
|
|
||||||
|
|
||||||
if (bytes != null)
|
case Types.TIME:
|
||||||
{
|
row.setColumn(name, results.getTime(i));
|
||||||
String mystring = new String(results.getBytes(i), "UTF-8");
|
break;
|
||||||
row.setColumn(name, mystring);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
row.setColumn(name, results.getString(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (UnsupportedEncodingException e)
|
|
||||||
{
|
|
||||||
log.error("Unable to parse text from database", e);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Types.DATE:
|
case Types.TIMESTAMP:
|
||||||
row.setColumn(name, results.getDate(i));
|
row.setColumn(name, results.getTimestamp(i));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Types.TIME:
|
default:
|
||||||
row.setColumn(name, results.getTime(i));
|
throw new IllegalArgumentException("Unsupported JDBC type: " + jdbctype);
|
||||||
break;
|
}
|
||||||
|
|
||||||
case Types.TIMESTAMP:
|
// Determines if the last column was null, and sets the tablerow accordingly
|
||||||
row.setColumn(name, results.getTimestamp(i));
|
if (results.wasNull())
|
||||||
break;
|
{
|
||||||
|
row.setColumnNull(name);
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException("Unsupported JDBC type: " + jdbctype);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -320,7 +320,7 @@ public class TableRow
|
|||||||
throw new IllegalArgumentException("No such column " + column);
|
throw new IllegalArgumentException("No such column " + column);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isColumnNull(column))
|
if (isColumnNullCanonicalized(column))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user