Class SQLiteDatabaseClient
java.lang.Object
dev.rafex.ether.database.sqlite.client.SQLiteDatabaseClient
- All Implemented Interfaces:
dev.rafex.ether.database.core.DatabaseClient, dev.rafex.ether.database.core.transaction.TransactionRunner
public class SQLiteDatabaseClient
extends Object
implements dev.rafex.ether.database.core.DatabaseClient
SQLite-specific wrapper around
JdbcDatabaseClient.
This class provides SQLite-specific configuration and error handling
while delegating all database operations to JdbcDatabaseClient.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionSQLiteDatabaseClient(DataSource dataSource) Creates a newSQLiteDatabaseClientwith the specified data source.SQLiteDatabaseClient(DataSource dataSource, SQLiteConfig config) Creates a newSQLiteDatabaseClientwith the specified data source and configuration. -
Method Summary
Modifier and TypeMethodDescriptionlong[]static SQLiteDatabaseClient.Builderbuilder(DataSource dataSource) Returns a builder for creatingSQLiteDatabaseClientinstances.intexecute(dev.rafex.ether.database.core.sql.SqlQuery query) Returns the SQLite configuration, if present.<T> TinTransaction(dev.rafex.ether.database.core.transaction.TransactionCallback<T> callback) <T> Tquery(dev.rafex.ether.database.core.sql.SqlQuery query, dev.rafex.ether.database.core.mapping.ResultSetExtractor<T> extractor) <T> List<T> queryList(dev.rafex.ether.database.core.sql.SqlQuery query, dev.rafex.ether.database.core.mapping.RowMapper<T> mapper) <T> Optional<T> queryOne(dev.rafex.ether.database.core.sql.SqlQuery query, dev.rafex.ether.database.core.mapping.RowMapper<T> mapper)
-
Constructor Details
-
SQLiteDatabaseClient
Creates a newSQLiteDatabaseClientwith the specified data source.- Parameters:
dataSource- the data source to use for database connections- Throws:
NullPointerException- ifdataSourceisnull
-
SQLiteDatabaseClient
Creates a newSQLiteDatabaseClientwith the specified data source and configuration.- Parameters:
dataSource- the data source to use for database connectionsconfig- the SQLite configuration to apply- Throws:
NullPointerException- ifdataSourceorconfigisnull
-
-
Method Details
-
builder
Returns a builder for creatingSQLiteDatabaseClientinstances.- Parameters:
dataSource- the data source to use- Returns:
- a builder instance
-
getConfig
Returns the SQLite configuration, if present.- Returns:
- an optional containing the SQLite configuration, or empty if not configured
-
query
public <T> T query(dev.rafex.ether.database.core.sql.SqlQuery query, dev.rafex.ether.database.core.mapping.ResultSetExtractor<T> extractor) - Specified by:
queryin interfacedev.rafex.ether.database.core.DatabaseClient
-
queryList
public <T> List<T> queryList(dev.rafex.ether.database.core.sql.SqlQuery query, dev.rafex.ether.database.core.mapping.RowMapper<T> mapper) - Specified by:
queryListin interfacedev.rafex.ether.database.core.DatabaseClient
-
queryOne
public <T> Optional<T> queryOne(dev.rafex.ether.database.core.sql.SqlQuery query, dev.rafex.ether.database.core.mapping.RowMapper<T> mapper) - Specified by:
queryOnein interfacedev.rafex.ether.database.core.DatabaseClient
-
execute
public int execute(dev.rafex.ether.database.core.sql.SqlQuery query) - Specified by:
executein interfacedev.rafex.ether.database.core.DatabaseClient
-
batch
-
inTransaction
public <T> T inTransaction(dev.rafex.ether.database.core.transaction.TransactionCallback<T> callback) - Specified by:
inTransactionin interfacedev.rafex.ether.database.core.transaction.TransactionRunner
-