Class QueryManager
java.lang.Object
com.kingsrook.qqq.backend.module.rdbms.jdbc.QueryManager
Note that much of this class is/was ported (well, copied) to BaseRDBMSActionStrategy
around 2025-01, during the addition of SQLite backend module.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidbindParam(PreparedStatement statement, int index, byte[] value) static voidbindParam(PreparedStatement statement, int index, Boolean value) static voidbindParam(PreparedStatement statement, int index, Double value) static voidbindParam(PreparedStatement statement, int index, Integer value) static voidbindParam(PreparedStatement statement, int index, Long value) static voidbindParam(PreparedStatement statement, int index, String value) static voidbindParam(PreparedStatement statement, int index, BigDecimal value) static voidbindParam(PreparedStatement statement, int index, Date value) static voidbindParam(PreparedStatement statement, int index, Timestamp value) static voidbindParam(PreparedStatement statement, int index, LocalDate value) static voidbindParam(PreparedStatement statement, int index, LocalDateTime value) static voidbindParam(PreparedStatement statement, int index, Calendar value) static voidbindParamNull(PreparedStatement statement, int index) static intbindParamObject(PreparedStatement statement, int index, Object value) index is 1-based!!static voidbindParams(PreparedStatement statement, Object... params) static voidexecuteStatement(Connection connection, String sql, QueryManager.ResultSetProcessor processor, Object... params) static voidexecuteStatement(PreparedStatement statement, QueryManager.ResultSetProcessor processor, Object... params) Let the caller provide their own prepared statement (e.g., possibly with some customized settings/optimizations).static voidexecuteStatement(PreparedStatement statement, CharSequence sql, QueryManager.ResultSetProcessor processor, Object... params) Let the caller provide their own prepared statement (e.g., possibly with some customized settings/optimizations).executeStatementForRows(Connection connection, String sql, Object... params) static <T> TexecuteStatementForSingleValue(Connection connection, Class<T> returnClass, String sql, Object... params) static PreparedStatementexecuteUpdate(Connection connection, String sql, Object... params) static PreparedStatementexecuteUpdate(Connection connection, String sql, List<Object> params) static IntegerexecuteUpdateForRowCount(Connection connection, String sql, Object... params) static BigDecimalgetBigDecimal(ResultSet resultSet, int column) static BigDecimalgetBigDecimal(ResultSet resultSet, String column) static BooleangetBoolean(ResultSet resultSet, int column) static BooleangetBoolean(ResultSet resultSet, String column) static byte[]getByteArray(ResultSet resultSet, int column) static byte[]getByteArray(ResultSet resultSet, String column) static CalendargetCalendar(ResultSet resultSet, int column) static CalendargetCalendar(ResultSet resultSet, String column) static Datestatic Datestatic InstantgetInstant(ResultSet resultSet, int column) static InstantgetInstant(ResultSet resultSet, String column) static IntegergetInteger(ResultSet resultSet, int column) static IntegergetInteger(ResultSet resultSet, String column) static LocalDategetLocalDate(ResultSet resultSet, int column) static LocalDategetLocalDate(ResultSet resultSet, String column) static LocalDateTimegetLocalDateTime(ResultSet resultSet, int column) static LocalDateTimegetLocalDateTime(ResultSet resultSet, String column) static LocalTimegetLocalTime(ResultSet resultSet, int column) static LocalTimegetLocalTime(ResultSet resultSet, String column) static Longstatic Longstatic Objectstatic Objectstatic OffsetDateTimegetOffsetDateTime(ResultSet resultSet, int column) static OffsetDateTimegetOffsetDateTime(ResultSet resultSet, String column) Getter for statisticsstatic Stringstatic Stringstatic TimestampgetTimestamp(ResultSet resultSet, int column) static TimestampgetTimestamp(ResultSet resultSet, String column) static voidincrementStatistic(String statName) Increment a statisticstatic voidstatic voidclear the map of statisticsstatic voidsetCollectStatistics(boolean collectStatistics) Setter for collectStatisticsstatic voidsetPageSize(int pageSize) Note - this changes a static field that impacts all usages.
-
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
-
QueryManager
public QueryManager()
-
-
Method Details
-
executeStatement
public static void executeStatement(Connection connection, String sql, QueryManager.ResultSetProcessor processor, Object... params) throws SQLException, QException - Throws:
SQLExceptionQException
-
executeStatement
public static void executeStatement(PreparedStatement statement, QueryManager.ResultSetProcessor processor, Object... params) throws SQLException, QException Let the caller provide their own prepared statement (e.g., possibly with some customized settings/optimizations).- Throws:
SQLExceptionQException
-
executeStatement
public static void executeStatement(PreparedStatement statement, CharSequence sql, QueryManager.ResultSetProcessor processor, Object... params) throws SQLException, QException Let the caller provide their own prepared statement (e.g., possibly with some customized settings/optimizations).- Throws:
SQLExceptionQException
-
executeStatementForSingleValue
public static <T> T executeStatementForSingleValue(Connection connection, Class<T> returnClass, String sql, Object... params) throws SQLException - Throws:
SQLException
-
executeStatementForRows
public static List<Map<String,Object>> executeStatementForRows(Connection connection, String sql, Object... params) throws SQLException - Throws:
SQLException
-
executeUpdate
public static PreparedStatement executeUpdate(Connection connection, String sql, Object... params) throws SQLException - Throws:
SQLException
-
executeUpdate
public static PreparedStatement executeUpdate(Connection connection, String sql, List<Object> params) throws SQLException - Throws:
SQLException
-
executeUpdateForRowCount
public static Integer executeUpdateForRowCount(Connection connection, String sql, Object... params) throws SQLException - Throws:
SQLException
-
bindParams
- Throws:
SQLException
-
bindParamObject
public static int bindParamObject(PreparedStatement statement, int index, Object value) throws SQLException index is 1-based!!- Throws:
SQLException
-
bindParam
public static void bindParam(PreparedStatement statement, int index, Integer value) throws SQLException - Throws:
SQLException
-
bindParam
public static void bindParam(PreparedStatement statement, int index, Long value) throws SQLException - Throws:
SQLException
-
bindParam
public static void bindParam(PreparedStatement statement, int index, Double value) throws SQLException - Throws:
SQLException
-
bindParam
public static void bindParam(PreparedStatement statement, int index, String value) throws SQLException - Throws:
SQLException
-
bindParam
public static void bindParam(PreparedStatement statement, int index, Boolean value) throws SQLException - Throws:
SQLException
-
bindParam
public static void bindParam(PreparedStatement statement, int index, Date value) throws SQLException - Throws:
SQLException
-
bindParam
public static void bindParam(PreparedStatement statement, int index, Timestamp value) throws SQLException - Throws:
SQLException
-
bindParam
public static void bindParam(PreparedStatement statement, int index, Calendar value) throws SQLException - Throws:
SQLException
-
bindParam
public static void bindParam(PreparedStatement statement, int index, LocalDate value) throws SQLException - Throws:
SQLException
-
bindParam
public static void bindParam(PreparedStatement statement, int index, LocalDateTime value) throws SQLException - Throws:
SQLException
-
bindParam
public static void bindParam(PreparedStatement statement, int index, BigDecimal value) throws SQLException - Throws:
SQLException
-
bindParam
public static void bindParam(PreparedStatement statement, int index, byte[] value) throws SQLException - Throws:
SQLException
-
bindParamNull
- Throws:
SQLException
-
getInteger
- Throws:
SQLException
-
getInteger
- Throws:
SQLException
-
getByteArray
- Throws:
SQLException
-
getByteArray
- Throws:
SQLException
-
getObject
- Throws:
SQLException
-
getObject
- Throws:
SQLException
-
getString
- Throws:
SQLException
-
getString
- Throws:
SQLException
-
getBigDecimal
- Throws:
SQLException
-
getBigDecimal
- Throws:
SQLException
-
getDate
- Throws:
SQLException
-
getDate
- Throws:
SQLException
-
getLocalTime
- Throws:
SQLException
-
getLocalTime
- Throws:
SQLException
-
getCalendar
- Throws:
SQLException
-
getCalendar
- Throws:
SQLException
-
getLocalDate
- Throws:
SQLException
-
getLocalDate
- Throws:
SQLException
-
getLocalDateTime
public static LocalDateTime getLocalDateTime(ResultSet resultSet, String column) throws SQLException - Throws:
SQLException
-
getLocalDateTime
- Throws:
SQLException
-
getInstant
- Throws:
SQLException
-
getInstant
- Throws:
SQLException
-
getOffsetDateTime
public static OffsetDateTime getOffsetDateTime(ResultSet resultSet, String column) throws SQLException - Throws:
SQLException
-
getOffsetDateTime
- Throws:
SQLException
-
getBoolean
- Throws:
SQLException
-
getBoolean
- Throws:
SQLException
-
getLong
- Throws:
SQLException
-
getLong
- Throws:
SQLException
-
getTimestamp
- Throws:
SQLException
-
getTimestamp
- Throws:
SQLException
-
setCollectStatistics
public static void setCollectStatistics(boolean collectStatistics) Setter for collectStatistics -
incrementStatistic
Increment a statistic -
resetStatistics
public static void resetStatistics()clear the map of statistics -
getStatistics
-
setPageSize
public static void setPageSize(int pageSize) Note - this changes a static field that impacts all usages. Really, it's meant to only be called in unit tests (at least as of the time of this writing). -
resetPageSize
public static void resetPageSize()
-