DBManager
| Type | 🟢 Interface |
| Package | io.github.mrtesz.teszcore.api.db.manager |
| GitHub | DBManager.java |
| Extends | Copyable<DBManager> |
Description
Parent interface of all database managers
Methods
getName
String getName();
Get the name of this database manager
Returns: String — the name of the database manager
isClosed
boolean isClosed();
Show if the database manager is closed
Returns: boolean — true if the database manager is closed
close
void close();
Close the database manager
connect
void connect() throws IllegalStateException;
Connect the database manager with the database
Throws: IllegalStateException when isClosed() is true
disconnect
void disconnect();
Close the database manager
checkConnection
void checkConnection() throws IllegalStateException;
Connects the manager to the database again, when it is not connected
Throws: IllegalStateException when the database manager is closed
getConnection
Connection getConnection();
calls checkConnection() and returns a database connection
Returns: Connection a database connection
Throws: IllegalStateException when the database manager is closed
async
AsyncDBManager async();
AsyncDBManager async(int timeoutSeconds);
Creates an AsyncDBManager with same information as the current database manager
| Parameter | Type | Annotations | Description |
|---|---|---|---|
timeoutSeconds | int | (optional) The completeOnTimeout time in seconds Default: 2 |
Returns: AsyncDBManager - an asynchronous copy of the current database manager
sync
SyncDBManager sync();
Creates a SyncDBManager with same information as the current database manager (When called from an AsyncDBManager the param timeoutSeconds will be forgotten)
Returns: SyncDBManager - a synchronous copy of the current database manager
buildSqlWithParams
String buildSqlWithParams(String sql, @NotNull List<Object> params, boolean cut);
Creates a SQL statement by replacing question marks with the params list
Returns: String - the SQL with replaced question marks