Top Description Fields Constructors Methods
org.h2.result

public Class UpdatableRow

extends Object
Class Inheritance
Imports
java.sql.DatabaseMetaData, .PreparedStatement, .ResultSet, .SQLException, java.util.ArrayList, org.h2.api.ErrorCode, org.h2.engine.Constants, .Session, .SessionRemote, org.h2.jdbc.JdbcConnection, .JdbcResultSet, org.h2.message.DbException, org.h2.util.JdbcUtils, .StringUtils, .Utils, org.h2.value.Value, .ValueNull, .ValueToObjectConverter

This class is used for updatable result sets. An updatable row provides functions to update the current row in a result set.

Field Summary

Modifier and TypeField and Description
private final int
private final JdbcConnection
private boolean
private ArrayList<String>
private final ResultInterface
private String
private String

Constructor Summary

AccessConstructor and Description
public
UpdatableRow(JdbcConnection
the database connection
conn
,
ResultInterface
the result
result
)

Construct a new object that is linked to the result set.

Method Summary

Modifier and TypeMethod and Description
private void
appendColumnList(StringBuilder builder, boolean set)

private void
private void
public void
deleteRow(Value[]
the row
current
)

Delete the given row in the database.

private int
findColumnIndex(String columnName)

private int
getColumnIndex(String columnName)

public void
insertRow(Value[]
the new row
row
)

Insert a new row into the database.

private boolean
public boolean

Returns:

true if it is
isUpdatable
()

Check if this result set is updatable.

public Value[]

Returns:

the row
readRow
(Value[]
the values that contain the key
row
)

Re-reads a row from the database and updates the values in the array.

private void
setKey(PreparedStatement prep, int start, Value[] current)

public void
updateRow(Value[]
the old row
current
,
Value[]
the new row
updateRow
)

Update a row in the database.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

columnCountback to summary
private final int columnCount
connback to summary
private final JdbcConnection conn
isUpdatableback to summary
private boolean isUpdatable
keyback to summary
private ArrayList<String> key
resultback to summary
private final ResultInterface result
schemaNameback to summary
private String schemaName
tableNameback to summary
private String tableName

Constructor Detail

UpdatableRowback to summary
public UpdatableRow(JdbcConnection conn, ResultInterface result) throws SQLException

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:JdbcConnection

the database connection

result:ResultInterface

the result

Exceptions
SQLException:
on failure

Method Detail

appendColumnListback to summary
private void appendColumnList(StringBuilder builder, boolean set)
appendKeyConditionback to summary
private void appendKeyCondition(StringBuilder builder)
appendTableNameback to summary
private void appendTableName(StringBuilder builder)
deleteRowback to summary
public void deleteRow(Value[] current) throws SQLException

Delete the given row in the database.

Parameters
current:Value[]

the row

Exceptions
SQLException:
if this row has already been deleted
findColumnIndexback to summary
private int findColumnIndex(String columnName)
getColumnIndexback to summary
private int getColumnIndex(String columnName)
insertRowback to summary
public void insertRow(Value[] row) throws SQLException

Insert a new row into the database.

Parameters
row:Value[]

the new row

Exceptions
SQLException:
if the row could not be inserted
isIndexUsableback to summary
private boolean isIndexUsable(ArrayList<String> indexColumns)
isUpdatableback to summary
public boolean isUpdatable()

Check if this result set is updatable.

Returns:boolean

true if it is

readRowback to summary
public Value[] readRow(Value[] row) throws SQLException

Re-reads a row from the database and updates the values in the array.

Parameters
row:Value[]

the values that contain the key

Returns:Value[]

the row

Exceptions
SQLException:
on failure
setKeyback to summary
private void setKey(PreparedStatement prep, int start, Value[] current) throws SQLException
updateRowback to summary
public void updateRow(Value[] current, Value[] updateRow) throws SQLException

Update a row in the database.

Parameters
current:Value[]

the old row

updateRow:Value[]

the new row

Exceptions
SQLException:
if the row has been deleted