Class OptionalTable
java.lang.Object
ghidra.features.bsim.query.client.tables.OptionalTable
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 Summary
ConstructorsConstructorDescriptionOptionalTable
(String nm, int kType, int vType, Connection d) Construct this table for a specific connection -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clear all rows from the tablevoid
close()
Free any resources and relinquish references to the connectionvoid
Create this specific table in the databasevoid
deleteValue
(Object key) Deletes the row corresponding to a given keyboolean
exists()
Determine whether a given table exists in the databaseint
getName()
int
void
Lock the table for writingGiven a key, retrieve the corresponding valuevoid
writeValue
(Object key, Object value) Associate a new value with a given key
-
Constructor Details
-
OptionalTable
Construct this table for a specific connection- Parameters:
nm
- is the formal SQL name of the tablekType
- 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
Lock the table for writing- Throws:
SQLException
- if the server reports an error
-
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
Create this specific table in the database- Throws:
SQLException
- for problems with the connection
-
clearTable
Clear all rows from the table- Throws:
SQLException
- for problems with the connection
-
exists
Determine whether a given table exists in the database- Returns:
- true is the table exists
- Throws:
SQLException
- for problems with the connection
-
readValue
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
Associate a new value with a given key- Parameters:
key
- identifies the table rowvalue
- is stored at that row- Throws:
SQLException
- for problems with the connection
-
deleteValue
Deletes the row corresponding to a given key- Parameters:
key
- identifies the table row- Throws:
SQLException
- for problems with the connection
-