FOSSology
4.4.0
Open Source License Compliance by Open Source Software
|
Classes | |
struct | ColumnDef |
Holds the column related data for table creation. More... | |
Public Member Functions | |
ScancodeDatabaseHandler (fo::DbManager dbManager) | |
Default constructor for ScanCode Database Handler class. More... | |
ScancodeDatabaseHandler (ScancodeDatabaseHandler &&other) | |
ScancodeDatabaseHandler | spawn () const |
Instantiate a new object spawn for ScanCode Database handler Used to create new objects for threads. More... | |
long | saveLicenseMatch (int agentId, long pFileId, long licenseId, int percentMatch) |
save license match with license_ref table in license_file table Insert license if already not present in license_file table More... | |
bool | insertNoResultInDatabase (int agentId, long pFileId, long licenseId) |
Insert null value of license for uploads having no licenses. More... | |
bool | saveHighlightInfo (long licenseFileId, unsigned start, unsigned length) |
save highlight information in the highlight table More... | |
void | insertOrCacheLicenseIdForName (std::string const &rfShortName, std::string const &rfFullname, std::string const &rfTexturl) |
calling function for selectOrInsertLicenseIdForName More... | |
unsigned long | getCachedLicenseIdForName (std::string const &rfShortName) const |
for given short name search license More... | |
bool | insertInDatabase (DatabaseEntry &entry) const |
insert copyright/author in scancode_copyright/scancode_author table More... | |
std::vector< unsigned long > | queryFileIdsForUpload (int uploadId, bool ignoreFilesWithMimeType) |
Function to get pfile ID for uploads. More... | |
bool | createTables () const |
create tables to save copyright and author informations More... | |
Public Member Functions inherited from fo::AgentDatabaseHandler | |
AgentDatabaseHandler (DbManager dbManager) | |
AgentDatabaseHandler (AgentDatabaseHandler &&other) | |
AgentDatabaseHandler (const AgentDatabaseHandler &)=delete | |
virtual | ~AgentDatabaseHandler () |
AgentDatabaseHandler | operator= (const AgentDatabaseHandler &)=delete |
bool | begin () const |
BEGIN a transaction block in DB. More... | |
bool | commit () const |
COMMIT a transaction block in DB. More... | |
bool | rollback () const |
ROLLBACK a transaction block in DB. More... | |
char * | getPFileNameForFileId (unsigned long pfileId) const |
Get the file name of a give pfile id. More... | |
std::string | queryUploadTreeTableName (int uploadId) |
Get the upload tree table name for a given upload id. More... | |
std::vector< unsigned long > | queryFileIdsVectorForUpload (int uploadId, bool ignoreFilesWithMimeType) const |
Get pfile ids for a given upload id. More... | |
std::vector< unsigned long > | queryFileIdsVectorForUpload (int uploadId, int agentId, bool ignoreFilesWithMimeType) const |
Get pfile ids for a given upload id which agent has not scanned. More... | |
Private Member Functions | |
unsigned long | selectOrInsertLicenseIdForName (std::string rfShortname, std::string rfFullname, std::string rfTexturl) |
insert license if not present in license_ref table and return rf_pk More... | |
bool | createTableAgentEvents (string tablename) const |
create table to store agent events More... | |
bool | createTableAgentFindings (string tablename) const |
create table to store agent findings More... | |
std::string | getColumnCreationString (const ColumnDef in[], size_t size) const |
get string of parameters for a column for table creation More... | |
Private Attributes | |
std::unordered_map< std::string, long > | licenseRefCache |
Static Private Attributes | |
static const ColumnDef | columns_author [] |
Columns required to store author information by scancode agent. More... | |
static const ColumnDef | columns_copyright [] |
Columns required to store copyright information by scancode agent. More... | |
static const ColumnDef | columns_author_event [] |
Columns required to store author deactivated statement. More... | |
static const ColumnDef | columns_copyright_event [] |
Columns required to store copyright deactivated statement. More... | |
Additional Inherited Members | |
Protected Attributes inherited from fo::AgentDatabaseHandler | |
DbManager | dbManager |
DbManager to use. | |
Definition at line 69 of file scancode_dbhandler.hpp.
ScancodeDatabaseHandler::ScancodeDatabaseHandler | ( | fo::DbManager | dbManager | ) |
Default constructor for ScanCode Database Handler class.
dbManager | DBManager to be used |
Definition at line 65 of file scancode_dbhandler.cc.
|
private |
create table to store agent events
tableName | name of the table to be created |
Definition at line 612 of file scancode_dbhandler.cc.
|
private |
create table to store agent findings
tableName | name of the table to be created |
Definition at line 495 of file scancode_dbhandler.cc.
bool ScancodeDatabaseHandler::createTables | ( | ) | const |
create tables to save copyright and author informations
Definition at line 424 of file scancode_dbhandler.cc.
unsigned long ScancodeDatabaseHandler::getCachedLicenseIdForName | ( | std::string const & | rfShortName | ) | const |
for given short name search license
rfShortName | spdx license key for the license |
Definition at line 215 of file scancode_dbhandler.cc.
|
private |
get string of parameters for a column for table creation
in[] | input array of struct ColumnDef |
size | size of in[] |
Definition at line 45 of file scancode_dbhandler.cc.
bool ScancodeDatabaseHandler::insertInDatabase | ( | DatabaseEntry & | entry | ) | const |
insert copyright/author in scancode_copyright/scancode_author table
entry | object of DatabaseEntry class |
Definition at line 394 of file scancode_dbhandler.cc.
bool ScancodeDatabaseHandler::insertNoResultInDatabase | ( | int | agentId, |
long | pFileId, | ||
long | licenseId | ||
) |
Insert null value of license for uploads having no licenses.
agentId | agent_pk in agent database table |
pFileId | pfile_pk in pfile dataabse table |
Definition at line 98 of file scancode_dbhandler.cc.
void ScancodeDatabaseHandler::insertOrCacheLicenseIdForName | ( | std::string const & | rfShortName, |
std::string const & | rfFullname, | ||
std::string const & | rfTexturl | ||
) |
calling function for selectOrInsertLicenseIdForName
rfShortName | spdx license key for the license |
rfFullName | full name of the license |
rfTextUrl | reference url for license text |
Definition at line 197 of file scancode_dbhandler.cc.
vector< unsigned long > ScancodeDatabaseHandler::queryFileIdsForUpload | ( | int | uploadId, |
bool | ignoreFilesWithMimeType | ||
) |
Function to get pfile ID for uploads.
uploadId | Upload ID of uploads |
Definition at line 87 of file scancode_dbhandler.cc.
bool ScancodeDatabaseHandler::saveHighlightInfo | ( | long | licenseFileId, |
unsigned | start, | ||
unsigned | length | ||
) |
save highlight information in the highlight table
licenseFileId | license_file pk |
start | start byte of highlight_text |
length | total no of bytes from start byte |
Definition at line 171 of file scancode_dbhandler.cc.
long ScancodeDatabaseHandler::saveLicenseMatch | ( | int | agentId, |
long | pFileId, | ||
long | licenseId, | ||
int | percentMatch | ||
) |
save license match with license_ref table in license_file table Insert license if already not present in license_file table
agantId | agent pk in agent database table |
pFileId | pfile pk in pfile dataabse table |
licenseId | reference pk in license_ref table for matched or inserted license |
percentMatch | Score got for license from scancode agent |
Definition at line 120 of file scancode_dbhandler.cc.
|
private |
insert license if not present in license_ref table and return rf_pk
rfShortName | spdx license key for the license |
rfFullName | full name of the license |
rfTextUrl | reference url for license text |
Definition at line 255 of file scancode_dbhandler.cc.
ScancodeDatabaseHandler ScancodeDatabaseHandler::spawn | ( | ) | const |
Instantiate a new object spawn for ScanCode Database handler Used to create new objects for threads.
Definition at line 76 of file scancode_dbhandler.cc.
|
staticprivate |
Columns required to store author information by scancode agent.
Definition at line 98 of file scancode_dbhandler.hpp.
|
staticprivate |
Columns required to store author deactivated statement.
Definition at line 102 of file scancode_dbhandler.hpp.
|
staticprivate |
Columns required to store copyright information by scancode agent.
Definition at line 99 of file scancode_dbhandler.hpp.
|
staticprivate |
Columns required to store copyright deactivated statement.
Definition at line 103 of file scancode_dbhandler.hpp.