Class SQLitePragmas
java.lang.Object
dev.rafex.ether.database.sqlite.config.SQLitePragmas
Utility to apply SQLite PRAGMA settings to a connection.
This class helps configure SQLite connections with optimal settings for performance, durability, and feature compatibility.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidapply(Connection connection, SQLiteConfig config) Applies configuration to a SQLite connection.static voidapplyDefaults(Connection connection) Applies default configuration to a SQLite connection.static voiddisableWal(Connection connection) Disables Write-Ahead Logging (WAL) mode on a connection.static voidenableWal(Connection connection) Enables Write-Ahead Logging (WAL) mode on a connection.static voidsetSynchronousMode(Connection connection, SynchronousMode mode) Sets the synchronous mode on a connection.
-
Method Details
-
apply
Applies configuration to a SQLite connection.Executes the necessary
PRAGMAstatements to configure the connection according to the provided configuration.- Parameters:
connection- SQLite connectionconfig- configuration to apply- Throws:
SQLException- if any PRAGMA statement failsNullPointerException- ifconnectionorconfigisnull
-
applyDefaults
Applies default configuration to a SQLite connection.Equivalent to
apply(connection, SQLiteConfig.defaults()).- Parameters:
connection- SQLite connection- Throws:
SQLException- if any PRAGMA statement failsNullPointerException- ifconnectionisnull
-
enableWal
Enables Write-Ahead Logging (WAL) mode on a connection.This is a convenience method for enabling WAL mode specifically.
- Parameters:
connection- SQLite connection- Throws:
SQLException- if the PRAGMA statement failsNullPointerException- ifconnectionisnull
-
disableWal
Disables Write-Ahead Logging (WAL) mode on a connection.This is a convenience method for disabling WAL mode specifically.
- Parameters:
connection- SQLite connection- Throws:
SQLException- if the PRAGMA statement failsNullPointerException- ifconnectionisnull
-
setSynchronousMode
public static void setSynchronousMode(Connection connection, SynchronousMode mode) throws SQLException Sets the synchronous mode on a connection.This is a convenience method for setting synchronous mode specifically.
- Parameters:
connection- SQLite connectionmode- synchronous mode- Throws:
SQLException- if the PRAGMA statement failsNullPointerException- ifconnectionormodeisnull
-