Package java.sql

Examples of java.sql.ResultSet.first()


        // Test that it is possible to move to first row from insertRow
        currentPosition = rs.getRow();
        rs.moveToInsertRow();
        rs.updateInt(1, currentPosition + 1000);
        rs.first();
        assertEquals("CurrentPosition should be 1", rs.getRow(), 1);
        assertTrue("isFirst() should return true", rs.isFirst());
        // should be able to delete the row
        rs.deleteRow();
View Full Code Here


                     ps.executeUpdate());
        rs.updateInt(1, primaryKey*10);
        rs.updateInt(2, -555);
        rs.updateInt(3, -777);
        rs.updateRow();
        rs.first();
        rs.last();
        for (int i=0; i<10; i++) {
            rs.first();
            rs.last();
            rs.next();
View Full Code Here

        rs.updateInt(3, -777);
        rs.updateRow();
        rs.first();
        rs.last();
        for (int i=0; i<10; i++) {
            rs.first();
            rs.last();
            rs.next();
            rs.previous();
            rs.updateInt(1, primaryKey*10 +i);
            rs.updateInt(2, (-555 -i));
View Full Code Here

        checkDetectabilityCallsOutsideRow(rs, "on beforeFirst row");

        rs.afterLast();
        checkDetectabilityCallsOutsideRow(rs, "on afterLast row");

        rs.first();
        rs.deleteRow();
        checkDetectabilityCallsOutsideRow(rs, "after deleteRow");

        rs.last();
        rs.deleteRow();
View Full Code Here

        rs.next();
        rs.previous();
        rs.relative(1);
        rs.absolute(3);
        rs.relative(-1);
        rs.first();
        rs.last();
        rs.beforeFirst();
        rs.afterLast();
       
        // close result set and statement
View Full Code Here

        Statement scrollStmt = conn.createStatement(
                ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
        ResultSet rs = scrollStmt.executeQuery("SELECT * FROM derby1382");

        rs.first();
        checkContentsBeforeAndAfterUpdatingBlob(rs);
        rs.next();
        checkContentsBeforeAndAfterUpdatingBlob(rs);
        rs.relative(3);
        checkContentsBeforeAndAfterUpdatingBlob(rs);
View Full Code Here

        Statement scrollStmt = conn.createStatement(
                ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
        ResultSet rs = scrollStmt.executeQuery("SELECT * FROM derby1421");

        rs.first();
        updateBlobWithUpdateBinaryStream(rs);
        rs.next();
        updateBlobWithUpdateBinaryStream(rs);
        rs.relative(3);
        updateBlobWithUpdateBinaryStream(rs);
View Full Code Here

  @Test
  public void testRejoinMultiGame() throws Exception {

    Statement dbStatement = dbConn.createStatement();
    ResultSet countBeforeResult = dbStatement.executeQuery("SELECT COUNT(idgame) FROM game");
    countBeforeResult.first();
    long countBefore = countBeforeResult.getLong(1);

    userInit();

    // Waiting for player list update.
View Full Code Here

    }
    Thread.sleep(2000);

    // Check database entry for the game.
    ResultSet countAfterResult = dbStatement.executeQuery("SELECT COUNT(idgame) FROM game");
    countAfterResult.first();
    long countAfter = countAfterResult.getLong(1);
    assertEquals(countBefore + 1, countAfter);

    // Select the latest game.
    ResultSet gameResult = dbStatement.executeQuery("SELECT idgame, name, start_time, end_time FROM game WHERE start_time = (SELECT MAX(start_time) from game)");
View Full Code Here

    long countAfter = countAfterResult.getLong(1);
    assertEquals(countBefore + 1, countAfter);

    // Select the latest game.
    ResultSet gameResult = dbStatement.executeQuery("SELECT idgame, name, start_time, end_time FROM game WHERE start_time = (SELECT MAX(start_time) from game)");
    gameResult.first();
    long idgame = gameResult.getLong(1);

    // Check database entries for the players in the game.
    // There should be exactly 10 entries, just as usual.
    ResultSet gamePlayerResult = dbStatement.executeQuery("SELECT COUNT(*) FROM game_has_player WHERE game_idgame = " + idgame);
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.