Package java.sql

Examples of java.sql.ResultSet.previous()


        catch (SQLException e)
        {
        }
        try
        {
            rs.previous();
            fail("previous() on a TYPE_FORWARD_ONLY resultset did not throw an exception");
        }
        catch (SQLException e)
        {
        }
View Full Code Here


    public void testBackward() throws SQLException
    {
        Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
        ResultSet rs = stmt.executeQuery("SELECT * FROM testrs");
        rs.afterLast();
        assertTrue(rs.previous());
        rs.close();
        stmt.close();
    }

    public void testAbsolute() throws SQLException
View Full Code Here

        assertTrue(rs.next());
        assertEquals(1, rs.getRow());

        assertTrue(!rs.absolute(10));
        assertEquals(0, rs.getRow());
        assertTrue(rs.previous());
        assertEquals(6, rs.getRow());

        stmt.close();
    }
View Full Code Here

          if (rs.isLast()) {
            rs.beforeFirst();
            LOGGER.logp(Level.FINE, CLASS_NAME, METHOD, "Doc ID#" + unid +
                " is at the end of collection; reset to first record");
          } else {
            rs.previous();
            LOGGER.logp(Level.FINE, CLASS_NAME, METHOD,
                "Collection started with " + unid + " document ID");
          }
        } else {
          LOGGER.logp(Level.FINE, CLASS_NAME, METHOD,
View Full Code Here

                + "\" at position "
                + (res.getRow() - 1), res.getString(
                    "COLUMN_NAME"), columnNames[res.getRow() - 1]);
        }

        res.previous();
        assertEquals("not enough columns in table \"" + tableName + "\"",
                     columnNames.length, res.getRow());
    }

    /**
 
View Full Code Here

        currentPosition = rs.getRow();
        rs.moveToInsertRow();
        rs.updateInt(1, currentPosition + 1000);
        rs.afterLast();
        assertTrue("isAfterLast() should return true", rs.isAfterLast());
        rs.previous();
        assertEquals("CurrentPosition should be " + lastRow,
                rs.getRow(), lastRow);
        assertTrue("isLast() should return true", rs.isLast());

        // Test that it is possible to insert a row and move back to current row
View Full Code Here

        assertEquals("CurrentPosition should be " + lastRow,
                rs.getRow(), lastRow);
        assertTrue("isLast() should return true", rs.isLast());

        // Test that it is possible to insert a row and move back to current row
        rs.previous();
        currentPosition = rs.getRow();
        rs.moveToInsertRow();
        rs.updateInt(1, currentPosition + 1000);
        rs.insertRow();
        rs.moveToCurrentRow();
View Full Code Here

        ResultSet rs =
            s.executeQuery("select * from t1 where a=1 or a=2");
       
        rs.next();
        rs.next();
        rs.previous();
        verifyTuple(rs);
        updateTuple(rs);
        s.close();
    }
   
View Full Code Here

        ResultSet rs = s.executeQuery
            ("select * from t1 where a=1 or a=2 for update");
       
        rs.next();
        rs.next();
        rs.previous();
        verifyTuple(rs);
        updateTuple(rs);
        rs.close();
        s.close();
    }
View Full Code Here

        s.setCursorName(getNextCursorName());
        ResultSet rs = s.executeQuery("select * from t1");
       
        rs.last();
        rs.next();
        while(rs.previous()) {
            // Update the key of every second row.
            int key = rs.getInt(1);
            if (key%2==0) {
                int newKey = -key;
                rs.updateInt(1, newKey);
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.