Package at.hugob.plugin.library.database
Class AbstractDatabase<T extends org.bukkit.plugin.java.JavaPlugin>
java.lang.Object
at.hugob.plugin.library.database.AbstractDatabase<T>
- Direct Known Subclasses:
MySQLDatabase,SQLiteDatabase
the common code for databases
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractDatabase(T plugin, @NotNull DataSource dataSource, @NotNull String tablePrefix) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidA dummy method so I don't forget to create the SQL tables This needs to be executed on your own!protected ConnectionGets a connection from the DataSource to execute SQL queries on
-
Field Details
-
plugin
the plugin who initiated the database, mostly used for logging -
tablePrefix
the prefix for the tabels in the database
-
-
Constructor Details
-
AbstractDatabase
public AbstractDatabase(@NotNull T plugin, @NotNull @NotNull DataSource dataSource, @NotNull @NotNull String tablePrefix) - Parameters:
plugin- The plugin that initiates the database, mostly used for loggingdataSource- The SQL DataSource that is used to interact with the DatabasetablePrefix- The general Table prefix used for SQL Tables
-
-
Method Details
-
getConnection
Gets a connection from the DataSource to execute SQL queries on- Returns:
- the Database Connection
- Throws:
SQLException- gets thrown if a database access error occurs
-
createTables
protected abstract void createTables()A dummy method so I don't forget to create the SQL tables This needs to be executed on your own!
-