[#7101] Add T DSLContext.fetchValue(Field<T>)
This commit is contained in:
parent
ca98250aae
commit
54b8e03d4d
@ -10654,6 +10654,16 @@ public interface DSLContext extends Scope , AutoCloseable {
|
||||
*/
|
||||
<T> T fetchValue(TableField<?, T> field) throws DataAccessException, TooManyRowsException, InvalidResultException;
|
||||
|
||||
/**
|
||||
* Execute a {@link ResultQuery} in the context of this
|
||||
* <code>DSLContext</code> and return a single value.
|
||||
*
|
||||
* @param field The field for which to fetch a single value.
|
||||
* @return The value or <code>null</code>, if no record was found.
|
||||
* @throws DataAccessException if something went wrong executing the query
|
||||
*/
|
||||
<T> T fetchValue(Field<T> field) throws DataAccessException;
|
||||
|
||||
|
||||
/**
|
||||
* Execute a {@link ResultQuery} in the context of this
|
||||
|
||||
@ -4145,6 +4145,11 @@ public class DefaultDSLContext extends AbstractScope implements DSLContext, Seri
|
||||
return fetchValue(select(field).from(field.getTable()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T fetchValue(Field<T> field) {
|
||||
return fetchValue(select(field));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public <T, R extends Record1<T>> Optional<T> fetchOptionalValue(ResultQuery<R> query) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user