protected int countedSize ( ) throws PersistenceBrokerException { Query countQuery = getBroker ( ) . serviceBrokerHelper ( ) . getCountQuery ( getQueryObject ( ) . getQuery ( ) ) ; ResultSetAndStatement rsStmt ; ClassDescriptor cld = getQueryObject ( ) . getClassDescriptor ( ) ; int count = 0 ; // BRJ: do not use broker.getCount() because it's extent-aware // the count we need here must not include extents ! if ( countQuery instanceof QueryBySQL ) { String countSql = ( ( QueryBySQL ) countQuery ) . getSql ( ) ; rsStmt = getBroker ( ) . serviceJdbcAccess ( ) . executeSQL ( countSql , cld , Query . NOT_SCROLLABLE ) ; } else { rsStmt = getBroker ( ) . serviceJdbcAccess ( ) . executeQuery ( countQuery , cld ) ; } try { if ( rsStmt . m_rs . next ( ) ) { count = rsStmt . m_rs . getInt ( 1 ) ; } } catch ( SQLException e ) { throw new PersistenceBrokerException ( e ) ; } finally { rsStmt . close ( ) ; } return count ; }
Answer the counted size