Package java.sql

Examples of java.sql.ResultSet.last()


    {
      System.out.println("expected to be before the 1st row");
      passed = false;
    }
    // move to last row
    if (! rs.last())
    {
      System.out.println("expected last() to succeed");
      passed = false;
    }
    if (! rs.isLast())
View Full Code Here


    }
    conn.clearWarnings();

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

    // Check setMaxRows()/getMaxRows()
    if (s_i_r.getMaxRows() != 0)
View Full Code Here

    if (rs == null)
    {
      System.out.println("rs expected to be non-null.");
      passed = false;
    }
    if (!rs.last())
    {
      System.out.println("rs.last() failed.");
      passed = false;
    }
    // Iterate backwards thru RS, expect only 4 more (5 total) rows.
View Full Code Here

                                (maxRows + 1) + "th row.");
                        passed = false;
                }

                // Start from last and verify maxRows
                if (!rs.last())
                {
                        System.out.println("rs.last() failed.");
                        passed = false;
                }
                // Iterate backwards thru RS, expect only (maxRows - 1) more rows.
View Full Code Here

                                "rs.previous() failed, should not have seen " +
                                (maxRows + 1) + "th row.");
                        passed = false;
                }

                rs.last();
                int rows = rs.getRow();
               
                rs.absolute(rows/2);
                if (rs.relative(-1 * (rows))) {
                    System.out.println("relative(" + -1 * (rows) + ") should return false, position outside of the resultSet");
View Full Code Here

        for(String table : tables) {
          String query = "select * from ["+table+"];";
          Macro mp = new Macro(current,query);
          query = mp.toString();
          ResultSet rs = db.query(query);
          rs.last();
          int count = rs.getRow();
          assertTrue("Table should exist and return empty result.", count==0);
        }
        db.close();
      } catch(SQLException ex) {
View Full Code Here

       
        s.setCursorName(getNextCursorName());
        ResultSet rs =
            s.executeQuery("select * from t1");
       
        rs.last();
        lastRow = rs.getRow();
       
        rs.beforeFirst();
       
        rs.next();
View Full Code Here

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

            (ResultSet.TYPE_SCROLL_INSENSITIVE,
             ResultSet.CONCUR_UPDATABLE);
        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) {
View Full Code Here

            (ResultSet.TYPE_SCROLL_INSENSITIVE,
             ResultSet.CONCUR_UPDATABLE);
        s.setCursorName(getNextCursorName());
        ResultSet rs = s.executeQuery("select * from t1");
       
        rs.last();
        int primaryKey = rs.getInt(1);
        PreparedStatement ps = prepareStatement
            ("update t1 set id = ? where id= ?");
        ps.setInt(1, -primaryKey);
        ps.setInt(2, primaryKey);
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.