Package wtf.choco.veinminer.data
Class PersistentDataStorageMySQL
java.lang.Object
wtf.choco.veinminer.data.PersistentDataStorageSQL
wtf.choco.veinminer.data.PersistentDataStorageMySQL
- All Implemented Interfaces:
PersistentDataStorage
An implementation of
PersistentDataStorage
for MySQL servers.-
Nested Class Summary
Nested classes/interfaces inherited from interface wtf.choco.veinminer.data.PersistentDataStorage
PersistentDataStorage.Type
-
Constructor Summary
ConstructorDescriptionPersistentDataStorageMySQL
(@NotNull VeinMinerServer veinMiner, @NotNull String host, int port, @NotNull String username, @NotNull String password, @NotNull String database, @NotNull String tablePrefix) Construct a newPersistentDataStorageMySQL
. -
Method Summary
Modifier and TypeMethodDescriptionprotected @NotNull String
Get the statement used to create the players table.protected @NotNull String
Get the statement used to insert a player's data into the players table.protected @NotNull String
getSelectAllPlayerDataBatchQuery
(int count) Get the statement used to select multiple players' data from the players table.protected @NotNull String
Get the statement used to select all of a player's data from the players table.@NotNull PersistentDataStorage.Type
getType()
Get thePersistentDataStorage.Type
of persistent storage.protected void
Initialize the SQL driver required for this implementation.protected @NotNull Connection
Open a newConnection
to the database.Methods inherited from class wtf.choco.veinminer.data.PersistentDataStorageSQL
importLegacyData, init, load, load, save, save
-
Constructor Details
-
PersistentDataStorageMySQL
public PersistentDataStorageMySQL(@NotNull @NotNull VeinMinerServer veinMiner, @NotNull @NotNull String host, int port, @NotNull @NotNull String username, @NotNull @NotNull String password, @NotNull @NotNull String database, @NotNull @NotNull String tablePrefix) Construct a newPersistentDataStorageMySQL
.- Parameters:
veinMiner
- the vein miner serverhost
- the server hostport
- the server portusername
- the usernamepassword
- the passworddatabase
- the database to usetablePrefix
- the prefix for all tables created by this implementation
-
-
Method Details
-
getType
Description copied from interface:PersistentDataStorage
Get thePersistentDataStorage.Type
of persistent storage.- Returns:
- the type
-
initDriver
Description copied from class:PersistentDataStorageSQL
Initialize the SQL driver required for this implementation.- Specified by:
initDriver
in classPersistentDataStorageSQL
- Throws:
ClassNotFoundException
- if the driver class could not be found
-
openConnection
Description copied from class:PersistentDataStorageSQL
Open a newConnection
to the database.- Specified by:
openConnection
in classPersistentDataStorageSQL
- Returns:
- a new connection
- Throws:
SQLException
- if an SQL exception occurred while opening the connection
-
getCreatePlayersTableStatement
Description copied from class:PersistentDataStorageSQL
Get the statement used to create the players table.- Specified by:
getCreatePlayersTableStatement
in classPersistentDataStorageSQL
- Returns:
- the create table statement
-
getInsertPlayerDataStatement
Description copied from class:PersistentDataStorageSQL
Get the statement used to insert a player's data into the players table.- Specified by:
getInsertPlayerDataStatement
in classPersistentDataStorageSQL
- Returns:
- the insert player data statement
-
getSelectAllPlayerDataQuery
Description copied from class:PersistentDataStorageSQL
Get the statement used to select all of a player's data from the players table.- Specified by:
getSelectAllPlayerDataQuery
in classPersistentDataStorageSQL
- Returns:
- the select player data statement
-
getSelectAllPlayerDataBatchQuery
Description copied from class:PersistentDataStorageSQL
Get the statement used to select multiple players' data from the players table.- Specified by:
getSelectAllPlayerDataBatchQuery
in classPersistentDataStorageSQL
- Parameters:
count
- the amount of players that need selecting- Returns:
- the select player data statement
-