Package edu.ntnu.stud.model.database
Class DbInit
java.lang.Object
edu.ntnu.stud.model.database.DbInit
Initializes the database and creates the necessary tables if they do not exist.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
clearTable
(String tableName) Clears the specified table.static void
dropDatabase
(Statement statement) Drops the "quicklist" database if it exists.static void
Initializes the database and creates the necessary tables if they do not exist.
-
Constructor Details
-
DbInit
public DbInit()
-
-
Method Details
-
initializeDatabase
Initializes the database and creates the necessary tables if they do not exist.- Throws:
IllegalArgumentException
- If the database initialization fails.
-
dropDatabase
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
Clears the specified table.- Parameters:
tableName
- The name of the table to clear.- Throws:
IllegalArgumentException
-