Package wtf.choco.veinminer.data
Class PersistentDataStorageSQLite
java.lang.Object
wtf.choco.veinminer.data.PersistentDataStorageSQL
wtf.choco.veinminer.data.PersistentDataStorageSQLite
- All Implemented Interfaces:
PersistentDataStorage
An implementation of
PersistentDataStorage
for SQLite databases.-
Nested Class Summary
Nested classes/interfaces inherited from interface wtf.choco.veinminer.data.PersistentDataStorage
PersistentDataStorage.Type
-
Constructor Summary
ConstructorDescriptionPersistentDataStorageSQLite
(@NotNull VeinMinerServer veinMiner, @NotNull Path directoryPath, @NotNull String fileName) Construct a newPersistentDataStorageSQLite
. -
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
-
PersistentDataStorageSQLite
public PersistentDataStorageSQLite(@NotNull @NotNull VeinMinerServer veinMiner, @NotNull @NotNull Path directoryPath, @NotNull @NotNull String fileName) throws IOException Construct a newPersistentDataStorageSQLite
.- Parameters:
veinMiner
- the vein miner serverdirectoryPath
- the path to the directory in which the database is locatedfileName
- the name of the file at which the database is located- Throws:
IOException
- if an exception occurs while creating the database file (if it was not already created)
-
-
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
-