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 void
bindParam
(PreparedStatement statement, int index, byte[] value) static void
bindParam
(PreparedStatement statement, int index, Boolean value) static void
bindParam
(PreparedStatement statement, int index, Double value) static void
bindParam
(PreparedStatement statement, int index, Integer value) static void
bindParam
(PreparedStatement statement, int index, Long value) static void
bindParam
(PreparedStatement statement, int index, String value) static void
bindParam
(PreparedStatement statement, int index, BigDecimal value) static void
bindParam
(PreparedStatement statement, int index, Date value) static void
bindParam
(PreparedStatement statement, int index, Timestamp value) static void
bindParam
(PreparedStatement statement, int index, LocalDate value) static void
bindParam
(PreparedStatement statement, int index, LocalDateTime value) static void
bindParam
(PreparedStatement statement, int index, Calendar value) static void
bindParamNull
(PreparedStatement statement, int index) static int
bindParamObject
(PreparedStatement statement, int index, Object value) index is 1-based!!static void
bindParams
(PreparedStatement statement, Object... params) static void
executeStatement
(Connection connection, String sql, QueryManager.ResultSetProcessor processor, Object... params) static void
executeStatement
(PreparedStatement statement, QueryManager.ResultSetProcessor processor, Object... params) Let the caller provide their own prepared statement (e.g., possibly with some customized settings/optimizations).static void
executeStatement
(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> T
executeStatementForSingleValue
(Connection connection, Class<T> returnClass, String sql, Object... params) static PreparedStatement
executeUpdate
(Connection connection, String sql, Object... params) static PreparedStatement
executeUpdate
(Connection connection, String sql, List<Object> params) static Integer
executeUpdateForRowCount
(Connection connection, String sql, Object... params) static BigDecimal
getBigDecimal
(ResultSet resultSet, int column) static BigDecimal
getBigDecimal
(ResultSet resultSet, String column) static Boolean
getBoolean
(ResultSet resultSet, int column) static Boolean
getBoolean
(ResultSet resultSet, String column) static byte[]
getByteArray
(ResultSet resultSet, int column) static byte[]
getByteArray
(ResultSet resultSet, String column) static Calendar
getCalendar
(ResultSet resultSet, int column) static Calendar
getCalendar
(ResultSet resultSet, String column) static Date
static Date
static Instant
getInstant
(ResultSet resultSet, int column) static Instant
getInstant
(ResultSet resultSet, String column) static Integer
getInteger
(ResultSet resultSet, int column) static Integer
getInteger
(ResultSet resultSet, String column) static LocalDate
getLocalDate
(ResultSet resultSet, int column) static LocalDate
getLocalDate
(ResultSet resultSet, String column) static LocalDateTime
getLocalDateTime
(ResultSet resultSet, int column) static LocalDateTime
getLocalDateTime
(ResultSet resultSet, String column) static LocalTime
getLocalTime
(ResultSet resultSet, int column) static LocalTime
getLocalTime
(ResultSet resultSet, String column) static Long
static Long
static Object
static Object
static OffsetDateTime
getOffsetDateTime
(ResultSet resultSet, int column) static OffsetDateTime
getOffsetDateTime
(ResultSet resultSet, String column) Getter for statisticsstatic String
static String
static Timestamp
getTimestamp
(ResultSet resultSet, int column) static Timestamp
getTimestamp
(ResultSet resultSet, String column) static void
incrementStatistic
(String statName) Increment a statisticstatic void
static void
clear the map of statisticsstatic void
setCollectStatistics
(boolean collectStatistics) Setter for collectStatisticsstatic void
setPageSize
(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:
SQLException
QException
-
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:
SQLException
QException
-
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:
SQLException
QException
-
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()
-