-
- All Superinterfaces:
Attachable,Collection<Result<Record>>,Iterable<Result<Record>>,List<Result<Record>>,Serializable
public interface Results extends List<Result<Record>>, Attachable
A list ofResultand update counts that can be returned byResultQuery.fetchMany()calls and other calls that produce multiple cursors and update counts.For backwards-compatibility (e.g. with
ResultQuery.fetchMany()), this type extendsListcontaining only theResult, not the rows, update counts, exceptions of interleaved updates. In order to get them all, callresultsOrRows()upon the results.Exceptions
Some databases support raising several errors or exceptions per statement batch (e.g.
SQLDialect.SQLSERVER):INSERT INTO t VALUES (1),(2),(3); RAISERROR('message 1', 16, 2, 3); RAISERROR('message 2', 16, 2, 3); SELECT * FROM t; RAISERROR('message 3', 16, 2, 3);The above batch will produce:
- An update count (3)
- 2 exceptions
- A result set
- 1 exception
By default (or when explicitly specifying
ThrowExceptions.THROW_ALLinSettings.getThrowExceptions()), this particular batch will produce a single exception corresponding to"message 1", with additional exceptions for"message 2"and"message 3"attached toSQLException.getNextException(), recursively.When specifying
ThrowExceptions.THROW_FIRST, only"message 1"is propagated. When specifyingThrowExceptions.THROW_NONE, then all exceptions are collected as results and are made available throughresultsOrRows()inResultOrRows.exception().- Author:
- Lukas Eder
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidattach(Configuration configuration)Attach all results and all of their contained records to a newConfiguration.voiddetach()Detach all results and all of their contained records from their currentConfiguration.@NotNull List<ResultOrRows>resultsOrRows()All the results or update counts in their order as fetched via JDBC.-
Methods inherited from interface org.jooq.Attachable
configuration
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray
-
-
-
-
Method Detail
-
resultsOrRows
@NotNull @NotNull List<ResultOrRows> resultsOrRows()
All the results or update counts in their order as fetched via JDBC.While
List.iterator()and all the other methods inherited from theListAPI return theResultobjects only, this method also includes update counts that may have occurred between two results.It can be safely assumed that:
result.resultsOrRows() .stream() .filter(r -> r.result() != null) .map(r -> r.result()) .collect(Collectors.toList()) .equals(result);
-
attach
void attach(Configuration configuration)
Attach all results and all of their contained records to a newConfiguration.- Specified by:
attachin interfaceAttachable- Parameters:
configuration- A configuration ornull, if you wish to detach thisAttachablefrom its previous configuration.
-
detach
void detach()
Detach all results and all of their contained records from their currentConfiguration.This is the same as calling
attach(null).- Specified by:
detachin interfaceAttachable
-
-