Package org.h2.result

Class UpdatableRow

java.lang.Object
org.h2.result.UpdatableRow

public class UpdatableRow extends Object
This class is used for updatable result sets. An updatable row provides functions to update the current row in a result set.
  • Field Details

    • conn

      private final JdbcConnection conn
    • result

      private final ResultInterface result
    • columnCount

      private final int columnCount
    • schemaName

      private String schemaName
    • tableName

      private String tableName
    • key

      private ArrayList<String> key
    • isUpdatable

      private boolean isUpdatable
  • Constructor Details

    • UpdatableRow

      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 - the database connection
      result - the result
      Throws:
      SQLException - on failure
  • Method Details

    • isIndexUsable

      private boolean isIndexUsable(ArrayList<String> indexColumns)
    • isUpdatable

      public boolean isUpdatable()
      Check if this result set is updatable.
      Returns:
      true if it is
    • findColumnIndex

      private int findColumnIndex(String columnName)
    • getColumnIndex

      private int getColumnIndex(String columnName)
    • appendColumnList

      private void appendColumnList(StringBuilder builder, boolean set)
    • appendKeyCondition

      private void appendKeyCondition(StringBuilder builder)
    • setKey

      private void setKey(PreparedStatement prep, int start, Value[] current) throws SQLException
      Throws:
      SQLException
    • appendTableName

      private void appendTableName(StringBuilder builder)
    • readRow

      public Value[] readRow(Value[] row) throws SQLException
      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

      public void deleteRow(Value[] current) throws SQLException
      Delete the given row in the database.
      Parameters:
      current - the row
      Throws:
      SQLException - if this row has already been deleted
    • updateRow

      public void updateRow(Value[] current, Value[] updateRow) throws SQLException
      Update a row in the database.
      Parameters:
      current - the old row
      updateRow - the new row
      Throws:
      SQLException - if the row has been deleted
    • insertRow

      public void insertRow(Value[] row) throws SQLException
      Insert a new row into the database.
      Parameters:
      row - the new row
      Throws:
      SQLException - if the row could not be inserted