Package java.sql

Examples of java.sql.ResultSet.last()


    boolean toReturn = false;
    try
      {
      Statement check = conn.createStatement();
      ResultSet rs = check.executeQuery(query);
      rs.last();
      if (rs.getRow() > 0)
        toReturn = true;
      rs.close();
      check.close();
      }
View Full Code Here


        final Statement statement = this.connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
                ResultSet.CONCUR_READ_ONLY);
        final ResultSet resultSet = statement.executeQuery("SELECT * FROM fmLogEntry ORDER BY id");

        resultSet.last();
        assertEquals("The number of records is not correct.", 1001, resultSet.getRow());

        System.out.println("Wrote 1,000 log events in " + elapsed + " nanoseconds (" + elapsedMilli +
                " milliseconds) for " + this.databaseType + '.');
    }
View Full Code Here

            final Statement statement = this.connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
                    ResultSet.CONCUR_READ_ONLY);
            final ResultSet resultSet = statement.executeQuery("SELECT * FROM jpaBasicLogEntry ORDER BY id");

            resultSet.last();
            assertEquals("The number of records is not correct.", 10001, resultSet.getRow());

            System.out.println("Wrote 10,000 log events in " + elapsed + " nanoseconds (" + elapsedMilli +
                    " milliseconds) for " + this.databaseType + '.');
        } finally {
View Full Code Here

                //Other resources
                ResultSet resourceIds =
                        resources_STMT.executeQuery("SELECT distinct r FROM folksonomy WHERE " + temp);
               
                //Initialise matrix
                resourceIds.last();
                int am_of_resources = resourceIds.getRow();            
                r_matrix = new ResourcePrimitive[am_of_resources];
                int i = 0; //index of matrix
               
                //Compute matrix
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

        rs.previous();
        rs.relative(1);
        rs.absolute(3);
        rs.relative(-1);
        rs.first();
        rs.last();
        rs.beforeFirst();
        rs.afterLast();
       
        // close result set and statement
        rs.close();
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

            (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.