Uses of Interface
com.google.mu.safesql.SqlFunction
Packages that use SqlFunction
Package
Description
Injection-safe SQL template (requires mug-safesql artifact)
-
Uses of SqlFunction in com.google.mu.safesql
Methods in com.google.mu.safesql with parameters of type SqlFunctionModifier and TypeMethodDescriptionstatic <T> StringFormat.Template
<List<T>> SafeSql.prepareToQuery
(Connection connection, String template, SqlFunction<? super ResultSet, ? extends T> rowMapper) Returns a query template that will reuse the same cachedPreparedStatement
for repeated calls ofStringFormat.Template.with(java.lang.Object...)
using different parameters.<T> List
<T> SafeSql.query
(Connection connection, SqlFunction<? super ResultSet, ? extends T> rowMapper) Similar toSafeSql.query(DataSource, SqlFunction)
, but uses an existing connection.<T> List
<T> SafeSql.query
(Connection connection, StatementSettings settings, SqlFunction<? super ResultSet, ? extends T> rowMapper) Similar toSafeSql.query(DataSource, StatementSettings, SqlFunction)
, but uses an existing connection.<T> List
<T> SafeSql.query
(DataSource dataSource, SqlFunction<? super ResultSet, ? extends T> rowMapper) Executes the encapsulated SQL as a query againstdataSource.getConnection()
.<T> List
<T> SafeSql.query
(DataSource dataSource, StatementSettings settings, SqlFunction<? super ResultSet, ? extends T> rowMapper) Executes the encapsulated SQL as a query againstdataSource.getConnection()
, usingsettings
(can be set via lambda likestmt -> stmt.setMaxRows(100)
).<T> Optional
<T> SafeSql.queryForOne
(Connection connection, SqlFunction<? super ResultSet, ? extends T> rowMapper) Similar toSafeSql.query(Connection, SqlFunction)
, but only fetches one row if the query result includes at least one rows, or else returnsOptional.empty()
.<T> Optional
<T> SafeSql.queryForOne
(DataSource dataSource, SqlFunction<? super ResultSet, ? extends T> rowMapper) Similar toSafeSql.query(DataSource, SqlFunction)
, but only fetches one row if the query result includes at least one rows, or else returnsOptional.empty()
.<T> Stream
<T> SafeSql.queryLazily
(Connection connection, SqlFunction<? super ResultSet, ? extends T> rowMapper) Executes the encapsulated SQL as a query againstconnection
, and then fetches the results lazily in a stream.<T> Stream
<T> SafeSql.queryLazily
(Connection connection, StatementSettings settings, SqlFunction<? super ResultSet, ? extends T> rowMapper) Executes the encapsulated SQL as a query againstconnection
, withsettings
(can be set via lambda likestmt -> stmt.setFetchSize(100)
, and then fetches the results lazily in a stream.<T> Stream
<T> SafeSql.queryLazily
(DataSource dataSource, SqlFunction<? super ResultSet, ? extends T> rowMapper) Executes the encapsulated SQL as a query againstconnection
, and then fetches the results lazily in a stream.<T> Stream
<T> SafeSql.queryLazily
(DataSource dataSource, StatementSettings settings, SqlFunction<? super ResultSet, ? extends T> rowMapper) Executes the encapsulated SQL as a query againstdataSource
, withsettings
(can be set via lambda likestmt -> stmt.setFetchSize(100)
, and then fetches the results lazily in a stream.