T
- Type of expected resultpublic interface Outcome<T>
The following convenience implementations are provided:
NOT_EMPTY
to check that at least one result row is
returned.
VOID
for when you wish to disregard the result.
UPDATE_COUNT
to check the number of updated rows.
Modifier and Type | Field and Description |
---|---|
static Outcome<Long> |
LAST_INSERT_ID
Outcome that returns last insert ID.
|
static Outcome<Boolean> |
NOT_EMPTY
Returns
TRUE if at least one SQL record found in
ResultSet . |
static Outcome<Integer> |
UPDATE_COUNT
Outcome that returns the number of updated rows.
|
static Outcome<Void> |
VOID
Outcome that does nothing (and always returns
null ). |
static final Outcome<Boolean> NOT_EMPTY
TRUE
if at least one SQL record found in
ResultSet
.
The outcome returns the value of ResultSet.next()
and throws
SQLException
in case of a problem.
static final Outcome<Void> VOID
null
).
Useful when you're not interested in the result:
new JdbcSession(source) .sql("INSERT INTO foo (name) VALUES (?)") .set("Jeff Lebowski") .insert(Outcome.VOID);
static final Outcome<Integer> UPDATE_COUNT
Use it when you need to determine the number of rows updated:
Integer count = new JdbcSession(source) .sql("UPDATE employee SET salary = 35000 WHERE department = ?") .set("Finance") .update(Outcome.UPDATE_COUNT);
T handle(ResultSet rset, Statement stmt) throws SQLException
rset
- The result set to processstmt
- The statement used in the runSQLException
- If something goes wrong insideCopyright © 2012–2015 jcabi.com. All rights reserved.