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 intprivate final JdbcConnectionprivate booleanprivate final ResultInterfaceprivate Stringprivate String -
Constructor Summary
ConstructorsConstructorDescriptionUpdatableRow(JdbcConnection conn, ResultInterface result) Construct a new object that is linked to the result set. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidappendColumnList(StringBuilder builder, boolean set) private voidappendKeyCondition(StringBuilder builder) private voidappendTableName(StringBuilder builder) voidDelete the given row in the database.private intfindColumnIndex(String columnName) private intgetColumnIndex(String columnName) voidInsert a new row into the database.private booleanisIndexUsable(ArrayList<String> indexColumns) booleanCheck if this result set is updatable.Value[]Re-reads a row from the database and updates the values in the array.private voidsetKey(PreparedStatement prep, int start, Value[] current) voidUpdate 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
-