Module org.firebirdsql.jaybird
Package org.firebirdsql.gds.ng

# Class BatchCompletion

java.lang.Object
org.firebirdsql.gds.ng.BatchCompletion

public final class BatchCompletion extends Object
Completion data from a batch execute.

Since:
  5
Author:
  Mark Rotteveel

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static final class`
  `BatchCompletion.DetailedError`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BatchCompletion(int elementCount, int[] updateCounts, List<BatchCompletion.DetailedError> detailedErrors, int[] simplifiedErrors)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `List<BatchCompletion.DetailedError>`
  `detailedErrors()`
  Detailed errors per failed element, reporting the failed element number and `SQLException`.
  `int`
  `elementCount()`
  `boolean`
  `hasErrors()`
  `int[]`
  `simplifiedErrors()`
  Simplified errors, reports failed element number, when error count exceeds the maximum detailed errors.
  `int[]`
  `updateCounts()`
  Update counts per element.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### BatchCompletion

    public BatchCompletion(int elementCount, int[] updateCounts, List<BatchCompletion.DetailedError> detailedErrors, int[] simplifiedErrors)

- ## Method Details

  - ### elementCount

    public int elementCount()
    Returns:
      number of elements (batch row values) processed by the server.

  - ### updateCounts

    public int[] updateCounts()
    Update counts per element.

    Reports either the update count, `-1` (`BatchItems.BATCH_EXECUTE_FAILED` if the element resulted in an error (NOTE: JDBC uses `-3` (`Statement.EXECUTE_FAILED`!), or `-2` (`BatchItems.BATCH_SUCCESS_NO_INFO`) for success without update count (equivalent to `Statement.SUCCESS_NO_INFO`).

    The array is empty if `TAG_RECORD_COUNTS` was not requested.

    Note that contrary to JDBC, if `TAG_MULTIERROR` is not requested, the last update count will be `-1` for the failed record (JDBC expects the update counts to end before the first failure).

    Returns:
      update counts

  - ### detailedErrors

    public List<BatchCompletion.DetailedError> detailedErrors()
    Detailed errors per failed element, reporting the failed element number and `SQLException`.

    Will have at most 1 error if `TAG_MULTIERROR` is not requested.

    By default, at most 64 detailed errors will be reported (at most 256 can be requested with `TAG_DETAILED_ERRORS`). The remaining errors will be reported in `simplifiedErrors`. The limits and defaults mentioned are as of Firebird 4 and not enforced by Jaybird.

    Returns:
      detailed errors

  - ### simplifiedErrors

    public int[] simplifiedErrors()
    Simplified errors, reports failed element number, when error count exceeds the maximum detailed errors.
    Returns:
      rows with errors without detailed error information

  - ### hasErrors

    public boolean hasErrors()
    Returns:
      `true` if there are any errors, `false` otherwise