Examples of MetaResultSet


Examples of org.apache.jena.jdbc.metadata.results.MetaResultSet

     *
     * @throws SQLException
     */
    @Test
    public void meta_result_set_short_integer_02() throws SQLException {
        MetaResultSet results = new MetaResultSet(new ColumnInfo[] { new ShortIntegerColumn("Test",
                ResultSetMetaData.columnNullable, true) }, new Object[][] { { null } });

        Assert.assertTrue(results.next());
        short value = results.getShort(1);
        Assert.assertEquals((short) 0, value);
        Assert.assertTrue(results.wasNull());

        Assert.assertFalse(results.next());
        results.close();
        Assert.assertTrue(results.isClosed());
    }
View Full Code Here

Examples of org.apache.jena.jdbc.metadata.results.MetaResultSet

     *
     * @throws SQLException
     */
    @Test
    public void empty_meta_result_set_01() throws SQLException {
        MetaResultSet results = new MetaResultSet(new ColumnInfo[0]);

        // Check results metadata
        ResultSetMetaData metadata = results.getMetaData();
        Assert.assertEquals(0, metadata.getColumnCount());

        // Check results
        Assert.assertTrue(results.isBeforeFirst());
        Assert.assertFalse(results.next());
        Assert.assertTrue(results.isAfterLast());

        results.close();
        Assert.assertTrue(results.isClosed());
    }
View Full Code Here

Examples of org.apache.jena.jdbc.metadata.results.MetaResultSet

     *
     * @throws SQLException
     */
    @Test
    public void empty_meta_result_set_02() throws SQLException {
        MetaResultSet results = new MetaResultSet(new ColumnInfo[] { new StringColumn("Test", ResultSetMetaData.columnNullable) });

        // Check results metadata
        ResultSetMetaData metadata = results.getMetaData();
        Assert.assertEquals(1, metadata.getColumnCount());

        // Check results
        Assert.assertTrue(results.isBeforeFirst());
        Assert.assertFalse(results.next());
        Assert.assertTrue(results.isAfterLast());

        results.close();
        Assert.assertTrue(results.isClosed());
    }
View Full Code Here

Examples of org.apache.jena.jdbc.metadata.results.MetaResultSet

     * @throws SQLException
     */
    @Test(expected = SQLException.class)
    public void meta_result_set_bad_01() throws SQLException {
        // Every row must have the correct number of columns
        new MetaResultSet(new ColumnInfo[] { new StringColumn("Test", ResultSetMetaData.columnNullable) }, new Object[][] { {} });
    }
View Full Code Here

Examples of org.apache.jena.jdbc.metadata.results.MetaResultSet

        ColumnInfo[] columns = new ColumnInfo[] { new IntegerColumn("Test", ResultSetMetaData.columnNoNulls, true) };
        Object[][] rowData = new Object[rows][1];
        for (int i = 0; i < rowData.length; i++) {
            rowData[i][0] = (i + 1);
        }
        return new MetaResultSet(columns, rowData);
    }
View Full Code Here

Examples of org.apache.jena.jdbc.metadata.results.MetaResultSet

     *
     * @throws SQLException
     */
    @Test
    public void meta_result_set_movement_01() throws SQLException {
        MetaResultSet results = createMetaResultSet(0);
        Assert.assertTrue(results.isBeforeFirst());
        Assert.assertFalse(results.next());
        Assert.assertTrue(results.isAfterLast());

        results.close();
        Assert.assertTrue(results.isClosed());
    }
View Full Code Here

Examples of org.apache.jena.jdbc.metadata.results.MetaResultSet

     *
     * @throws SQLException
     */
    @Test
    public void meta_result_set_movement_02() throws SQLException {
        MetaResultSet results = createMetaResultSet(1);
        Assert.assertTrue(results.isBeforeFirst());

        // Move forwards
        Assert.assertTrue(results.next());
        Assert.assertTrue(results.isFirst());
        Assert.assertFalse(results.isBeforeFirst());
        Assert.assertTrue(results.isLast());
        Assert.assertFalse(results.isAfterLast());

        // Move to end
        Assert.assertFalse(results.next());
        Assert.assertTrue(results.isAfterLast());

        results.close();
        Assert.assertTrue(results.isClosed());
    }
View Full Code Here

Examples of org.apache.jena.jdbc.metadata.results.MetaResultSet

     *
     * @throws SQLException
     */
    @Test
    public void meta_result_set_movement_03() throws SQLException {
        MetaResultSet results = createMetaResultSet(1);
        Assert.assertTrue(results.isBeforeFirst());

        // Move forwards
        Assert.assertTrue(results.next());
        Assert.assertTrue(results.isFirst());
        Assert.assertFalse(results.isBeforeFirst());
        Assert.assertTrue(results.isLast());
        Assert.assertFalse(results.isAfterLast());

        // Move to end
        Assert.assertFalse(results.next());
        Assert.assertTrue(results.isAfterLast());
       
        // Move backwards
        Assert.assertTrue(results.previous());
        Assert.assertTrue(results.isFirst());
        Assert.assertFalse(results.isBeforeFirst());
        Assert.assertTrue(results.isLast());
        Assert.assertFalse(results.isAfterLast());
       
        results.close();
        Assert.assertTrue(results.isClosed());
    }
View Full Code Here

Examples of org.apache.jena.jdbc.metadata.results.MetaResultSet

     *
     * @throws SQLException
     */
    @Test
    public void meta_result_set_movement_04() throws SQLException {
        MetaResultSet results = createMetaResultSet(1);
        Assert.assertTrue(results.isBeforeFirst());

        // Move to absolute row
        Assert.assertTrue(results.absolute(1));
        Assert.assertTrue(results.isFirst());
        Assert.assertFalse(results.isBeforeFirst());
        Assert.assertTrue(results.isLast());
        Assert.assertFalse(results.isAfterLast());

        // Move to end
        Assert.assertFalse(results.next());
        Assert.assertTrue(results.isAfterLast());

        results.close();
        Assert.assertTrue(results.isClosed());
    }
View Full Code Here

Examples of org.apache.jena.jdbc.metadata.results.MetaResultSet

     *
     * @throws SQLException
     */
    @Test
    public void meta_result_set_string_01() throws SQLException {
        MetaResultSet results = new MetaResultSet(
                new ColumnInfo[] { new StringColumn("Test", ResultSetMetaData.columnNullable) }, new Object[][] { { "value" } });

        Assert.assertTrue(results.next());
        String value = results.getString(1);
        Assert.assertEquals("value", value);
        Assert.assertFalse(results.wasNull());

        Assert.assertFalse(results.next());
        results.close();
        Assert.assertTrue(results.isClosed());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.