Class BaseRDBMSActionStrategy
java.lang.Object
com.kingsrook.qqq.backend.module.rdbms.strategy.BaseRDBMSActionStrategy
- All Implemented Interfaces:
RDBMSActionStrategyInterface
- Direct Known Subclasses:
MySQLFullTextIndexFieldStrategy
,SQLiteRDBMSActionStrategy
Note that much of this class came from the old (old) QueryManager class.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.kingsrook.qqq.backend.module.rdbms.strategy.RDBMSActionStrategyInterface
RDBMSActionStrategyInterface.ResultSetProcessor
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappendCriterionToWhereClause
(QFilterCriteria criterion, StringBuilder clause, String column, List<Serializable> values, QFieldMetaData field) modifies the clause StringBuilder (appending to it) returning the number of expected number of params to bindprotected void
bindParam
(PreparedStatement statement, int index, byte[] value) protected void
bindParam
(PreparedStatement statement, int index, Boolean value) protected void
bindParam
(PreparedStatement statement, int index, Double value) protected void
bindParam
(PreparedStatement statement, int index, Integer value) protected void
bindParam
(PreparedStatement statement, int index, Long value) protected void
bindParam
(PreparedStatement statement, int index, String value) protected void
bindParam
(PreparedStatement statement, int index, BigDecimal value) protected void
bindParam
(PreparedStatement statement, int index, Date value) protected void
bindParam
(PreparedStatement statement, int index, Timestamp value) protected void
bindParam
(PreparedStatement statement, int index, LocalDate value) protected void
bindParam
(PreparedStatement statement, int index, LocalDateTime value) protected void
bindParam
(PreparedStatement statement, int index, Calendar value) protected void
bindParamNull
(PreparedStatement statement, int index) protected int
bindParamObject
(PreparedStatement statement, int index, Object value) index is 1-based!!protected void
bindParams
(Object[] params, PreparedStatement statement) void
executeBatchUpdate
(Connection connection, String updateSQL, List<List<Serializable>> values) executeInsertForGeneratedIds
(Connection connection, String sql, List<Object> params, QFieldMetaData primaryKeyField) void
executeStatement
(PreparedStatement statement, CharSequence sql, RDBMSActionStrategyInterface.ResultSetProcessor processor, Object... params) executeUpdate
(Connection connection, String sql, List<Object> params) executeUpdateForRowCount
(Connection connection, String sql, Object... params) protected String
getColumnName
(QFieldMetaData field) Get the column name to use for a field in the RDBMS, from the fieldMetaData.getFieldValueFromResultSet
(QFieldType type, ResultSet resultSet, int i) getPageSize
(AbstractActionInput actionInput) Getter for statisticsprotected void
incrementStatistic
(String statName) Increment a statisticprotected PreparedStatement
prepareStatementAndBindParams
(Connection connection, String sql, Object[] params) void
clear the map of statisticsvoid
setCollectStatistics
(boolean collectStatistics) Setter for collectStatisticsvoid
setPageSize
(int pageSize) Setter for pageSize
-
Field Details
-
DEFAULT_PAGE_SIZE
public static final int DEFAULT_PAGE_SIZE- See Also:
-
PAGE_SIZE
public static int PAGE_SIZE -
STAT_QUERIES_RAN
- See Also:
-
STAT_BATCHES_RAN
- See Also:
-
-
Constructor Details
-
BaseRDBMSActionStrategy
public BaseRDBMSActionStrategy()
-
-
Method Details
-
appendCriterionToWhereClause
public Integer appendCriterionToWhereClause(QFilterCriteria criterion, StringBuilder clause, String column, List<Serializable> values, QFieldMetaData field) Description copied from interface:RDBMSActionStrategyInterface
modifies the clause StringBuilder (appending to it) returning the number of expected number of params to bind- Specified by:
appendCriterionToWhereClause
in interfaceRDBMSActionStrategyInterface
-
getFieldValueFromResultSet
public Serializable getFieldValueFromResultSet(QFieldType type, ResultSet resultSet, int i) throws SQLException - Specified by:
getFieldValueFromResultSet
in interfaceRDBMSActionStrategyInterface
- Throws:
SQLException
-
executeUpdate
public PreparedStatement executeUpdate(Connection connection, String sql, List<Object> params) throws SQLException - Specified by:
executeUpdate
in interfaceRDBMSActionStrategyInterface
- Throws:
SQLException
-
executeBatchUpdate
public void executeBatchUpdate(Connection connection, String updateSQL, List<List<Serializable>> values) throws SQLException - Specified by:
executeBatchUpdate
in interfaceRDBMSActionStrategyInterface
- Throws:
SQLException
-
executeInsertForGeneratedIds
public List<Serializable> executeInsertForGeneratedIds(Connection connection, String sql, List<Object> params, QFieldMetaData primaryKeyField) throws SQLException - Specified by:
executeInsertForGeneratedIds
in interfaceRDBMSActionStrategyInterface
- Throws:
SQLException
-
executeUpdateForRowCount
public Integer executeUpdateForRowCount(Connection connection, String sql, Object... params) throws SQLException - Specified by:
executeUpdateForRowCount
in interfaceRDBMSActionStrategyInterface
- Throws:
SQLException
-
executeStatement
public void executeStatement(PreparedStatement statement, CharSequence sql, RDBMSActionStrategyInterface.ResultSetProcessor processor, Object... params) throws SQLException, QException - Specified by:
executeStatement
in interfaceRDBMSActionStrategyInterface
- Throws:
SQLException
QException
-
getPageSize
- Specified by:
getPageSize
in interfaceRDBMSActionStrategyInterface
-
prepareStatementAndBindParams
protected PreparedStatement prepareStatementAndBindParams(Connection connection, String sql, Object[] params) throws SQLException - Throws:
SQLException
-
bindParams
- Throws:
SQLException
-
bindParamObject
protected int bindParamObject(PreparedStatement statement, int index, Object value) throws SQLException index is 1-based!!- Throws:
SQLException
-
bindParam
- Throws:
SQLException
-
bindParam
- Throws:
SQLException
-
bindParam
- Throws:
SQLException
-
bindParam
- Throws:
SQLException
-
bindParam
- Throws:
SQLException
-
bindParam
- Throws:
SQLException
-
bindParam
protected void bindParam(PreparedStatement statement, int index, Timestamp value) throws SQLException - Throws:
SQLException
-
bindParam
protected void bindParam(PreparedStatement statement, int index, Calendar value) throws SQLException - Throws:
SQLException
-
bindParam
protected void bindParam(PreparedStatement statement, int index, LocalDate value) throws SQLException - Throws:
SQLException
-
bindParam
protected void bindParam(PreparedStatement statement, int index, LocalDateTime value) throws SQLException - Throws:
SQLException
-
bindParam
protected void bindParam(PreparedStatement statement, int index, BigDecimal value) throws SQLException - Throws:
SQLException
-
bindParam
- Throws:
SQLException
-
bindParamNull
- Throws:
SQLException
-
incrementStatistic
Increment a statistic -
setCollectStatistics
public void setCollectStatistics(boolean collectStatistics) Setter for collectStatistics -
resetStatistics
public void resetStatistics()clear the map of statistics -
getStatistics
-
setPageSize
public void setPageSize(int pageSize) Setter for pageSize -
getColumnName
Get the column name to use for a field in the RDBMS, from the fieldMetaData. That is, field.backendName if set -- else, field.name
-