Package com.jcabi.jdbc
Class ColumnOutcome<T>
- java.lang.Object
-
- com.jcabi.jdbc.ColumnOutcome<T>
-
- Type Parameters:
T- Type of items
- All Implemented Interfaces:
Outcome<Collection<T>>
public final class ColumnOutcome<T> extends Object implements Outcome<Collection<T>>
Outcome that returns first column.Use it when you need the first column:
Collection&lgt;Long> salaries = new JdbcSession(source) .sql("SELECT salary FROM user") .select(new ColumnOutcome<Long>(Long.class));Supported types are:
String,Long,Boolean,Byte,Date,UUID, andUtc.- Since:
- 0.13
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.jcabi.jdbc.Outcome
Outcome.Mapping<T>, Outcome.Mappings
-
-
Field Summary
-
Fields inherited from interface com.jcabi.jdbc.Outcome
DEFAULT_MAPPINGS, LAST_INSERT_ID, NOT_EMPTY, UPDATE_COUNT, VOID
-
-
Constructor Summary
Constructors Constructor Description ColumnOutcome(Class<T> tpe)Public ctor.ColumnOutcome(Class<T> tpe, Outcome.Mappings mps)Public ctor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<T>handle(ResultSet rset, Statement stmt)Process the result set and return some value.
-
-
-
Constructor Detail
-
ColumnOutcome
public ColumnOutcome(Class<T> tpe)
Public ctor.- Parameters:
tpe- The type to convert to
-
ColumnOutcome
public ColumnOutcome(Class<T> tpe, Outcome.Mappings mps)
Public ctor.- Parameters:
tpe- The type to convert tomps- The mappings.
-
-
Method Detail
-
handle
public Collection<T> handle(ResultSet rset, Statement stmt) throws SQLException
Description copied from interface:OutcomeProcess the result set and return some value.- Specified by:
handlein interfaceOutcome<T>- Parameters:
rset- The result set to processstmt- The statement used in the run- Returns:
- The result
- Throws:
SQLException- If something goes wrong inside
-
-