public.javadoc.org.spincast.plugins.jdbc.statements.SelectStatementDefault.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spincast-website Show documentation
Show all versions of spincast-website Show documentation
Source code for the https://www.spincast.org website.
SelectStatementDefault (org.spincast:spincast-framework 1.0.0 API)
org.spincast.plugins.jdbc.statements
Class SelectStatementDefault
- java.lang.Object
-
- org.spincast.plugins.jdbc.statements.StatementBase
-
- org.spincast.plugins.jdbc.statements.SelectStatementDefault
-
- All Implemented Interfaces:
- SelectStatement, Statement
public class SelectStatementDefault
extends StatementBase
implements SelectStatement
-
-
Field Summary
Fields
Modifier and Type
Field and Description
protected static org.slf4j.Logger
logger
-
Constructor Summary
Constructors
Constructor and Description
SelectStatementDefault(Connection connection,
JdbcUtils jdbcUtils)
-
Method Summary
All Methods Instance Methods Concrete Methods
Modifier and Type
Method and Description
protected JdbcUtils
getJdbcUtils()
protected PreparedStatement
getStatementWithParamsAdded(Connection connection)
protected long
getTotalFromSelectQuery(Connection connection)
Returns -1 to indicate the number of items should be taken instead of the total
found by a generated query.
<T> List<T>
selectList(ResultSetHandler<T> resultSetHandler)
protected <T> ItemsAndTotalCount<T>
selectList(ResultSetHandler<T> resultSetHandler,
boolean getTotal)
<T> ItemsAndTotalCount<T>
selectListAndTotal(ResultSetHandler<T> resultSetHandler)
Executes the SELECT query but also returns the total of items.
<T> T
selectOne(ResultSetHandler<T> resultSetHandler)
-
Methods inherited from class org.spincast.plugins.jdbc.statements.StatementBase
addCurrentParamsToStatement, addParam, addParamsToStatement, clearParams, clearSql, clearSql, close, close, copyParamsAndStaticTokensTo, getConnection, getIndexMap, getOriginalQuery, getParams, getParsedQuery, getQueryBuilder, getSql, getSqlFormmatter, getStaticTokens, parse, setBoolean, setDate, setDouble, setFloat, setInInteger, setInLong, setInstant, setInString, setInStringFromEnumNames, setInStringFromEnumNames, setInteger, setLong, setLongList, setParams, setStaticTokens, setString, sql, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.spincast.plugins.jdbc.statements.Statement
clearSql, clearSql, getSql, setBoolean, setDate, setDouble, setFloat, setInInteger, setInLong, setInstant, setInString, setInStringFromEnumNames, setInStringFromEnumNames, setInteger, setLong, setLongList, setString, sql
-
-
Constructor Detail
-
SelectStatementDefault
public SelectStatementDefault(Connection connection,
JdbcUtils jdbcUtils)
-
Method Detail
-
getJdbcUtils
protected JdbcUtils getJdbcUtils()
-
getStatementWithParamsAdded
protected PreparedStatement getStatementWithParamsAdded(Connection connection)
-
selectOne
public <T> T selectOne(ResultSetHandler<T> resultSetHandler)
- Specified by:
selectOne
in interface SelectStatement
-
selectList
public <T> List<T> selectList(ResultSetHandler<T> resultSetHandler)
- Specified by:
selectList
in interface SelectStatement
-
selectListAndTotal
public <T> ItemsAndTotalCount<T> selectListAndTotal(ResultSetHandler<T> resultSetHandler)
Description copied from interface: SelectStatement
Executes the SELECT query but also returns the total of items.
It will remove the LIMIT clause if there is one to compute the total.
For the generated "total" query to work there are a couple of rules :
- The original query MUST start with SELECT and contains a FROM. All conditions between this SELECT keyword and
the FROM keyword will be removed and replaced by a COUNT(*).
- If the query contains a LIMIT clause, the last occurence will be remove and everything after it too.
If your query doesn't meet those rules, you'll have to retrieve the total another way...
- Specified by:
selectListAndTotal
in interface SelectStatement
-
selectList
protected <T> ItemsAndTotalCount<T> selectList(ResultSetHandler<T> resultSetHandler,
boolean getTotal)
-
getTotalFromSelectQuery
protected long getTotalFromSelectQuery(Connection connection)
Returns -1 to indicate the number of items should be taken instead of the total
found by a generated query.
Copyright © 2019. All rights reserved.