Class ExeTable
java.lang.Object
ghidra.features.bsim.query.client.tables.SQLComplexTable
ghidra.features.bsim.query.client.tables.ExeTable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static enum
-
Field Summary
FieldsFields inherited from class ghidra.features.bsim.query.client.tables.SQLComplexTable
db, idColumnName, tableName
-
Constructor Summary
ConstructorsConstructorDescriptionExeTable
(SQLStringTable archtable, SQLStringTable compilertable, SQLStringTable repositorytable, SQLStringTable pathtable, ExeToCategoryTable exeCategoryTable) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
void
Creates the db table.int
delete
(long id) Deletes the row with the given id from the db.void
Drops the current table.protected static void
extractExecutableRow
(ResultSet pgres, ExeTable.ExecutableRow res) Pulls information out of the givenExeTable.ExecutableRow
object into the givenResultSet
int
extractExecutableRows
(ResultSet rs, List<ExecutableRecord> vecres, DescriptionManager res, int max) CreatesExecutableRecord
objects fromResultSet
and stores them in the given list.long
Inserts a row(s) into the db.makeExecutableRecord
(DescriptionManager manager, ExeTable.ExecutableRow row) Make an ExecutableRecord within the DescriptionManager container, given database row informationqueryAllExe
(int limit, String filterMd5, String filterExeName, long filterArch, long filterCompilerName, ExeTable.ExeTableOrderColumn sortColumn, boolean includeFakes) Returns a list of all rows in the exe table matching a given filter.int
queryExeCount
(String filterMd5, String filterExeName, long filterArch, long filterCompilerName, boolean includeFakes) Returns a count of all records in the database matching the filter criteria.queryMd5ExeMatch
(String md5) Return the executable with matching md5 (if any)int
queryNameExeMatch
(List<ExecutableRecord> vecres, DescriptionManager res, String nm, int max) Executes a database query to return a list of records matching an executalble name filter.querySingleExecutable
(DescriptionManager manage, String name, String arch, String cname) Query for a unique executable based on -name- and possibly other metadataquerySingleExecutableId
(long id) Query for a single executable based on its exetable -id-void
Updates records in the database with information in the givenExecutableRecord
.Methods inherited from class ghidra.features.bsim.query.client.tables.SQLComplexTable
setConnection
-
Field Details
-
TABLE_NAME
- See Also:
-
-
Constructor Details
-
ExeTable
public ExeTable(SQLStringTable archtable, SQLStringTable compilertable, SQLStringTable repositorytable, SQLStringTable pathtable, ExeToCategoryTable exeCategoryTable) Constructor- Parameters:
archtable
- the architecture tablecompilertable
- the compiler tablerepositorytable
- the repository tablepathtable
- the path tableexeCategoryTable
- the category table
-
-
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
-
delete
Description copied from class:SQLComplexTable
Deletes the row with the given id from the db. Users must set theDELETE_STMT
string to delete the exact table they need.- Overrides:
delete
in classSQLComplexTable
- Parameters:
id
- the database row ID- Returns:
- the number of deleted rows
- Throws:
SQLException
- if there is a problem creating or executing the query
-
extractExecutableRow
protected static void extractExecutableRow(ResultSet pgres, ExeTable.ExecutableRow res) throws SQLException Pulls information out of the givenExeTable.ExecutableRow
object into the givenResultSet
- Parameters:
pgres
- the result setres
- the executable row- Throws:
SQLException
- if there is a problem parsing the result set
-
extractExecutableRows
public int extractExecutableRows(ResultSet rs, List<ExecutableRecord> vecres, DescriptionManager res, int max) throws SQLException, LSHException CreatesExecutableRecord
objects fromResultSet
and stores them in the given list.- Parameters:
rs
- the result setvecres
- the list of executable recordsres
- the description managermax
- the max number of rows to return- Returns:
- the number of rows returned
- Throws:
SQLException
- if there is an problem parsing the result setLSHException
- if there is an problem creating the executable record
-
makeExecutableRecord
public ExecutableRecord makeExecutableRecord(DescriptionManager manager, ExeTable.ExecutableRow row) throws SQLException, LSHException Make an ExecutableRecord within the DescriptionManager container, given database row information- Parameters:
manager
- is the DescriptionManager that will contain the new recordrow
- is the columnar values for the executable from the database- Returns:
- the new ExecutableRecord
- Throws:
SQLException
- if there is a problem parsing the table objectsLSHException
- if there is a problem creating a new exec library or record
-
querySingleExecutable
public ExecutableRecord querySingleExecutable(DescriptionManager manage, String name, String arch, String cname) throws SQLException, LSHException Query for a unique executable based on -name- and possibly other metadata- Parameters:
manage
- the container to store the resultname
- the name the executable must matcharch
- the architecture the executable must match (may be zero length)cname
- the compiler name the executable must match (may be zero length)- Returns:
- the unique resulting ExecutableRecord or null, if none or more than 1 is found
- Throws:
SQLException
- if there is a problem querying for the executable nameLSHException
- if there is a problem querying for the executable name or transferring the exec
-
queryNameExeMatch
public int queryNameExeMatch(List<ExecutableRecord> vecres, DescriptionManager res, String nm, int max) throws SQLException, LSHException Executes a database query to return a list of records matching an executalble name filter.- Parameters:
vecres
- the list of executable records to populateres
- the description managernm
- the name to query formax
- the max number of records to return- Returns:
- the number of records returned
- Throws:
SQLException
- if there is a problem creating the query statementLSHException
- if there is a problem extracting executable rows
-
querySingleExecutableId
Query for a single executable based on its exetable -id-- Parameters:
id
- the exetable id- Returns:
- the executable row
- Throws:
SQLException
- if there is a problem creating or executing the query
-
queryMd5ExeMatch
Return the executable with matching md5 (if any)- Parameters:
md5
- the md5 hash to query- Returns:
- the ExecutableRow data or null
- Throws:
SQLException
- if there is a problem creating or executing the query
-
queryExeCount
public int queryExeCount(String filterMd5, String filterExeName, long filterArch, long filterCompilerName, boolean includeFakes) throws SQLException Returns a count of all records in the database matching the filter criteria.- Parameters:
filterMd5
- md5 must contain thisfilterExeName
- exe name must contain thisfilterArch
- if non-zero, force matching architecture idfilterCompilerName
- if non-zero, force matching compiler idincludeFakes
- if true, include MD5s that start with 'bbbbbbbbaaaaaaa'- Returns:
- total number of records in the database
- Throws:
SQLException
- when preparing or executing the query
-
queryAllExe
public List<ExeTable.ExecutableRow> queryAllExe(int limit, String filterMd5, String filterExeName, long filterArch, long filterCompilerName, ExeTable.ExeTableOrderColumn sortColumn, boolean includeFakes) throws SQLException Returns a list of all rows in the exe table matching a given filter.- Parameters:
limit
- the max number of results to returnfilterMd5
- md5 must contain thisfilterExeName
- exe name must contain thisfilterArch
- if non-zero architecture must match this idfilterCompilerName
- if non-zero compiler must match this idsortColumn
- the name of the column that should define the sorting orderincludeFakes
- if false, will exclude generated MD5s starting with "bbbbbbbbaaaaaaaa"- Returns:
- list of executables
- Throws:
SQLException
- when preparing or executing the query
-
insert
Description copied from class:SQLComplexTable
Inserts a row(s) into the db. The arguments passed to this function are by definition not known, so they are left as a variable-length list ofObject
instances, to be interpreted by the implementer.- Specified by:
insert
in classSQLComplexTable
- Parameters:
arguments
- any arguments required for the insert- Returns:
- to be defined by the implementor
- Throws:
SQLException
- if there is a problem executing the insert command
-
updateExecutable
Updates records in the database with information in the givenExecutableRecord
.- Parameters:
rec
- the executable record to update- Throws:
SQLException
- if there is a problem creating or executing the query
-