Class UpdatableTuple

java.lang.Object
org.reldb.wrapd.sqldb.Tuple
org.reldb.wrapd.sqldb.UpdatableTuple
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public abstract class UpdatableTuple
extends Tuple
implements java.lang.Cloneable
The base class for all updatable tuples. Derived classes are usually auto-generated by TupleTypeGenerator.
See Also:
Serialized Form
  • Field Details

    • database

      protected final Database database
      Database used to create this Tuple.
  • Constructor Details

    • UpdatableTuple

      protected UpdatableTuple​(Database database)
      Constructor.
      Parameters:
      database - The Database that created this UpdatableTuple.
    • UpdatableTuple

      protected UpdatableTuple()
      Constructor. Not updatable.
  • Method Details

    • insert

      public java.util.List<UpdatableTuple.FieldGetFailure> insert​(java.sql.Connection connection, java.lang.String tableName) throws java.sql.SQLException
      Insert this Tuple.
      Parameters:
      connection - Connection to database, typically obtained via a Transaction.
      tableName - Table name.
      Returns:
      List of failures to retrieve one or more fields. Empty if all fields retrieved.
      Throws:
      java.sql.SQLException - Failure.
    • insert

      public java.util.List<UpdatableTuple.FieldGetFailure> insert​(java.lang.String tableName) throws java.sql.SQLException
      Insert this Tuple.
      Parameters:
      tableName - Table name
      Returns:
      List of failures to retrieve one or more fields. Empty if all fields retrieved.
      Throws:
      java.sql.SQLException - Failure.
    • isOk

      public static boolean isOk​(java.util.List<UpdatableTuple.FieldGetFailure> insertResult)
      Return true if the result of an insert(...) contains no field failures.
      Parameters:
      insertResult - Result of an insert(...)
      Returns:
      true if insertResult contains no field failures.
    • update

      public org.reldb.toolbox.types.Pair<java.util.List<UpdatableTuple.FieldGetFailure>,​java.util.List<UpdatableTuple.FieldGetFailure>> update​(java.sql.Connection connection, java.lang.String tableName) throws java.sql.SQLException
      Update this tuple.
      Parameters:
      connection - Connection to database, typically obtained via a Transaction.
      tableName - Table name.
      Returns:
      Return a pair of List<FieldGetFailure> where the left item is the new field get failures, and the right item is the original (backup) field get failures. Both lists in the Pair are empty if successful.
      Throws:
      java.sql.SQLException - Failure.
    • update

      public org.reldb.toolbox.types.Pair<java.util.List<UpdatableTuple.FieldGetFailure>,​java.util.List<UpdatableTuple.FieldGetFailure>> update​(java.lang.String tableName) throws java.sql.SQLException
      Update this tuple.
      Parameters:
      tableName - Table name.
      Returns:
      Return a pair of List<FieldGetFailure> where the left item is the new field get failures, and the right item is the original (backup) field get failures. Both lists in the Pair are empty if successful.
      Throws:
      java.sql.SQLException - Failure.
    • isOk

      public static boolean isOk​(org.reldb.toolbox.types.Pair<java.util.List<UpdatableTuple.FieldGetFailure>,​java.util.List<UpdatableTuple.FieldGetFailure>> updateResult)
      Return true if the result of an update(...) contains no field failures.
      Parameters:
      updateResult - Result of an update(...)
      Returns:
      true if updateResult contains no field failures.