Class DescriptionTable
java.lang.Object
ghidra.features.bsim.query.client.tables.SQLComplexTable
ghidra.features.bsim.query.client.tables.DescriptionTable
This is the SQL table "desctable", which holds one row for each function ingested into the database.
A row (DescriptionRow) consists of basic meta-data about the function: name, address, executable
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class ghidra.features.bsim.query.client.tables.SQLComplexTable
db, idColumnName, tableName
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
static FunctionDescription
convertDescriptionRow
(DescriptionTable.DescriptionRow descRow, ExecutableRecord exeRecord, DescriptionManager descManager, SignatureRecord sigRecord) Given a function's raw meta-data from a desctable row (DescriptionRow), build the corresponding high-level FunctionDescriptionvoid
convertDescriptionRows
(List<FunctionDescription> descList, List<DescriptionTable.DescriptionRow> rowList, ExecutableRecord executable, DescriptionManager descManager, SignatureRecord sigRecord) Given rows from desctable describing functions of a single executable, build the list of corresponding FunctionDescription objectsvoid
Creates the db table.void
Drops the current table.static void
extractDescriptionRow
(ResultSet resultSet, DescriptionTable.DescriptionRow descRow) Extract column meta-data of a desctable row from the SQL result setextractDescriptionRows
(ResultSet resultSet, int maxRows) Extract a list of desctable rows from the SQL result set Only build up to -max- DescriptionRow objects, but still run through all rows in the set.long
Assuming all the necessary ids have been filled in, store the function as a row in desctablequeryFuncName
(long executableId, String functionName, int maxRows) Return DescriptionRow objects that match a given -functionName- and the row id within exetable of a specific executablequeryFuncNameAddr
(long executableId, String functionName, long functionAddress) Query the description table for the row describing a single function.querySingleDescriptionId
(DescriptionManager descManager, long rowId) Given the row id of the function within desctable, extract the FunctionDescription objectqueryVectorIdMatch
(long vectorId, int maxRows) Return function DescriptionRow objects that have a matching vector idqueryVectorIdMatchFilter
(long vectorId, String tableClause, String whereClause, int maxRows) Return function DescriptionRow objects that have a matching vector id and that also pass additional filters.Methods inherited from class ghidra.features.bsim.query.client.tables.SQLComplexTable
delete, setConnection
-
Constructor Details
-
DescriptionTable
-
-
Method Details
-
close
public void close()- Overrides:
close
in classSQLComplexTable
-
create
Description copied from class:SQLComplexTable
Creates the db table.- Specified by:
create
in classSQLComplexTable
- Parameters:
st
- the query statement- Throws:
SQLException
- if there is a problem
-
drop
Description copied from class:SQLComplexTable
Drops the current table. NOTE: If explicitly created index tables exist they should be removed first or this method override.- Overrides:
drop
in classSQLComplexTable
- Parameters:
st
- the query statement- Throws:
SQLException
- if there is a problem with the execute update command
-
querySingleDescriptionId
public FunctionDescription querySingleDescriptionId(DescriptionManager descManager, long rowId) throws SQLException, LSHException Given the row id of the function within desctable, extract the FunctionDescription object- Parameters:
descManager
- is the container which will hold the objectrowId
- is the row id of the function within desctable- Returns:
- the FunctionDescription
- Throws:
SQLException
- if there is a problem creating or executing the queryLSHException
- if there is a problem parsing the result set
-
convertDescriptionRows
public void convertDescriptionRows(List<FunctionDescription> descList, List<DescriptionTable.DescriptionRow> rowList, ExecutableRecord executable, DescriptionManager descManager, SignatureRecord sigRecord) Given rows from desctable describing functions of a single executable, build the list of corresponding FunctionDescription objects- Parameters:
descList
- is resulting list of FunctionDescriptionsrowList
- is the list of DescriptionRowsexecutable
- is the ExecutableRecord of the single executabledescManager
- is the container to hold the new FunctionDescriptionssigRecord
- is a single SignatureRecord to associate with any new FunctionDescription (can be null)
-
convertDescriptionRow
public static FunctionDescription convertDescriptionRow(DescriptionTable.DescriptionRow descRow, ExecutableRecord exeRecord, DescriptionManager descManager, SignatureRecord sigRecord) Given a function's raw meta-data from a desctable row (DescriptionRow), build the corresponding high-level FunctionDescription- Parameters:
descRow
- is the function's row meta-dataexeRecord
- is the ExecutableRecord for executable containing the functiondescManager
- is the container that will hold the new FunctionDescriptionsigRecord
- is SignatureRecord associated with the function (may be null)- Returns:
- the new FunctionDescription
-
extractDescriptionRow
public static void extractDescriptionRow(ResultSet resultSet, DescriptionTable.DescriptionRow descRow) throws SQLException Extract column meta-data of a desctable row from the SQL result set- Parameters:
resultSet
- is the low-level result set (returned by an SQL query)descRow
- is the DescriptionRow- Throws:
SQLException
- if there is a problem parsing the result set
-
extractDescriptionRows
public List<DescriptionTable.DescriptionRow> extractDescriptionRows(ResultSet resultSet, int maxRows) throws SQLException Extract a list of desctable rows from the SQL result set Only build up to -max- DescriptionRow objects, but still run through all rows in the set.- Parameters:
resultSet
- is the ResultSet to run throughmaxRows
- is the maximum number of DescriptionRows to build- Returns:
- a list of the new DescriptionRows
- Throws:
SQLException
- if there is a problem parsing the result set
-
insert
Assuming all the necessary ids have been filled in, store the function as a row in desctable- Specified by:
insert
in classSQLComplexTable
- Parameters:
arguments
- must be a singleFunctionDescription
- Returns:
- to be defined by the implementor
- Throws:
SQLException
- if there is a problem creating or executing the query
-
queryVectorIdMatch
public List<DescriptionTable.DescriptionRow> queryVectorIdMatch(long vectorId, int maxRows) throws SQLException Return function DescriptionRow objects that have a matching vector id- Parameters:
vectorId
- is the row id of the feature vector we want to matchmaxRows
- is the maximum number of function rows to return- Returns:
- list of resulting DescriptionRows
- Throws:
SQLException
- if there is a problem creating or executing the query
-
queryVectorIdMatchFilter
public List<DescriptionTable.DescriptionRow> queryVectorIdMatchFilter(long vectorId, String tableClause, String whereClause, int maxRows) throws SQLException Return function DescriptionRow objects that have a matching vector id and that also pass additional filters. The filters must be encoded as a "WHERE" clause of an SQL "SELECT" statement on desctable. Additional tables joined to desctable to satisfy the filter must be encoded as a "FROM" clause of the "SELECT".- Parameters:
vectorId
- is the row id of the feature vector (vectortable) we want to match ontableClause
- is the additional "FROM" clause needed for the filterwhereClause
- is the "WHERE" clause needed for the filtermaxRows
- is the maximum number of rows to return- Returns:
- a list of resulting DescriptionRows
- Throws:
SQLException
- if there is an error creating or executing the query
-
queryFuncName
public List<DescriptionTable.DescriptionRow> queryFuncName(long executableId, String functionName, int maxRows) throws SQLException Return DescriptionRow objects that match a given -functionName- and the row id within exetable of a specific executable- Parameters:
executableId
- is the row id of the executable to matchfunctionName
- is the name of the function to matchmaxRows
- is the maximum number of functions to return- Returns:
- linked of DescriptionRow objects
- Throws:
SQLException
- if there is an error creating or executing the query
-
queryFuncNameAddr
public DescriptionTable.DescriptionRow queryFuncNameAddr(long executableId, String functionName, long functionAddress) throws SQLException Query the description table for the row describing a single function. A function is uniquely identified by: its name, address, and the executable it is in- Parameters:
executableId
- is the row id (of exetable) of the executable containing the functionfunctionName
- is the name of the functionfunctionAddress
- is the address of the function- Returns:
- the corresponding row of the table, or null
- Throws:
SQLException
- if there is an error creating or executing the query
-