Package org.h2.result
Class UpdatableRow
java.lang.Object
org.h2.result.UpdatableRow
This class is used for updatable result sets. An updatable row provides
functions to update the current row in a result set.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int
private final JdbcConnection
private boolean
private final ResultInterface
private String
private String
-
Constructor Summary
ConstructorsConstructorDescriptionUpdatableRow
(JdbcConnection conn, ResultInterface result) Construct a new object that is linked to the result set. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
appendColumnList
(StringBuilder builder, boolean set) private void
appendKeyCondition
(StringBuilder builder) private void
appendTableName
(StringBuilder builder) void
Delete the given row in the database.private int
findColumnIndex
(String columnName) private int
getColumnIndex
(String columnName) void
Insert a new row into the database.private boolean
isIndexUsable
(ArrayList<String> indexColumns) boolean
Check if this result set is updatable.Value[]
Re-reads a row from the database and updates the values in the array.private void
setKey
(PreparedStatement prep, int start, Value[] current) void
Update a row in the database.
-
Field Details
-
conn
-
result
-
columnCount
private final int columnCount -
schemaName
-
tableName
-
key
-
isUpdatable
private boolean isUpdatable
-
-
Constructor Details
-
UpdatableRow
Construct a new object that is linked to the result set. The constructor reads the database meta data to find out if the result set is updatable.- Parameters:
conn
- the database connectionresult
- the result- Throws:
SQLException
- on failure
-
-
Method Details
-
isIndexUsable
-
isUpdatable
public boolean isUpdatable()Check if this result set is updatable.- Returns:
- true if it is
-
findColumnIndex
-
getColumnIndex
-
appendColumnList
-
appendKeyCondition
-
setKey
- Throws:
SQLException
-
appendTableName
-
readRow
Re-reads a row from the database and updates the values in the array.- Parameters:
row
- the values that contain the key- Returns:
- the row
- Throws:
SQLException
- on failure
-
deleteRow
Delete the given row in the database.- Parameters:
current
- the row- Throws:
SQLException
- if this row has already been deleted
-
updateRow
Update a row in the database.- Parameters:
current
- the old rowupdateRow
- the new row- Throws:
SQLException
- if the row has been deleted
-
insertRow
Insert a new row into the database.- Parameters:
row
- the new row- Throws:
SQLException
- if the row could not be inserted
-