Commit 5ded00bd authored by jburke.cadc's avatar jburke.cadc
Browse files

If the table value representing the Column size is null, set Column size to null, not 0.

Use the correct Formatter interface in ResultSetIterator.
Handle java.sql.Array return types in IntArrayFormatter.

git-svn-id: https://opencadc.googlecode.com/svn/trunk@199 728ff76a-78ac-11de-a72b-d90af8dea425
parent 99981d51
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -69,12 +69,26 @@

package ca.nrc.cadc.tap.writer.formatter;

import java.sql.SQLException;

public class IntArrayFormatter implements Formatter
{
    public String format(Object object)
    {
        if (object == null)
            return "";
        if (object instanceof java.sql.Array)
        {
            try
            {
                java.sql.Array array = (java.sql.Array) object;
                object = (int[]) array.getArray();
            }
            catch (SQLException e)
            {
                throw new IllegalArgumentException("Error accessing array data for " + object.getClass().getCanonicalName(), e);
            }
        }
        if (!(object instanceof int[]))
            throw new IllegalArgumentException("Expecting int[], " + object.getClass().getCanonicalName() + " not supported.");