Package org.r10r.sqlify
Class Sqlify.Builder
- java.lang.Object
-
- org.r10r.sqlify.Sqlify.Builder
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <E> EexecuteSelect(Connection connection)Executes a select.intexecuteUpdate(Connection connection)Executes an update (insert, delete statement)<E> EexecuteUpdateAndReturnGeneratedKey(Connection connection)Executes an update (insert, delete statement) and returns the generated key.Sqlify.BuilderparseResultWith(ResultParser<?> resultParser)Sqlify.BuilderwithParameter(String key, Object value)
-
-
-
Method Detail
-
withParameter
public Sqlify.Builder withParameter(String key, Object value)
-
parseResultWith
public Sqlify.Builder parseResultWith(ResultParser<?> resultParser)
-
executeSelect
public <E> E executeSelect(Connection connection)
Executes a select. Use 'parseResultWith' to specify a parser that will map the result to nice Java objects.- Parameters:
connection- The connection to use for this query.- Returns:
- The result as specified via 'parseResultWith'
-
executeUpdate
public int executeUpdate(Connection connection)
Executes an update (insert, delete statement)- Parameters:
connection- The connection to use for this query.- Returns:
- The number of lines affected by this query.
-
executeUpdateAndReturnGeneratedKey
public <E> E executeUpdateAndReturnGeneratedKey(Connection connection)
Executes an update (insert, delete statement) and returns the generated key. Define the mapping via a ResultParser. For instance if you expect one Long as result you can use parseResultWith(SingleResultParser.of(Long.class))- Parameters:
connection- The connection to use for this query.- Returns:
- The generated key.
-
-