Class DbInit

java.lang.Object
edu.ntnu.stud.model.database.DbInit

public class DbInit extends Object
Initializes the database and creates the necessary tables if they do not exist.
  • Constructor Details

    • DbInit

      public DbInit()
  • Method Details

    • initializeDatabase

      public static void initializeDatabase() throws IllegalArgumentException
      Initializes the database and creates the necessary tables if they do not exist.
      Throws:
      IllegalArgumentException - If the database initialization fails.
    • dropDatabase

      public static void dropDatabase(Statement statement) throws SQLException
      Drops the "quicklist" database if it exists.
      Parameters:
      statement - The statement to execute the SQL query.
      Throws:
      SQLException - If an error occurs while executing the SQL query.
    • clearTable

      public static void clearTable(String tableName) throws IllegalArgumentException
      Clears the specified table.
      Parameters:
      tableName - The name of the table to clear.
      Throws:
      IllegalArgumentException