actionsTable, commandUseTable, dataSource, ipsTable, killsTable, nicknamesTable, plugin, securityTable, serverTable, sessionsTable, tpsTable, userInfoTable, usersTable, versionTable, worldTable, worldTimesTable
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the SQLDB
|
void |
commit(Connection connection)
Commits changes to the .db file when using SQLite Database.
|
Table[] |
getAllTables()
Get all tables in a good order.
|
Table[] |
getAllTablesInRemoveOrder()
Get all tables for removal of data.
|
Connection |
getConnection() |
int |
getVersion()
Used to get the database schema version.
|
void |
init()
Initializes the Database.
|
boolean |
isNewDatabase() |
boolean |
isOpen() |
void |
removeAccount(UUID uuid)
Removes all data related to an account from the database.
|
void |
removeAllData()
Used to clear all data from the database.
|
void |
rollback(Connection connection)
Reverts transaction when using SQLite Database.
|
void |
scheduleClean(long secondsDelay) |
void |
setAvailable() |
void |
setupDatabase()
Ensures connection functions correctly and all tables exist.
|
abstract void |
setupDataSource()
Setups the
BasicDataSource |
void |
setVersion(int version)
Used to set the database schema version.
|
boolean |
wasSeenBefore(UUID uuid)
Check if the user is saved in the database.
|
getActionsTable, getCommandUse, getCommandUseTable, getConfigName, getDataSource, getIpsTable, getKillsTable, getName, getNicknamesTable, getSavedUUIDs, getSecurityTable, getServerTable, getSessionsTable, getTpsTable, getUserInfoTable, getUsersTable, getWorldTable, getWorldTimesTable, isUsingMySQL
public SQLDB(IPlan plugin)
public void init() throws DatabaseInitException
All tables exist in the database after call to this. Updates Schema to latest version. Converts Unsaved Bukkit player files to database data. Cleans the database.
init
in class Database
DatabaseInitException
- if Database fails to initiate.public void scheduleClean(long secondsDelay)
public void setupDatabase() throws DatabaseInitException
Updates to latest schema.
DatabaseInitException
- if something goes wrong.public Table[] getAllTables()
public Table[] getAllTablesInRemoveOrder()
public abstract void setupDataSource() throws DatabaseInitException
BasicDataSource
DatabaseInitException
public void close() throws SQLException
close
in class Database
SQLException
- DB Errorpublic int getVersion() throws SQLException
Database
getVersion
in class Database
SQLException
- If a database error occurs.public void setVersion(int version) throws SQLException
Database
setVersion
in class Database
version
- Integer starting from 0, incremented by one when schema is
updated.SQLException
- If a database error occurs.public boolean isNewDatabase() throws SQLException
isNewDatabase
in class Database
SQLException
public boolean wasSeenBefore(UUID uuid)
Database
wasSeenBefore
in class Database
uuid
- UUID of the user.public void removeAccount(UUID uuid) throws SQLException
Database
removeAccount
in class Database
uuid
- UUID of the account.SQLException
- If a database error occurs.public void removeAllData() throws SQLException
Database
Uses DELETE * FROM table.
removeAllData
in class Database
SQLException
- if remove fails.public void setAvailable()
public Connection getConnection() throws SQLException
SQLException
public void commit(Connection connection) throws SQLException
MySQL has Auto Commit enabled.
commit
in class Database
SQLException
public void rollback(Connection connection) throws SQLException
MySQL has Auto Commit enabled.
SQLException
public boolean isOpen()
Copyright © 2017. All rights reserved.