Package com.onenetwork.platform.data.sql
Class QueryRequest
java.lang.Object
com.onenetwork.platform.data.sql.QueryRequest
- Direct Known Subclasses:
SqlDefQueryRequest
,SqlQueryRequest
public abstract class QueryRequest
extends java.lang.Object
Encapsulates a request to execute a SQL query,
parameters bound and optional paging constraints.
-
Constructor Summary
Constructors Constructor Description QueryRequest()
-
Method Summary
Modifier and Type Method Description java.lang.String
getDatasourceName()
java.util.Set<java.lang.Class<? extends NamedMacro>>
getMacros()
Set ofNamedMacro
to be processed on the query prior to execution.java.lang.Long
getPageNumber()
java.lang.Long
getPageSize()
Returns the number of records per page, or null to indicate that all results are being fetchedSqlParams
getParams()
Returns the params to bind to the sql queryboolean
isPagingRowIncluded()
void
setDatasourceName(java.lang.String datasourceName)
Optionally, provide the name of a datasource to be used when executing the query.void
setPageNumber(java.lang.Long pageNumber)
void
setPageSize(java.lang.Long pageSize)
Sets the number of records per page, or null to indicate that all results are being fetchedvoid
setPagingRowIncluded(boolean pagingRowIncluded)
void
setParams(SqlParams params)
Sets the params to bind to the sql query
-
Constructor Details
-
QueryRequest
public QueryRequest()
-
-
Method Details
-
getPageSize
public java.lang.Long getPageSize()Returns the number of records per page, or null to indicate that all results are being fetched -
setPageSize
public void setPageSize(java.lang.Long pageSize)Sets the number of records per page, or null to indicate that all results are being fetched- Parameters:
pageSize
- records per page, or null
-
getPageNumber
public java.lang.Long getPageNumber()- Returns:
- the pageNumber, where 1 is the first page for ORACLE dbType and 0 for MARIA/MYSQL
-
setPageNumber
public void setPageNumber(java.lang.Long pageNumber)- Parameters:
pageNumber
- the pageNumber to set. For ORACLE dbType, pageNumber is 1-indexed whereas for MYSQL or MARIA, pageNumber is 0-indexed
-
isPagingRowIncluded
public boolean isPagingRowIncluded()- Returns:
- boolean flag showing, whether one extra row, used for paging, is loaded or not
-
setPagingRowIncluded
public void setPagingRowIncluded(boolean pagingRowIncluded)- Parameters:
pagingRowIncluded
- the pagingRowIncluded to set. when true, extra row is loaded to determine, if next page is available
-
getParams
Returns the params to bind to the sql query -
setParams
Sets the params to bind to the sql query- Parameters:
params
- params to bind to the sql query
-
getDatasourceName
public java.lang.String getDatasourceName()- Returns:
- the datasourceName
-
setDatasourceName
public void setDatasourceName(java.lang.String datasourceName)Optionally, provide the name of a datasource to be used when executing the query. The datasource must be consistent with the dbType of the associated SqlDef. -
getMacros
Set ofNamedMacro
to be processed on the query prior to execution. (These are run before all global macros are run.) This is a mutable collection, so you can add to it. It will never be null.
-