Skip to content
Snippets Groups Projects
Commit fca60e50 authored by gmantele's avatar gmantele
Browse files

[TAP] Convert ResultSet's BigInteger values in Long.

parent dad7c470
No related branches found
No related tags found
No related merge requests found
......@@ -20,7 +20,7 @@ package tap.data;
*/
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Date;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
......@@ -730,6 +730,9 @@ public class ResultSetTableIterator implements TableIterator {
// but this type can not be supported in FITS and VOTable):
else if (colValue instanceof BigDecimal)
colValue = ((BigDecimal)colValue).doubleValue();
// if the type is a BigInteger object (as BigDecimal, this type can not be supported in FITS and VOTable):
else if (colValue instanceof BigInteger)
colValue = ((BigInteger)colValue).longValue();
// if the type is Integer but it is declared as a SMALLINT cast the value (absolutely required for the FITS format):
else if (colValue instanceof Integer && colType != null && colValue != null && colType.type == DBDatatype.SMALLINT)
colValue = new Short(((Integer)colValue).shortValue());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment