@@ -64,7 +64,7 @@ public class fflib_QueryFactory { //No explicit sharing declaration - inherit fr
6464 private Set <String > fields ;
6565 private String conditionExpression ;
6666 private Integer limitCount ;
67- private Integer offset ;
67+ private Integer offsetCount ;
6868 private List <Ordering > order ;
6969 /**
7070 * Integrate checking for READ Field Level Security within the selectField(s) methods
@@ -318,6 +318,19 @@ public class fflib_QueryFactory { //No explicit sharing declaration - inherit fr
318318 public Integer getLimit (){
319319 return this .limitCount ;
320320 }
321+ /**
322+ * @param offsetCount if not null causes a OFFSET caluse to be added to the resulting query.
323+ **/
324+ public fflib_QueryFactory setOffset (Integer offsetCount ){
325+ this .offsetCount = offsetCount ;
326+ return this ;
327+ }
328+ /**
329+ * @returns the current value of the OFFSET clause, if any.
330+ **/
331+ public Integer getOffset (){
332+ return this .offsetCount ;
333+ }
321334 /**
322335 * @param o an instance of {@link fflib_QueryFactory.Ordering} to be added to the query's ORDER BY clause.
323336 **/
@@ -589,6 +602,10 @@ public class fflib_QueryFactory { //No explicit sharing declaration - inherit fr
589602
590603 if (limitCount != null )
591604 result += ' LIMIT ' + limitCount ;
605+
606+ if (offsetCount != null )
607+ result += ' OFFSET ' + offsetCount ;
608+
592609 return result ;
593610 }
594611
@@ -600,6 +617,7 @@ public class fflib_QueryFactory { //No explicit sharing declaration - inherit fr
600617
601618 fflib_QueryFactory clone = new fflib_QueryFactory (this .table )
602619 .setLimit (this .limitCount )
620+ .setOffset (this .offsetCount )
603621 .setCondition (this .conditionExpression )
604622 .setEnforceFLS (this .enforceFLS );
605623
@@ -675,4 +693,4 @@ public class fflib_QueryFactory { //No explicit sharing declaration - inherit fr
675693 public class InvalidFieldSetException extends Exception {}
676694 public class NonReferenceFieldException extends Exception {}
677695 public class InvalidSubqueryRelationshipException extends Exception {}
678- }
696+ }
0 commit comments