Class LimitClause

  • All Implemented Interfaces:
    SelectFragment, Fragment

    public class LimitClause
    extends AbstractFragment
    implements SelectFragment
    This class represents the limit clause of an SQL statement. It lets you choose offset and / or count of rows to be handed back in the result.
    • Constructor Detail

      • LimitClause

        public LimitClause​(SqlStatement root,
                           int count)
        Create a new instance of a LimitClause
        Parameters:
        root - SQL statement this LIMIT clause belongs to
        count - maximum number of rows to be included in the query result
      • LimitClause

        public LimitClause​(SqlStatement root,
                           int offset,
                           int count)
        Create a new instance of a LimitClause
        Parameters:
        root - SQL statement this LIMIT clause belongs to
        offset - index of the first row to be included in the query result
        count - maximum number of rows to be included in the query result
    • Method Detail

      • getOffset

        public int getOffset()
        Get the offset row for the limit
        Returns:
        first row which should be handed back
      • getCount

        public int getCount()
        Get the maximum number of rows to be handed back
        Returns:
        maximum number of rows
      • hasOffset

        public boolean hasOffset()
        Check if the limit clause has an offset
        Returns:
        true if the limit clause has an offset
      • accept

        public void accept​(SelectVisitor visitor)
        Description copied from interface: SelectFragment
        Accept a visitor (e.g. a renderer or validator)
        Specified by:
        accept in interface SelectFragment
        Parameters:
        visitor - visitor to accept