Class MariaDBDialect
java.lang.Object
xyz.srnyx.annoyingapi.storage.dialects.Dialect
xyz.srnyx.annoyingapi.storage.dialects.sql.SQLDialect
xyz.srnyx.annoyingapi.storage.dialects.sql.MariaDBDialect
SQL dialect for MariaDB database
-
Nested Class Summary
Nested classes/interfaces inherited from class xyz.srnyx.annoyingapi.storage.dialects.Dialect
Dialect.MigrationData -
Field Summary
Fields inherited from class xyz.srnyx.annoyingapi.storage.dialects.sql.SQLDialect
cache, connectionFields inherited from class xyz.srnyx.annoyingapi.storage.dialects.Dialect
dataManager -
Constructor Summary
ConstructorsConstructorDescriptionMariaDBDialect(@NotNull DataManager dataManager) Creates a new MariaDB dialect -
Method Summary
Modifier and TypeMethodDescription@NotNull PreparedStatementcreateKeyImpl(@NotNull String table, @NotNull String key) Create a key in the given table@NotNull PreparedStatementcreateTableImpl(@NotNull String table) Create a table in the databaseprotected @NotNull PreparedStatementgetAllValuesFromDatabaseImpl(@NotNull String table) Get all values from the databasegetFromDatabaseImpl(@NotNull String table, @NotNull String target, @NotNull String column) Get a value from the database@NotNull PreparedStatementGet all tables from the databasebooleanremoveFromDatabaseImpl(@NotNull String table, @NotNull String target, @NotNull String column) Remove a value from the database@Nullable FailedSetsetToDatabaseImpl(@NotNull String table, @NotNull String target, @NotNull String column, @NotNull String value) Set a value to the databasesetToDatabaseImpl(@NotNull String table, @NotNull String target, @NotNull ConcurrentHashMap<String, Value> data) Set multiple values to the databaseMethods inherited from class xyz.srnyx.annoyingapi.storage.dialects.sql.SQLDialect
createKey, createTable, createTablesKeys, getAllValuesFromDatabase, getFromCacheImpl, getMigrationDataFromDatabaseImpl, getTables, markRemovedInCacheImpl, saveCacheImpl, saveCacheImpl, setToCacheImpl, setValuesParametersMethods inherited from class xyz.srnyx.annoyingapi.storage.dialects.Dialect
getFromCache, getFromDatabase, getMigrationDataFromDatabase, markRemovedInCache, removeValueFromDatabase, saveCache, saveCache, setToCache, setToDatabase, setToDatabase, setToDatabase
-
Constructor Details
-
MariaDBDialect
Creates a new MariaDB dialect- Parameters:
dataManager-Dialect.dataManager- Throws:
ConnectionException- if a database connection error occurs
-
-
Method Details
-
getTablesImpl
Description copied from class:SQLDialectGet all tables from the database- Specified by:
getTablesImplin classSQLDialect- Returns:
- the
PreparedStatementwith the set parameters - Throws:
SQLException- if a database error occurs
-
createTableImpl
@NotNull public @NotNull PreparedStatement createTableImpl(@NotNull @NotNull String table) throws SQLException Description copied from class:SQLDialectCreate a table in the database- Specified by:
createTableImplin classSQLDialect- Parameters:
table- the table to create- Returns:
- the
PreparedStatementwith the set parameters - Throws:
SQLException- if a database error occurs
-
createKeyImpl
@NotNull public @NotNull PreparedStatement createKeyImpl(@NotNull @NotNull String table, @NotNull @NotNull String key) throws SQLException Description copied from class:SQLDialectCreate a key in the given table- Specified by:
createKeyImplin classSQLDialect- Parameters:
table- the table to create the key inkey- the key to create- Returns:
- the
PreparedStatementwith the set parameters - Throws:
SQLException- if a database error occurs
-
getAllValuesFromDatabaseImpl
@NotNull protected @NotNull PreparedStatement getAllValuesFromDatabaseImpl(@NotNull @NotNull String table) throws SQLException Description copied from class:SQLDialectGet all values from the database- Specified by:
getAllValuesFromDatabaseImplin classSQLDialect- Parameters:
table- the table to get the values from- Returns:
- the
PreparedStatementwith the set parameters - Throws:
SQLException- if a database error occurs
-
getFromDatabaseImpl
@NotNull public @NotNull Optional<String> getFromDatabaseImpl(@NotNull @NotNull String table, @NotNull @NotNull String target, @NotNull @NotNull String column) Description copied from class:DialectGet a value from the database- Specified by:
getFromDatabaseImplin classDialect- Parameters:
table- the table to get fromtarget- the target to get fromcolumn- the key to get- Returns:
- the value, empty if not found
-
setToDatabaseImpl
@Nullable public @Nullable FailedSet setToDatabaseImpl(@NotNull @NotNull String table, @NotNull @NotNull String target, @NotNull @NotNull String column, @NotNull @NotNull String value) Description copied from class:DialectSet a value to the database- Specified by:
setToDatabaseImplin classDialect- Parameters:
table- the table to set totarget- the target to set tocolumn- the key to setvalue- the value to set- Returns:
- the failed value information, null if successful
-
setToDatabaseImpl
@NotNull public @NotNull Set<FailedSet> setToDatabaseImpl(@NotNull @NotNull String table, @NotNull @NotNull String target, @NotNull @NotNull ConcurrentHashMap<String, Value> data) Description copied from class:DialectSet multiple values to the database- Specified by:
setToDatabaseImplin classDialect- Parameters:
table- the table to set totarget- the target to set todata- the data to set- Returns:
- set of failed values as
FailedSets
-
removeFromDatabaseImpl
public boolean removeFromDatabaseImpl(@NotNull @NotNull String table, @NotNull @NotNull String target, @NotNull @NotNull String column) Description copied from class:DialectRemove a value from the database- Specified by:
removeFromDatabaseImplin classDialect- Parameters:
table- the table to remove fromtarget- the target to remove fromcolumn- the key to remove- Returns:
- true if the value was successfully removed, false otherwise
-