Interface DBManager
- All Known Subinterfaces:
AsyncDBManager,SyncDBManager
- All Known Implementing Classes:
AbstractDBManager,AbstractMariaDBManager,AbstractSqliteManager,AsyncMariaDBManager,AsyncSqliteManager,MariaDBManager,SqliteManager
Parent interface of all database managers
-
Method Summary
Modifier and TypeMethodDescriptiondefault AsyncDBManagerasync()Callsasync(int)with timeoutSecs being 2async(int timeoutSeconds) Creates an AsyncDBManager with same information as the current database managerdefault StringbuildSqlWithParams(String sql, @NotNull List<Object> params, boolean cut) Creates a SQL statement by replacing question marks with the params listvoidConnects the manager to the database again, when it is not connectedvoidclose()Close the database managervoidconnect()Connect the database manager with the databasevoidClose the database managercallscheckConnection()and returns a database connectiongetName()Get the name of this database managerbooleanisClosed()Show if the database manager is closedsync()Creates a SyncDBManager with same information as the current database manager (When called from an AsyncDBManager the param timeoutSeconds will be forgotten)
-
Method Details
-
getName
-
isClosed
boolean isClosed()Show if the database manager is closed- Returns:
- true if the database manager is closed
-
close
void close()Close the database manager -
connect
Connect the database manager with the database- Throws:
IllegalStateException- if the DBManager is closed
-
disconnect
void disconnect()Close the database manager -
checkConnection
Connects the manager to the database again, when it is not connected- Throws:
IllegalStateException- when the DBManager is closed
-
getConnection
callscheckConnection()and returns a database connection- Returns:
- a database connection
- Throws:
IllegalStateException- when the DBManager is closed
-
async
Callsasync(int)with timeoutSecs being 2- Returns:
- an AsyncDBManager with the values initialized with
-
async
Creates an AsyncDBManager with same information as the current database manager- Parameters:
timeoutSeconds- TheCompletableFuture.completeOnTimeout(T, long, java.util.concurrent.TimeUnit)time in seconds- Returns:
- 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:
- a synchronous copy of the current database manager
-
buildSqlWithParams
Creates a SQL statement by replacing question marks with the params list- Parameters:
sql- SQL Command with ?'sparams- Parameter for ?'s in SQLcut- Shorten SELECT, WHERE, FROM to SEL, WRE, FR- Returns:
- the SQL with replaced question marks
-