Package javax.sql.rowset.serial

Examples of javax.sql.rowset.serial.SerialArray


            throw new SQLException();
        }
        if (params == null) {
            throw new SQLException();
        }
        params.put(Integer.valueOf(parameterIndex - 1), new SerialArray(array));
    }
View Full Code Here


public class SerialArrayFactory implements SerialLocatorFactory<Array>
{
  @Override
  public Array createSerial(Array array) throws SQLException
  {
    return new SerialArray(array);
  }
View Full Code Here

        }

        // convert to serializable object
        if (type.isInstance(value)) {
            if (type.equals(Array.class) && !(value instanceof SerialArray)) {
                return new SerialArray((Array) value);
            }

            if (type.equals(Blob.class) && !(value instanceof SerialBlob)) {
                return new SerialBlob((Blob) value);
            }
View Full Code Here

        testElements = new Object[4];
        testElements[0] = "test1";
        testElements[1] = "test2";
        testElements[2] = new SQLException();
        testElements[3] = new HashMap();
        sa = new SerialArray(mock);
        map = new HashMap<String, Class<?>>();
        map.put("String", MockStringSQLData.class);
        map.put("Object", null);
        badmap = new HashMap<String, Class<?>>();
        badmap.put("Something", HashMap.class);
View Full Code Here

        badmap = new HashMap<String, Class<?>>();
        badmap.put("Something", HashMap.class);
    }

    public void testConstructor_ObjectArray() throws SQLException {
        assertNotNull(new SerialArray(new SQLArray()));

        // OK
        sa = new SerialArray(mock);
        // array.getArray should not return null
        try {
            sa = new SerialArray(new MockNullArray());
            fail("should throw SQLException");
        } catch (SQLException e) {
            // expected
        }
        testElements = new Object[5];
        testElements[0] = "test1";
        testElements[1] = "test2";
        testElements[2] = new SQLException();
        testElements[3] = new HashMap();
        try {
            sa = new SerialArray(mock);
            fail("should throw NullPointerException");
        } catch (NullPointerException e) {
            // expected
        }
        testElements[4] = new Object();
        try {
            sa = new SerialArray(mock);
            // RI fail here
            fail("should throw SQLException");
        } catch (SQLException e) {
            // expected
        }
View Full Code Here

    }

    public void testConstructor_IntArray() throws SQLException {
        mock.basetype = Types.INTEGER;
        // OK
        sa = new SerialArray(mock);
        // array.getArray should not return null
        try {
            sa = new SerialArray(new MockNullArray());
            fail("should throw SQLException");
        } catch (SQLException e) {
            // expected
        }
        testElements = new Object[5];
        testElements[0] = "test1";
        testElements[1] = "test2";
        testElements[2] = new SQLException();
        testElements[3] = new HashMap();
        // OK for integer
        sa = new SerialArray(mock);

        testElements[4] = new Object();
        sa = new SerialArray(mock);
    }
View Full Code Here

        sa = new SerialArray(mock);
    }

    public void testConstructor_map() throws SQLException {
        try {
            sa = new SerialArray(mock, null);
            fail("should throw SQLException");
        } catch (SQLException e) {
            // expected
        }
        // array.getArray should not return null
        try {
            sa = new SerialArray(new MockNullArray(), null);
            fail("should throw SQLException");
        } catch (SQLException e) {
            // expected
        }
        // OK
        sa = new SerialArray(mock, map);
        sa = new SerialArray(mock, badmap);
    }
View Full Code Here

            throw new SQLException();
        }
        if (params == null) {
            throw new SQLException();
        }
        params.put(Integer.valueOf(parameterIndex - 1), new SerialArray(array));
    }
View Full Code Here

        }

        // convert to serializable object
        if (type.isInstance(value)) {
            if (type.equals(Array.class) && !(value instanceof SerialArray)) {
                return new SerialArray((Array) value);
            }

            if (type.equals(Blob.class) && !(value instanceof SerialBlob)) {
                return new SerialBlob((Blob) value);
            }
View Full Code Here

            throw new SQLException();
        }
        if (params == null) {
            throw new SQLException();
        }
        params.put(Integer.valueOf(parameterIndex - 1), new SerialArray(array));
    }
View Full Code Here

TOP

Related Classes of javax.sql.rowset.serial.SerialArray

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.