java.lang.Object
net.foxgenesis.database.AbstractDatabase
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
WatameBotDatabase
NEED_JAVADOC
- Author:
- Ashley
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceNEED_JAVADOCstatic interfaceNEED_JAVADOC -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractDatabase(String name, ModuleResource operationsFile, ModuleResource setupFile) NEED_JAVADOC -
Method Summary
Modifier and TypeMethodDescriptionfinal StringgetName()protected final StringNEED_JAVADOCprotected final booleanhasStatementID(String id) NEED_JAVADOCbooleanisReady()NEED_JAVADOCprotected <U> UmapCallable(String id, AbstractDatabase.SQLFunction<CallableStatement, U> func, Consumer<Throwable> error) NEED_JAVADOCprotected <U> UmapStatement(String id, AbstractDatabase.SQLFunction<PreparedStatement, U> func, Consumer<Throwable> error) NEED_JAVADOCprotected abstract voidonReady()NEED_JAVADOCprotected ConnectionNEED_JAVADOCprotected voidprepareCallable(String id, AbstractDatabase.SQLConsumer<CallableStatement> func, Consumer<Throwable> error) NEED_JAVADOCprotected <U> CompletableFuture<U>prepareCallableAsync(String id, Function<CallableStatement, U> func) Deprecated.protected voidprepareStatement(String id, AbstractDatabase.SQLConsumer<PreparedStatement> func, Consumer<Throwable> error) NEED_JAVADOCprotected <U> CompletableFuture<U>prepareStatementAsync(String id, Function<PreparedStatement, U> func) Deprecated.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.AutoCloseable
close
-
Field Details
-
logger
@Nonnull protected final org.slf4j.Logger loggerLogger
-
-
Constructor Details
-
AbstractDatabase
public AbstractDatabase(@Nonnull String name, @Nonnull ModuleResource operationsFile, @Nonnull ModuleResource setupFile) NEED_JAVADOC- Parameters:
name-operationsFile-setupFile-
-
-
Method Details
-
onReady
protected abstract void onReady()NEED_JAVADOC -
openConnection
NEED_JAVADOC- Returns:
- Throws:
SQLException
-
prepareStatementAsync
@Deprecated protected <U> CompletableFuture<U> prepareStatementAsync(String id, Function<PreparedStatement, U> func) Deprecated.NEED_JAVADOC- Type Parameters:
U-- Parameters:
id-func-- Returns:
-
prepareCallableAsync
@Deprecated protected <U> CompletableFuture<U> prepareCallableAsync(String id, Function<CallableStatement, U> func) Deprecated.NEED_JAVADOC- Type Parameters:
U-- Parameters:
id-func-- Returns:
-
prepareStatement
protected void prepareStatement(String id, AbstractDatabase.SQLConsumer<PreparedStatement> func, Consumer<Throwable> error) NEED_JAVADOC- Parameters:
id-func-error-
-
prepareCallable
protected void prepareCallable(String id, AbstractDatabase.SQLConsumer<CallableStatement> func, Consumer<Throwable> error) NEED_JAVADOC- Parameters:
id-func-error-
-
mapStatement
protected <U> U mapStatement(String id, AbstractDatabase.SQLFunction<PreparedStatement, U> func, Consumer<Throwable> error) NEED_JAVADOC- Type Parameters:
U-- Parameters:
id-func-error-- Returns:
-
mapCallable
protected <U> U mapCallable(String id, AbstractDatabase.SQLFunction<CallableStatement, U> func, Consumer<Throwable> error) NEED_JAVADOC- Type Parameters:
U-- Parameters:
id-func-error-- Returns:
-
hasStatementID
NEED_JAVADOC- Parameters:
id-- Returns:
-
getRawStatement
NEED_JAVADOC- Parameters:
id-- Returns:
-
getName
-
isReady
public boolean isReady()NEED_JAVADOC- Returns:
-