Class InsertResult

java.lang.Object
org.litebridge.db.spi.update.UpdateResult
org.litebridge.db.spi.update.InsertResult
All Implemented Interfaces:
Result, UpdateOpResult

public final class InsertResult extends UpdateResult implements Result
The result of an insert operation performed on the database.

This class extends UpdateOpResult and adds the ability to hold any generated keys resulting from the insert operation.

Instances of this class encapsulate both the number of rows affected by the insert operation and optionally a map of generated keys, if applicable.

  • Constructor Details

    • InsertResult

      public InsertResult(int rowsInserted)
      Constructs an InsertOpResult instance representing the result of an insert operation performed on the database.
      Parameters:
      rowsInserted - The number of rows inserted by the operation.
    • InsertResult

      public InsertResult(int rowsInserted, Map<ColumnMetaData,Object> generatedKeys)
      Constructs an InsertOpResult instance representing the result of a single insert operation performed on the database.
      Parameters:
      generatedKeys - A map of generated keys resulting from the insert operation.
    • InsertResult

      public InsertResult(int rowsInserted, List<Map<ColumnMetaData,Object>> generatedKeys)
      Constructs an InsertOpResult instance representing the result of a multi-row insert operation performed on the database.
      Parameters:
      rowsInserted - The number of rows inserted by the operation.
      generatedKeys - A map of generated keys resulting from the insert operation.
  • Method Details

    • generatedKeys

      public List<Map<ColumnMetaData,Object>> generatedKeys()
      Returns a per-row list of generated keys resulting from the insert operation.
      Returns:
      List for each affected row, containing a map of generated keys.
    • toString

      public String toString()
      Overrides:
      toString in class UpdateResult