Package org.reldb.wrapd.sqldb
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
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
UpdatableTuple.FieldGetFailure
Failure to retrieve a Field. -
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description protected
UpdatableTuple()
Constructor.protected
UpdatableTuple(Database database)
Constructor. -
Method Summary
Modifier and Type Method Description java.util.List<UpdatableTuple.FieldGetFailure>
insert(java.lang.String tableName)
Insert this Tuple.java.util.List<UpdatableTuple.FieldGetFailure>
insert(java.sql.Connection connection, java.lang.String tableName)
Insert this Tuple.static boolean
isOk(java.util.List<UpdatableTuple.FieldGetFailure> insertResult)
Return true if the result of an insert(...) contains no field failures.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.org.reldb.toolbox.types.Pair<java.util.List<UpdatableTuple.FieldGetFailure>,java.util.List<UpdatableTuple.FieldGetFailure>>
update(java.lang.String tableName)
Update this tuple.org.reldb.toolbox.types.Pair<java.util.List<UpdatableTuple.FieldGetFailure>,java.util.List<UpdatableTuple.FieldGetFailure>>
update(java.sql.Connection connection, java.lang.String tableName)
Update this tuple.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
database
Database used to create this Tuple.
-
-
Constructor Details
-
UpdatableTuple
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.SQLExceptionInsert 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.SQLExceptionInsert 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
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.SQLExceptionUpdate 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.SQLExceptionUpdate 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.
-