Class OptionalTable

java.lang.Object
ghidra.features.bsim.query.client.tables.OptionalTable

public class OptionalTable extends Object
Database table that has exactly two columns: key and value The column types are variable and are determined upon initialization. They are specified by giving an integer "type code" as listed in java.sql.Types The key column will be marked as UNIQUE. The JDBC driver will map between Java and SQL types. The readValue() writeValue() and deleteValue() methods simply take and return an Object.
  • Constructor Details

    • OptionalTable

      public OptionalTable(String nm, int kType, int vType, Connection d)
      Construct this table for a specific connection
      Parameters:
      nm - is the formal SQL name of the table
      kType - is the type-code of the key (as specified in java.sql.Types)
      vType - is the type-code of the value (as specified in java.sql.Types)
      d - is the connection to the SQL server
  • Method Details

    • lockForWrite

      public void lockForWrite() throws SQLException
      Lock the table for writing
      Throws:
      SQLException - if the server reports an error
    • getName

      public String getName()
      Returns:
      the formal sql name of the table
    • getKeyType

      public int getKeyType()
      Returns:
      type-code of key column
    • getValueType

      public int getValueType()
      Returns:
      type-code of value column
    • close

      public void close()
      Free any resources and relinquish references to the connection
    • createTable

      public void createTable() throws SQLException
      Create this specific table in the database
      Throws:
      SQLException - for problems with the connection
    • clearTable

      public void clearTable() throws SQLException
      Clear all rows from the table
      Throws:
      SQLException - for problems with the connection
    • exists

      public boolean exists() throws SQLException
      Determine whether a given table exists in the database
      Returns:
      true is the table exists
      Throws:
      SQLException - for problems with the connection
    • readValue

      public Object readValue(Object key) throws SQLException
      Given a key, retrieve the corresponding value
      Parameters:
      key - identifies the table row
      Returns:
      the value corresponding to the key
      Throws:
      SQLException - for problems with the connection
    • writeValue

      public void writeValue(Object key, Object value) throws SQLException
      Associate a new value with a given key
      Parameters:
      key - identifies the table row
      value - is stored at that row
      Throws:
      SQLException - for problems with the connection
    • deleteValue

      public void deleteValue(Object key) throws SQLException
      Deletes the row corresponding to a given key
      Parameters:
      key - identifies the table row
      Throws:
      SQLException - for problems with the connection