public abstract class SQLDB extends AbstractDatabase
Database.State
Modifier and Type | Field and Description |
---|---|
protected PlanConfig |
config |
protected com.djrapitops.plugin.logging.error.ErrorHandler |
errorHandler |
protected Locale |
locale |
protected com.djrapitops.plugin.logging.console.PluginLogger |
logger |
protected com.djrapitops.plugin.task.RunnableFactory |
runnableFactory |
accessLock
Constructor and Description |
---|
SQLDB(java.util.function.Supplier<java.util.UUID> serverUUIDSupplier,
Locale locale,
PlanConfig config,
com.djrapitops.plugin.task.RunnableFactory runnableFactory,
com.djrapitops.plugin.logging.console.PluginLogger logger,
com.djrapitops.plugin.logging.error.ErrorHandler errorHandler) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
boolean |
equals(java.lang.Object o) |
java.util.concurrent.Future<?> |
executeTransaction(Transaction transaction)
Execute an SQL Transaction.
|
abstract java.sql.Connection |
getConnection() |
java.util.function.Supplier<java.util.UUID> |
getServerUUIDSupplier() |
int |
hashCode() |
void |
init()
Initializes the Database.
|
<T> T |
query(Query<T> query)
Execute an SQL Query statement to get a result.
|
abstract void |
returnToPool(java.sql.Connection connection) |
void |
setTransactionExecutorServiceProvider(java.util.function.Supplier<java.util.concurrent.ExecutorService> transactionExecutorServiceProvider) |
abstract void |
setupDataSource()
Set up the source for connections.
|
getState, setState
protected final Locale locale
protected final PlanConfig config
protected final com.djrapitops.plugin.task.RunnableFactory runnableFactory
protected final com.djrapitops.plugin.logging.console.PluginLogger logger
protected final com.djrapitops.plugin.logging.error.ErrorHandler errorHandler
public SQLDB(java.util.function.Supplier<java.util.UUID> serverUUIDSupplier, Locale locale, PlanConfig config, com.djrapitops.plugin.task.RunnableFactory runnableFactory, com.djrapitops.plugin.logging.console.PluginLogger logger, com.djrapitops.plugin.logging.error.ErrorHandler errorHandler)
public void init()
Database
Queries can be performed after this request has completed all required transactions for the database operations.
public abstract void setupDataSource()
DBInitException
- If the DataSource fails to be initialized.public void close()
public abstract java.sql.Connection getConnection() throws java.sql.SQLException
java.sql.SQLException
public abstract void returnToPool(java.sql.Connection connection)
public <T> T query(Query<T> query)
Database
This method should only be called from an asynchronous thread.
T
- Type of the object to be returned.query
- QueryStatement to execute.public java.util.concurrent.Future<?> executeTransaction(Transaction transaction)
Database
transaction
- Transaction to execute.public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.util.function.Supplier<java.util.UUID> getServerUUIDSupplier()
public void setTransactionExecutorServiceProvider(java.util.function.Supplier<java.util.concurrent.ExecutorService> transactionExecutorServiceProvider)