Package org.opencms.db
Class CmsPagingQuery
- java.lang.Object
-
- org.opencms.db.CmsPagingQuery
-
- All Implemented Interfaces:
I_CmsQueryFragment
public class CmsPagingQuery extends java.lang.Object implements I_CmsQueryFragment
Wrapper forCmsSelectQuery
objects which adds SQL code for results paging.The wrapper can either use the window function approach to paging or append a LIMIT/OFFSET clause.
- Since:
- 8.0.0
- See Also:
- "http://troels.arvin.dk/db/rdbms/#select-limit-offset"
-
-
Constructor Summary
Constructors Constructor Description CmsPagingQuery(CmsSelectQuery select)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
setNameSubquery(boolean nameSubquery)
Enables or disables the naming of subqueries.void
setPaging(int pageSize, int page)
Sets both the page size and current page to use for the query.void
setUseWindowFunctions(boolean useWindowFunctions)
Enables the use of window functions.void
visit(CmsStatementBuilder builder)
Generates the SQL and parameters and sends them to the statement builder .
-
-
-
Constructor Detail
-
CmsPagingQuery
public CmsPagingQuery(CmsSelectQuery select)
Creates a new instance.- Parameters:
select
- the wrapped query
-
-
Method Detail
-
setNameSubquery
public void setNameSubquery(boolean nameSubquery)
Enables or disables the naming of subqueries.- Parameters:
nameSubquery
- if true, enables naming of subqueries
-
setPaging
public void setPaging(int pageSize, int page)
Sets both the page size and current page to use for the query.- Parameters:
pageSize
- the page sizepage
- the current page (counting starts at 1)
-
setUseWindowFunctions
public void setUseWindowFunctions(boolean useWindowFunctions)
Enables the use of window functions.- Parameters:
useWindowFunctions
- if true, enables window functions
-
visit
public void visit(CmsStatementBuilder builder)
Description copied from interface:I_CmsQueryFragment
Generates the SQL and parameters and sends them to the statement builder .- Specified by:
visit
in interfaceI_CmsQueryFragment
- Parameters:
builder
- the statement builder- See Also:
I_CmsQueryFragment.visit(org.opencms.db.CmsStatementBuilder)
-
-