i_val = ((Integer)iMatchColumns.get(0)).intValue(); if( i_val == -1 ) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.setmatchcols").toString()); } iMatchColumns.copyInto(int_temp); for(int i = 0; i < int_temp.length; i++) { i_temp[i] = (int_temp[i]).intValue(); } return i_temp; } /** * Sets the designated parameter to the given int array. * This forms the basis of the join for the * <code>JoinRowSet</code> as the column which will form the basis of the * join. * <P> * The parameter value set by this method is stored internally and * will be supplied as the appropriate parameter in this rowset's * command when the method <code>getMatchColumnIndexes</code> is called. * * @param columnIdxes the indexes into this rowset * object's internal representation of parameter values; the * first parameter is 0, the second is 1, and so on; must be * <code>0</code> or greater * @throws SQLException if an error occurs or the * parameter index is out of bounds */ public void setMatchColumn(int[] columnIdxes) throws SQLException { for(int j = 0 ; j < columnIdxes.length; j++) { if( columnIdxes[j] < 0 ) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols1").toString()); } } for(int i = 0 ;i < columnIdxes.length; i++) { iMatchColumns.add(i,Integer.valueOf(columnIdxes[i])); } } /** * Sets the designated parameter to the given String array. * This forms the basis of the join for the * <code>JoinRowSet</code> as the column which will form the basis of the * join. * <P> * The parameter value set by this method is stored internally and * will be supplied as the appropriate parameter in this rowset's * command when the method <code>getMatchColumn</code> is called. * * @param columnNames the name of the column into this rowset * object's internal representation of parameter values * @throws SQLException if an error occurs or the * parameter index is out of bounds */ public void setMatchColumn(String[] columnNames) throws SQLException { for(int j = 0; j < columnNames.length; j++) { if( columnNames[j] == null || columnNames[j].equals("")) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols2").toString()); } } for( int i = 0; i < columnNames.length; i++) { strMatchColumns.add(i,columnNames[i]); } } /** * Sets the designated parameter to the given <code>int</code> * object. This forms the basis of the join for the * <code>JoinRowSet</code> as the column which will form the basis of the * join. * <P> * The parameter value set by this method is stored internally and * will be supplied as the appropriate parameter in this rowset's * command when the method <code>getMatchColumn</code> is called. * * @param columnIdx the index into this rowset * object's internal representation of parameter values; the * first parameter is 0, the second is 1, and so on; must be * <code>0</code> or greater * @throws SQLException if an error occurs or the * parameter index is out of bounds */ public void setMatchColumn(int columnIdx) throws SQLException { // validate, if col is ok to be set if(columnIdx < 0) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols1").toString()); } else { // set iMatchColumn iMatchColumns.set(0, Integer.valueOf(columnIdx)); //strMatchColumn = null; } } /** * Sets the designated parameter to the given <code>String</code> * object. This forms the basis of the join for the * <code>JoinRowSet</code> as the column which will form the basis of the * join. * <P> * The parameter value set by this method is stored internally and * will be supplied as the appropriate parameter in this rowset's * command when the method <code>getMatchColumn</code> is called. * * @param columnName the name of the column into this rowset * object's internal representation of parameter values * @throws SQLException if an error occurs or the * parameter index is out of bounds */ public void setMatchColumn(String columnName) throws SQLException { // validate, if col is ok to be set if(columnName == null || (columnName= columnName.trim()).equals("") ) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols2").toString()); } else { // set strMatchColumn strMatchColumns.set(0, columnName); //iMatchColumn = -1; } } /** * Unsets the designated parameter to the given <code>int</code> * object. This was set using <code>setMatchColumn</code> * as the column which will form the basis of the join. * <P> * The parameter value unset by this method should be same * as was set. * * @param columnIdx the index into this rowset * object's internal representation of parameter values * @throws SQLException if an error occurs or the * parameter index is out of bounds or if the columnIdx is * not the same as set using <code>setMatchColumn(int)</code> */ public void unsetMatchColumn(int columnIdx) throws SQLException { // check if we are unsetting the SAME column if(! iMatchColumns.get(0).equals(Integer.valueOf(columnIdx) ) ) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch").toString()); } else if(strMatchColumns.get(0) != null) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch1").toString()); } else { // that is, we are unsetting it. iMatchColumns.set(0, Integer.valueOf(-1)); } } /** * Unsets the designated parameter to the given <code>String</code> * object. This was set using <code>setMatchColumn</code> * as the column which will form the basis of the join. * <P> * The parameter value unset by this method should be same * as was set. * * @param columnName the index into this rowset * object's internal representation of parameter values * @throws SQLException if an error occurs or the * parameter index is out of bounds or if the columnName is * not the same as set using <code>setMatchColumn(String)</code> */ public void unsetMatchColumn(String columnName) throws SQLException { // check if we are unsetting the same column columnName = columnName.trim(); if(!((strMatchColumns.get(0)).equals(columnName))) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch").toString()); } else if( ((Integer)(iMatchColumns.get(0))).intValue() > 0) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch2").toString()); } else { strMatchColumns.set(0, null); // that is, we are unsetting it. } } /** * Notifies registered listeners that a RowSet object in the given RowSetEvent * object has populated a number of additional rows. The <code>numRows</code> parameter * ensures that this event will only be fired every <code>numRow</code>. * <p> * The source of the event can be retrieved with the method event.getSource. * * @param event a <code>RowSetEvent</code> object that contains the * <code>RowSet</code> object that is the source of the events * @param numRows when populating, the number of rows interval on which the * <code>CachedRowSet</code> populated should fire; the default value * is zero; cannot be less than <code>fetchSize</code> or zero */ public void rowSetPopulated(RowSetEvent event, int numRows) throws SQLException { if( numRows < 0 || numRows < getFetchSize()) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.numrows").toString()); } if(size() % numRows == 0) { RowSetEvent event_temp = new RowSetEvent(this); event = event_temp; notifyRowSetChanged(); } } /** * Populates this <code>CachedRowSet</code> object with data from * the given <code>ResultSet</code> object. While related to the <code>populate(ResultSet)</code> * method, an additional parameter is provided to allow starting position within * the <code>ResultSet</code> from where to populate the CachedRowSet * instance. * * This method is an alternative to the method <code>execute</code> * for filling the rowset with data. The method <code>populate</code> * does not require that the properties needed by the method * <code>execute</code>, such as the <code>command</code> property, * be set. This is true because the method <code>populate</code> * is given the <code>ResultSet</code> object from * which to get data and thus does not need to use the properties * required for setting up a connection and executing this * <code>CachedRowSetImpl</code> object's command. * <P> * After populating this rowset with data, the method * <code>populate</code> sets the rowset's metadata and * then sends a <code>RowSetChangedEvent</code> object * to all registered listeners prior to returning. * * @param data the <code>ResultSet</code> object containing the data * to be read into this <code>CachedRowSetImpl</code> object * @param start the integer specifing the position in the * <code>ResultSet</code> object to popultate the * <code>CachedRowSetImpl</code> object. * @throws SQLException if an error occurs; or the max row setting is * violated while populating the RowSet.Also id the start position * is negative. * @see #execute */ public void populate(ResultSet data, int start) throws SQLException{ int rowsFetched; Row currentRow; int numCols; int i; Map<String, Class<?>> map = getTypeMap(); Object obj; int mRows; cursorPos = 0; if(populatecallcount == 0){ if(start < 0){ throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.startpos").toString()); } if(getMaxRows() == 0){ data.absolute(start); while(data.next()){ totalRows++; } totalRows++; } startPos = start; } populatecallcount = populatecallcount +1; resultSet = data; if((endPos - startPos) >= getMaxRows() && (getMaxRows() > 0)){ endPos = prevEndPos; pagenotend = false; return; } if((maxRowsreached != getMaxRows() || maxRowsreached != totalRows) && pagenotend) { startPrev = start - getPageSize(); } if( pageSize == 0){ prevEndPos = endPos; endPos = start + getMaxRows() ; } else{ prevEndPos = endPos; endPos = start + getPageSize(); } if (start == 1){ resultSet.beforeFirst(); } else { resultSet.absolute(start -1); } if( pageSize == 0) { rvh = new Vector<Object>(getMaxRows()); } else{ rvh = new Vector<Object>(getPageSize()); } if (data == null) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.populate").toString()); } // get the meta data for this ResultSet RSMD = data.getMetaData(); // set up the metadata RowSetMD = new RowSetMetaDataImpl(); initMetaData(RowSetMD, RSMD); // release the meta-data so that aren't tempted to use it. RSMD = null; numCols = RowSetMD.getColumnCount(); mRows = this.getMaxRows(); rowsFetched = 0; currentRow = null; if(!data.next() && mRows == 0){ endPos = prevEndPos; pagenotend = false; return; } data.previous(); while ( data.next()) { currentRow = new Row(numCols); if(pageSize == 0){ if ( rowsFetched >= mRows && mRows > 0) { rowsetWarning.setNextException(new SQLException("Populating rows " + "setting has exceeded max row setting")); break; } } else { if ( (rowsFetched >= pageSize) ||( maxRowsreached >= mRows && mRows > 0)) { rowsetWarning.setNextException(new SQLException("Populating rows " + "setting has exceeded max row setting")); break; } } for ( i = 1; i <= numCols; i++) { /* * check if the user has set a map. If no map * is set then use plain getObject. This lets * us work with drivers that do not support * getObject with a map in fairly sensible way */ if (map == null) { obj = data.getObject(i); } else { obj = data.getObject(i, map); } /* * the following block checks for the various * types that we have to serialize in order to * store - right now only structs have been tested */ if (obj instanceof Struct) { obj = new SerialStruct((Struct)obj, map); } else if (obj instanceof SQLData) { obj = new SerialStruct((SQLData)obj, map); } else if (obj instanceof Blob) { obj = new SerialBlob((Blob)obj); } else if (obj instanceof Clob) { obj = new SerialClob((Clob)obj); } else if (obj instanceof java.sql.Array) { obj = new SerialArray((java.sql.Array)obj, map); } ((Row)currentRow).initColumnObject(i, obj); } rowsFetched++; maxRowsreached++; rvh.add(currentRow); } numRows = rowsFetched ; // Also rowsFetched should be equal to rvh.size() // notify any listeners that the rowset has changed notifyRowSetChanged(); } /** * The nextPage gets the next page, that is a <code>CachedRowSetImpl</code> object * containing the number of rows specified by page size. * @return boolean value true indicating whether there are more pages to come and * false indicating that this is the last page. * @throws SQLException if an error occurs or this called before calling populate. */ public boolean nextPage() throws SQLException { if (populatecallcount == 0){ throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.nextpage").toString()); } // Fix for 6554186 onFirstPage = false; if(callWithCon){ crsReader.setStartPosition(endPos); crsReader.readData((RowSetInternal)this); resultSet = null; } else { populate(resultSet,endPos); } return pagenotend; } /** * This is the setter function for setting the size of the page, which specifies * how many rows have to be retrived at a time. * * @param size which is the page size * @throws SQLException if size is less than zero or greater than max rows. */ public void setPageSize (int size) throws SQLException { if (size < 0) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.pagesize").toString()); } if (size > getMaxRows() && getMaxRows() != 0) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.pagesize1").toString()); } pageSize = size; } /** * This is the getter function for the size of the page. * * @return an integer that is the page size. */ public int getPageSize() { return pageSize; } /** * Retrieves the data present in the page prior to the page from where it is * called. * @return boolean value true if it retrieves the previous page, flase if it * is on the first page. * @throws SQLException if it is called before populate is called or ResultSet * is of type <code>ResultSet.TYPE_FORWARD_ONLY</code> or if an error * occurs. */ public boolean previousPage() throws SQLException { int pS; int mR; int rem; pS = getPageSize(); mR = maxRowsreached; if (populatecallcount == 0){ throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.nextpage").toString()); } if( !callWithCon){ if(resultSet.getType() == ResultSet.TYPE_FORWARD_ONLY){ throw new SQLException (resBundle.handleGetObject("cachedrowsetimpl.fwdonly").toString()); } } pagenotend = true; if(startPrev < startPos ){ onFirstPage = true; return false; } if(onFirstPage){ return false; } rem = mR % pS; if(rem == 0){ maxRowsreached -= (2 * pS); if(callWithCon){ crsReader.setStartPosition(startPrev); crsReader.readData((RowSetInternal)this); resultSet = null; } else { populate(resultSet,startPrev); } return true; } else { maxRowsreached -= (pS + rem); if(callWithCon){ crsReader.setStartPosition(startPrev); crsReader.readData((RowSetInternal)this); resultSet = null; } else { populate(resultSet,startPrev); } return true;Lines 7001–7500 of 10133. Previous lines Load more
i_val = ((Integer)iMatchColumns.get(0)).intValue(); if( i_val == -1 ) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.setmatchcols").toString()); } iMatchColumns.copyInto(int_temp); for(int i = 0; i < int_temp.length; i++) { i_temp[i] = (int_temp[i]).intValue(); } return i_temp; } /** * Sets the designated parameter to the given int array. * This forms the basis of the join for the * <code>JoinRowSet</code> as the column which will form the basis of the * join. * <P> * The parameter value set by this method is stored internally and * will be supplied as the appropriate parameter in this rowset's * command when the method <code>getMatchColumnIndexes</code> is called. * * @param columnIdxes the indexes into this rowset * object's internal representation of parameter values; the * first parameter is 0, the second is 1, and so on; must be * <code>0</code> or greater * @throws SQLException if an error occurs or the * parameter index is out of bounds */ public void setMatchColumn(int[] columnIdxes) throws SQLException { for(int j = 0 ; j < columnIdxes.length; j++) { if( columnIdxes[j] < 0 ) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols1").toString()); } } for(int i = 0 ;i < columnIdxes.length; i++) { iMatchColumns.add(i,Integer.valueOf(columnIdxes[i])); } } /** * Sets the designated parameter to the given String array. * This forms the basis of the join for the * <code>JoinRowSet</code> as the column which will form the basis of the * join. * <P> * The parameter value set by this method is stored internally and * will be supplied as the appropriate parameter in this rowset's * command when the method <code>getMatchColumn</code> is called. * * @param columnNames the name of the column into this rowset * object's internal representation of parameter values * @throws SQLException if an error occurs or the * parameter index is out of bounds */ public void setMatchColumn(String[] columnNames) throws SQLException { for(int j = 0; j < columnNames.length; j++) { if( columnNames[j] == null || columnNames[j].equals("")) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols2").toString()); } } for( int i = 0; i < columnNames.length; i++) { strMatchColumns.add(i,columnNames[i]); } } /** * Sets the designated parameter to the given <code>int</code> * object. This forms the basis of the join for the * <code>JoinRowSet</code> as the column which will form the basis of the * join. * <P> * The parameter value set by this method is stored internally and * will be supplied as the appropriate parameter in this rowset's * command when the method <code>getMatchColumn</code> is called. * * @param columnIdx the index into this rowset * object's internal representation of parameter values; the * first parameter is 0, the second is 1, and so on; must be * <code>0</code> or greater * @throws SQLException if an error occurs or the * parameter index is out of bounds */ public void setMatchColumn(int columnIdx) throws SQLException { // validate, if col is ok to be set if(columnIdx < 0) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols1").toString()); } else { // set iMatchColumn iMatchColumns.set(0, Integer.valueOf(columnIdx)); //strMatchColumn = null; } } /** * Sets the designated parameter to the given <code>String</code> * object. This forms the basis of the join for the * <code>JoinRowSet</code> as the column which will form the basis of the * join. * <P> * The parameter value set by this method is stored internally and * will be supplied as the appropriate parameter in this rowset's * command when the method <code>getMatchColumn</code> is called. * * @param columnName the name of the column into this rowset * object's internal representation of parameter values * @throws SQLException if an error occurs or the * parameter index is out of bounds */ public void setMatchColumn(String columnName) throws SQLException { // validate, if col is ok to be set if(columnName == null || (columnName= columnName.trim()).equals("") ) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols2").toString()); } else { // set strMatchColumn strMatchColumns.set(0, columnName); //iMatchColumn = -1; } } /** * Unsets the designated parameter to the given <code>int</code> * object. This was set using <code>setMatchColumn</code> * as the column which will form the basis of the join. * <P> * The parameter value unset by this method should be same * as was set. * * @param columnIdx the index into this rowset * object's internal representation of parameter values * @throws SQLException if an error occurs or the * parameter index is out of bounds or if the columnIdx is * not the same as set using <code>setMatchColumn(int)</code> */ public void unsetMatchColumn(int columnIdx) throws SQLException { // check if we are unsetting the SAME column if(! iMatchColumns.get(0).equals(Integer.valueOf(columnIdx) ) ) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch").toString()); } else if(strMatchColumns.get(0) != null) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch1").toString()); } else { // that is, we are unsetting it. iMatchColumns.set(0, Integer.valueOf(-1)); } } /** * Unsets the designated parameter to the given <code>String</code> * object. This was set using <code>setMatchColumn</code> * as the column which will form the basis of the join. * <P> * The parameter value unset by this method should be same * as was set. * * @param columnName the index into this rowset * object's internal representation of parameter values * @throws SQLException if an error occurs or the * parameter index is out of bounds or if the columnName is * not the same as set using <code>setMatchColumn(String)</code> */ public void unsetMatchColumn(String columnName) throws SQLException { // check if we are unsetting the same column columnName = columnName.trim(); if(!((strMatchColumns.get(0)).equals(columnName))) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch").toString()); } else if( ((Integer)(iMatchColumns.get(0))).intValue() > 0) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch2").toString()); } else { strMatchColumns.set(0, null); // that is, we are unsetting it. } } /** * Notifies registered listeners that a RowSet object in the given RowSetEvent * object has populated a number of additional rows. The <code>numRows</code> parameter * ensures that this event will only be fired every <code>numRow</code>. * <p> * The source of the event can be retrieved with the method event.getSource. * * @param event a <code>RowSetEvent</code> object that contains the * <code>RowSet</code> object that is the source of the events * @param numRows when populating, the number of rows interval on which the * <code>CachedRowSet</code> populated should fire; the default value * is zero; cannot be less than <code>fetchSize</code> or zero */ public void rowSetPopulated(RowSetEvent event, int numRows) throws SQLException { if( numRows < 0 || numRows < getFetchSize()) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.numrows").toString()); } if(size() % numRows == 0) { RowSetEvent event_temp = new RowSetEvent(this); event = event_temp; notifyRowSetChanged(); } } /** * Populates this <code>CachedRowSet</code> object with data from * the given <code>ResultSet</code> object. While related to the <code>populate(ResultSet)</code> * method, an additional parameter is provided to allow starting position within * the <code>ResultSet</code> from where to populate the CachedRowSet * instance. * * This method is an alternative to the method <code>execute</code> * for filling the rowset with data. The method <code>populate</code> * does not require that the properties needed by the method * <code>execute</code>, such as the <code>command</code> property, * be set. This is true because the method <code>populate</code> * is given the <code>ResultSet</code> object from * which to get data and thus does not need to use the properties * required for setting up a connection and executing this * <code>CachedRowSetImpl</code> object's command. * <P> * After populating this rowset with data, the method * <code>populate</code> sets the rowset's metadata and * then sends a <code>RowSetChangedEvent</code> object * to all registered listeners prior to returning. * * @param data the <code>ResultSet</code> object containing the data * to be read into this <code>CachedRowSetImpl</code> object * @param start the integer specifing the position in the * <code>ResultSet</code> object to popultate the * <code>CachedRowSetImpl</code> object. * @throws SQLException if an error occurs; or the max row setting is * violated while populating the RowSet.Also id the start position * is negative. * @see #execute */ public void populate(ResultSet data, int start) throws SQLException{ int rowsFetched; Row currentRow; int numCols; int i; Map<String, Class<?>> map = getTypeMap(); Object obj; int mRows; cursorPos = 0; if(populatecallcount == 0){ if(start < 0){ throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.startpos").toString()); } if(getMaxRows() == 0){ data.absolute(start); while(data.next()){ totalRows++; } totalRows++; } startPos = start; } populatecallcount = populatecallcount +1; resultSet = data; if((endPos - startPos) >= getMaxRows() && (getMaxRows() > 0)){ endPos = prevEndPos; pagenotend = false; return; } if((maxRowsreached != getMaxRows() || maxRowsreached != totalRows) && pagenotend) { startPrev = start - getPageSize(); } if( pageSize == 0){ prevEndPos = endPos; endPos = start + getMaxRows() ; } else{ prevEndPos = endPos; endPos = start + getPageSize(); } if (start == 1){ resultSet.beforeFirst(); } else { resultSet.absolute(start -1); } if( pageSize == 0) { rvh = new Vector<Object>(getMaxRows()); } else{ rvh = new Vector<Object>(getPageSize()); } if (data == null) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.populate").toString()); } // get the meta data for this ResultSet RSMD = data.getMetaData(); // set up the metadata RowSetMD = new RowSetMetaDataImpl(); initMetaData(RowSetMD, RSMD); // release the meta-data so that aren't tempted to use it. RSMD = null; numCols = RowSetMD.getColumnCount(); mRows = this.getMaxRows(); rowsFetched = 0; currentRow = null; if(!data.next() && mRows == 0){ endPos = prevEndPos; pagenotend = false; return; } data.previous(); while ( data.next()) { currentRow = new Row(numCols); if(pageSize == 0){ if ( rowsFetched >= mRows && mRows > 0) { rowsetWarning.setNextException(new SQLException("Populating rows " + "setting has exceeded max row setting")); break; } } else { if ( (rowsFetched >= pageSize) ||( maxRowsreached >= mRows && mRows > 0)) { rowsetWarning.setNextException(new SQLException("Populating rows " + "setting has exceeded max row setting")); break; } } for ( i = 1; i <= numCols; i++) { /* * check if the user has set a map. If no map * is set then use plain getObject. This lets * us work with drivers that do not support * getObject with a map in fairly sensible way */ if (map == null) { obj = data.getObject(i); } else { obj = data.getObject(i, map); } /* * the following block checks for the various * types that we have to serialize in order to * store - right now only structs have been tested */ if (obj instanceof Struct) { obj = new SerialStruct((Struct)obj, map); } else if (obj instanceof SQLData) { obj = new SerialStruct((SQLData)obj, map); } else if (obj instanceof Blob) { obj = new SerialBlob((Blob)obj); } else if (obj instanceof Clob) { obj = new SerialClob((Clob)obj); } else if (obj instanceof java.sql.Array) { obj = new SerialArray((java.sql.Array)obj, map); } ((Row)currentRow).initColumnObject(i, obj); } rowsFetched++; maxRowsreached++; rvh.add(currentRow); } numRows = rowsFetched ; // Also rowsFetched should be equal to rvh.size() // notify any listeners that the rowset has changed notifyRowSetChanged(); } /** * The nextPage gets the next page, that is a <code>CachedRowSetImpl</code> object * containing the number of rows specified by page size. * @return boolean value true indicating whether there are more pages to come and * false indicating that this is the last page. * @throws SQLException if an error occurs or this called before calling populate. */ public boolean nextPage() throws SQLException { if (populatecallcount == 0){ throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.nextpage").toString()); } // Fix for 6554186 onFirstPage = false; if(callWithCon){ crsReader.setStartPosition(endPos); crsReader.readData((RowSetInternal)this); resultSet = null; } else { populate(resultSet,endPos); } return pagenotend; } /** * This is the setter function for setting the size of the page, which specifies * how many rows have to be retrived at a time. * * @param size which is the page size * @throws SQLException if size is less than zero or greater than max rows. */ public void setPageSize (int size) throws SQLException { if (size < 0) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.pagesize").toString()); } if (size > getMaxRows() && getMaxRows() != 0) { throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.pagesize1").toString()); } pageSize = size; } /** * This is the getter function for the size of the page. * * @return an integer that is the page size. */ public int getPageSize() { return pageSize; } /** * Retrieves the data present in the page prior to the page from where it is * called. * @return boolean value true if it retrieves the previous page, flase if it * is on the first page. * @throws SQLException if it is called before populate is called or ResultSet * is of type <code>ResultSet.TYPE_FORWARD_ONLY</code> or if an error * occurs. */ public boolean previousPage() throws SQLException { int pS; int mR; int rem; pS = getPageSize(); mR = maxRowsreached; if (populatecallcount == 0){ throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.nextpage").toString()); } if( !callWithCon){ if(resultSet.getType() == ResultSet.TYPE_FORWARD_ONLY){ throw new SQLException (resBundle.handleGetObject("cachedrowsetimpl.fwdonly").toString()); } } pagenotend = true; if(startPrev < startPos ){ onFirstPage = true; return false; } if(onFirstPage){ return false; } rem = mR % pS; if(rem == 0){ maxRowsreached -= (2 * pS); if(callWithCon){ crsReader.setStartPosition(startPrev); crsReader.readData((RowSetInternal)this); resultSet = null; } else { populate(resultSet,startPrev); } return true; } else { maxRowsreached -= (pS + rem); if(callWithCon){ crsReader.setStartPosition(startPrev); crsReader.readData((RowSetInternal)this); resultSet = null; } else { populate(resultSet,startPrev); } return true;