public class DatabaseManager extends Object
Punishments
from the Database?
Use PunishmentManager.getPunishments(SQLQuery, Object...)
or
PunishmentManager.getPunishmentFromResultSet(ResultSet)
for already parsed data.Constructor and Description |
---|
DatabaseManager() |
Modifier and Type | Method and Description |
---|---|
ResultSet |
executeResultStatement(SQLQuery sql,
Object... parameters)
Execute a sql statement.
|
void |
executeStatement(SQLQuery sql,
Object... parameters)
Execute a sql statement without any results.
|
static DatabaseManager |
get()
Get the instance of the command manager
|
boolean |
isConnectionValid(int timeout)
Check whether there is a valid connection to the database.
|
boolean |
isFailedMySQL()
Check whether the connection to MySQL failed.
|
boolean |
isUseMySQL()
Check whether MySQL is actually used.
|
void |
setup(boolean useMySQLServer)
Initially connects to the database and sets up the required tables of they don't already exist.
|
void |
shutdown()
Shuts down the HSQLDB if used.
|
public static DatabaseManager get()
public void setup(boolean useMySQLServer)
useMySQLServer
- whether to preferably use MySQL (uses HSQLDB as fallback)public void shutdown()
public void executeStatement(SQLQuery sql, Object... parameters)
sql
- the sql statementparameters
- the parameterspublic ResultSet executeResultStatement(SQLQuery sql, Object... parameters)
sql
- the sql statementparameters
- the parameterspublic boolean isConnectionValid(int timeout)
timeout
- the timeout for the checkpublic boolean isFailedMySQL()
true
if MySQL has been specified as the preferred Database and due to some
error HSQLDB is used as the fallback database.public boolean isUseMySQL()
Copyright © 2020. All rights reserved.