Package java.sql

Examples of java.sql.ResultSet.last()


        rset.updateInt(1, 5);
        rset.updateString(2, "insert5");
        rset.insertRow();
        rset.moveToCurrentRow();
        assertEquals(1, rset.getInt(1));
        assertTrue(rset.last());
        assertEquals(5, rset.getInt(1));

        /*
         * Because the above called rset.last(), the inserted row which ID is 6
         * becomes invisible to JdbcRowSet.
View Full Code Here


    public int getRowCount() throws SQLException {
        ResultSet rs = getResultSet();
        synchronized (rs) {
            int currentRow = rs.getRow();
            rs.last();
            int count = rs.getRow();
            if (currentRow > 0) {
                rs.absolute(currentRow);
            }
            else {
View Full Code Here

        warning = conn.getWarnings();
        assertNull(warning);

        rs = ps_i_r.executeQuery();
        // make sure it's scrollable
        rs.last();
        rs.close();
        ps_i_r.close();

        // Check setMaxRows()/getMaxRows()
        assertEquals(0, s_i_r.getMaxRows());
View Full Code Here

        assertFalse(rs.next());
        rs.close();
        // Jump around and verify setMaxRows() works.
        rs = s_i_r.executeQuery("values 1, 2, 3, 4, 5, 6");
        assertNotNull(rs);
        assertTrue(rs.last());

        // Iterate backwards thru RS, expect only 4 more (5 total) rows.
        for (int index = 1; index < 5; index++) {
            assertTrue(rs.previous());
        }
View Full Code Here

        }
        // We should not see another row (only maxRows, not total)
        assertFalse(rs.previous());

        // Start from last and verify maxRows
        assertTrue(rs.last());

        // Iterate backwards thru RS, expect only (maxRows - 1) more rows.
        for (int index = 1; index < maxRows; index++) {
            assertTrue(rs.previous());
            assertEquals((maxRows - index), rs.getInt(1));
View Full Code Here

            assertEquals((maxRows - index), rs.getInt(1));

        }
        // We should not see another row (only 5, not 6)
        assertFalse(rs.previous());
        rs.last();
        int rows = rs.getRow();

        rs.absolute(rows / 2);
        assertFalse(rs.relative(-1 * (rows)));
        assertTrue(rs.isBeforeFirst());
View Full Code Here

        // move to before first
        rs.beforeFirst();
        assertTrue(rs.isBeforeFirst());
        // move to last row
        assertTrue(rs.last());
        assertTrue(rs.isLast());
        assertFalse(rs.isAfterLast());
        assertEquals(6, rs.getInt(1));
        assertFalse("not expecting to find another row", rs.next());
        assertTrue(rs.isAfterLast());
View Full Code Here

                                ResultSet.CONCUR_UPDATABLE);
        final ResultSet rs =
            stmt.executeQuery("SELECT * from " +
                              BLOBDataModelSetup.getBlobTableName());
        println("Last");
        rs.last();
       
        final int newVal = rs.getInt(1) + 11;
        final int newSize = rs.getInt(2) / 2;
        testUpdateBlobWithPositionedUpdate(rs, newVal, newSize);

View Full Code Here

                                ResultSet.CONCUR_UPDATABLE);
        final ResultSet rs =
            stmt.executeQuery("SELECT data,val,length from " +
                              BLOBDataModelSetup.getBlobTableName());
        println("Last");
        rs.last();
       
        final int newVal = rs.getInt(2) + 11;
        final int newSize = rs.getInt(3) / 2;
        testUpdateBlobWithResultSetMethods(rs, newVal, newSize);
       
View Full Code Here

        final ResultSet rs =
            stmt.executeQuery("SELECT data from " +
                              BLOBDataModelSetup.getBlobTableName() +
                              " WHERE val= " + BLOBDataModelSetup.bigVal);
        println("Last");
        rs.last();
       
        final int newVal = BLOBDataModelSetup.bigVal * 2;
        final int newSize = BLOBDataModelSetup.bigSize / 2;
        testUpdateBlobWithPositionedUpdate(rs, newVal, newSize);

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.