Package CIserver.app

Class SQLhandler

java.lang.Object
CIserver.app.SQLhandler

public class SQLhandler extends Object
This class handles all communication with the database for insertions, deletions and retrieval of builds
  • Constructor Details

    • SQLhandler

      public SQLhandler()
      Instantiate a SQLhandler that opens a connection to the file buildHistory.db. If the file does not exist, it creates a file named buildHistory.db If the table BuildHistory does not exist in the file, create it.
  • Method Details

    • insertEntry

      public void insertEntry(String commitId, String buildDate, String buildLogs) throws SQLException
      Method to insert a new build history entry into the database
      Parameters:
      commitId - The commit ID of the build history entry
      buildDate - The build date of the build history entry
      buildLogs - The build logs of the build history entry
      Throws:
      SQLException - If an SQL exception occurs
    • getEntry

      public Build getEntry(String commitId) throws SQLException
      Method to retrieve build history for a specific commit ID from the database.
      Parameters:
      commitId - The commit ID for which to retrieve build history
      Returns:
      An array containing the build date and build logs for the given commit ID, or null if no build history is found for the commit ID
      Throws:
      SQLException - If an SQL exception occurs
    • getHistory

      public List<Build> getHistory() throws SQLException
      Method to retrieve entire build history from the database.
      Returns:
      An array containing the build date and build logs for the given commit ID, or null if no build history is found for the commit ID
      Throws:
      SQLException - If an SQL exception occurs