15#define HASHES_INSERT_MAX 1000
30 virtual void connect(std::string ip,
int port);
87 virtual std::vector<Hash>
updateUnchangedFiles(std::vector<Hash> hashes, std::vector<std::string> files,
88 ProjectIn project,
long long prevVersion);
95 virtual std::vector<MethodOut>
hashToMethods(std::string hash);
130 MethodID getMethodID(
const CassRow *row);
158 void handleSelectMethodQueryResult(CassFuture *queryFuture,
MethodIn method,
ProjectIn project,
159 long long prevVersion,
long long parserVersion,
bool &newProject);
168 std::vector<Hash> handleSelectUnchangedMethodsResult(CassFuture *queryFuture,
ProjectIn project,
169 long long prevVersion);
178 CassFuture *executeSelectUnchangedMethodsQuery(std::vector<Hash> hashes, std::vector<std::string> files,
185 CassUuid createAuthorIfNotExists(
Author author);
190 void setPreparedStatements();
195 CassSession *connection;
200 const CassPrepared *selectMethods;
201 const CassPrepared *selectProject;
202 const CassPrepared *selectPrevProject;
203 const CassPrepared *insertProject;
204 const CassPrepared *addHashesToProject;
205 const CassPrepared *insertMethod;
206 const CassPrepared *insertVulnMethod;
207 const CassPrepared *updateMethods;
208 const CassPrepared *updateUnchangedMethods;
209 const CassPrepared *selectMethod;
210 const CassPrepared *selectUnchangedMethods;
211 const CassPrepared *insertMethodByAuthor;
212 const CassPrepared *selectMethodByAuthor;
213 const CassPrepared *insertAuthorByID;
214 const CassPrepared *selectAuthorByID;
Handles interaction with database.
Definition: DatabaseHandler.h:23
virtual void addHashToProject(ProjectIn project, int index)
Adds a number of hashes to a project in the database, starting at some index.
Definition: DatabaseHandlerSet.cpp:72
virtual ProjectOut searchForProject(ProjectID projectID, Version version)
Searches for a project in the database and returns it to the user if it exists.
Definition: DatabaseHandlerGet.cpp:15
virtual Author idToAuthor(std::string id)
Retrieves an author given its authorID.
Definition: DatabaseHandlerGet.cpp:186
virtual std::vector< MethodID > authorToMethods(std::string authorID)
Retrieves the methods created by an author given its authorID.
Definition: DatabaseHandlerGet.cpp:141
virtual std::vector< MethodOut > hashToMethods(std::string hash)
Retrieves all methods with a given hash.
Definition: DatabaseHandlerGet.cpp:58
virtual bool addProject(ProjectIn project)
Adds a project to database.
Definition: DatabaseHandlerSet.cpp:15
virtual std::vector< Hash > updateUnchangedFiles(std::vector< Hash > hashes, std::vector< std::string > files, ProjectIn project, long long prevVersion)
Updates the methods in the previous version of the project that are part of an unchanged file.
Definition: DatabaseHandlerSet.cpp:317
virtual void addMethod(MethodIn method, ProjectIn project, long long prevVersion, long long parserVersion, bool newProject)
Adds/updates a method to the tables methods and method_by_author. Takes in a method and a project and...
Definition: DatabaseHandlerSet.cpp:117
virtual void connect(std::string ip, int port)
Establishes a connection to the database.
Definition: DatabaseHandler.cpp:13
virtual ProjectOut prevProject(ProjectID projectID)
Retrieves the previous/latest version of the project present in the database.
Definition: DatabaseHandlerGet.cpp:104
Represents the data of an author.
Definition: Types.h:26
Represents the relevant data of a method to be put in the database.
Definition: Types.h:50
Represents the data of a method to be returned to the user. Difference with MethodIn: authorIDs inste...
Definition: Types.h:65
Represents the relevant data of a project when it is put into the database.
Definition: Types.h:94
Represents the relevant data of a project when it is returned to user. Difference with ProjectIn: aut...
Definition: Types.h:112