/** * PUBLIC: * Set the fetchSize setting that this query will set on the JDBC Statement * NB - a value of zero means that no call to statement.setFetchSize() will be made. */ public void setFetchSize(int fetchSize) { if ( isPrepared() && this.getCall()!=null) { getCall().setResultSetFetchSize(fetchSize); } this.fetchSize = fetchSize; }
/** * PUBLIC: * Set the fetchSize setting that this query will set on the JDBC Statement * NB - a value of zero means that no call to statement.setFetchSize() will be made. */ public void setFetchSize(int fetchSize) { if ( isPrepared() && this.getCall()!=null) { getCall().setResultSetFetchSize(fetchSize); } this.fetchSize = fetchSize; }
/** * PUBLIC: * Used to set the limit for the maximum number of rows that any ResultSet can contain to the given number. * This method should only be set once per query. To change the max rows use another query. * This method limits the number of candidate results returned to TopLink that can be used to build objects */ public void setMaxRows(int maxRows) { if ( isPrepared() && this.maxRows != maxRows){ if ( this.getCall()!=null && this.getCall().shouldIgnoreMaxResultsSetting() && this.maxRows>0 ){ }else{ setIsPrepared(false); } } this.maxRows = maxRows; shouldCloneCall=true; }
/** * PUBLIC: * Used to set the limit for the maximum number of rows that any ResultSet can contain to the given number. * This method should only be set once per query. To change the max rows use another query. * This method limits the number of candidate results returned to TopLink that can be used to build objects */ public void setMaxRows(int maxRows) { if ( isPrepared() && this.maxRows != maxRows){ if ( this.getCall()!=null && this.getCall().shouldIgnoreFirstRowMaxResultsSettings() && this.maxRows>0 ){ }else{ setIsPrepared(false); } } this.maxRows = maxRows; shouldCloneCall=true; }
/** * PUBLIC: * Used to set the limit for the maximum number of rows that any ResultSet can contain to the given number. * This method should only be set once per query. To change the max rows use another query. * This method limits the number of candidate results returned to TopLink that can be used to build objects */ public void setMaxRows(int maxRows) { if ( isPrepared() && this.maxRows != maxRows){ if ( this.getCall()!=null && this.getCall().shouldIgnoreMaxResultsSetting() && this.maxRows>0 ){ }else{ setIsPrepared(false); } } this.maxRows = maxRows; shouldCloneCall=true; }
/** * PUBLIC: * Used to set the first result in any result set that is returned for this query. * On supported database platforms this will cause the query to issue specific SQL * that avoids selecting the firstResult number of rows. * Otherwise by it will use the JDBC absolute to skip the firstResult number of rows. */ public void setFirstResult(int firstResult) { if (isPrepared() && this.firstResult != firstResult) { if (getCall()!=null && getCall().shouldIgnoreFirstRowSetting()) { // Don't need to reprepare as firstResult is already built into the sql if ignoreFirstRowMaxResultsSettings is set, // firstResult is just a query parameter. } else { setIsPrepared(false); } } this.firstResult = firstResult; this.shouldCloneCall = true; }
/** * PUBLIC: * Used to set the first result in any result set that is returned for this query. * On supported database platforms this will cause the query to issue specific SQL * that avoids selecting the firstResult number of rows. * Otherwise by it will use the JDBC absolute to skip the firstResult number of rows. */ public void setFirstResult(int firstResult) { if (isPrepared() && this.firstResult != firstResult) { if (getCall()!=null && getCall().shouldIgnoreFirstRowMaxResultsSettings()) { // Don't need to reprepare as firstResult is already built into the sql if ignoreFirstRowMaxResultsSettings is set, // firstResult is just a query parameter. } else { setIsPrepared(false); } } this.firstResult = firstResult; this.shouldCloneCall = true; }
/** * PUBLIC: * Used to set the first result in any result set that is returned for this query. * On supported database platforms this will cause the query to issue specific SQL * that avoids selecting the firstResult number of rows. * Otherwise by it will use the JDBC absolute to skip the firstResult number of rows. */ public void setFirstResult(int firstResult) { if (isPrepared() && this.firstResult != firstResult) { if (getCall()!=null && getCall().shouldIgnoreFirstRowSetting()) { // Don't need to reprepare as firstResult is already built into the sql if ignoreFirstRowMaxResultsSettings is set, // firstResult is just a query parameter. } else { setIsPrepared(false); } } this.firstResult = firstResult; this.shouldCloneCall = true; }
/** * INTERNAL: * Prepare the receiver for execution in a session. */ public void prepareForExecution() throws QueryException { super.prepareForExecution(); DatabaseCall databaseCall = this.getCall(); if ( databaseCall !=null && databaseCall.shouldIgnoreFirstRowMaxResultsSettings() ){ AbstractRecord parameters = this.getTranslationRow(); if (parameters.isEmpty()){ parameters = new DatabaseRecord(); } parameters.add(DatabaseCall.FIRSTRESULT_FIELD, this.getFirstResult()); parameters.add(DatabaseCall.MAXROW_FIELD, session.getPlatform().computeMaxRowsForSQL(this.getFirstResult(), this.getMaxRows())); this.setTranslationRow(parameters); } }
/** * INTERNAL: * Prepare the receiver for execution in a session. */ public void prepareForExecution() throws QueryException { super.prepareForExecution(); DatabaseCall databaseCall = this.getCall(); if ( databaseCall !=null && (databaseCall.shouldIgnoreFirstRowSetting() || databaseCall.shouldIgnoreMaxResultsSetting())){ AbstractRecord parameters = this.getTranslationRow(); if (parameters.isEmpty()){ parameters = new DatabaseRecord(); } //Some DB don't support FirstRow in SELECT statements in spite of supporting MaxResults(Symfoware). //We should check FirstRow and MaxResults separately. if(databaseCall.shouldIgnoreFirstRowSetting()){ parameters.add(DatabaseCall.FIRSTRESULT_FIELD, this.getFirstResult()); } if(databaseCall.shouldIgnoreMaxResultsSetting()){ parameters.add(DatabaseCall.MAXROW_FIELD, session.getPlatform().computeMaxRowsForSQL(this.getFirstResult(), this.getMaxRows())); } this.setTranslationRow(parameters); } }
/** * INTERNAL: * Prepare the receiver for execution in a session. */ public void prepareForExecution() throws QueryException { super.prepareForExecution(); DatabaseCall databaseCall = this.getCall(); if ( databaseCall !=null && (databaseCall.shouldIgnoreFirstRowSetting() || databaseCall.shouldIgnoreMaxResultsSetting())){ AbstractRecord parameters = this.getTranslationRow(); if (parameters.isEmpty()){ parameters = new DatabaseRecord(); } //Some DB don't support FirstRow in SELECT statements in spite of supporting MaxResults(Symfoware). //We should check FirstRow and MaxResults separately. if (databaseCall.shouldIgnoreFirstRowSetting()) { parameters.add(DatabaseCall.FIRSTRESULT_FIELD, this.getFirstResult()); } if (databaseCall.shouldIgnoreMaxResultsSetting()) { // Bug #493771 parameters.add(DatabaseCall.MAXROW_FIELD, ((DatabasePlatform) session.getPlatform(databaseCall.getQuery().getReferenceClass())).computeMaxRowsForSQL(this.getFirstResult(), this.getMaxRows())); } this.setTranslationRow(parameters); } }