java.lang.Object
org.litebridge.db.spi.impl.AbstractDatabaseProvider
org.litebridge.db.sqlite.SQLiteDatabaseProvider
- All Implemented Interfaces:
DatabaseProvider
SQLite Database Provider for Litebridge.
This class provides SQLite-specific implementations for database interactions.
-
Field Summary
Fields inherited from class org.litebridge.db.spi.impl.AbstractDatabaseProvider
columnIdentifierGenerator, deleteSqlGenerator, insertSqlGenerator, selectSqlGenerator, typeConverter, updateSqlGenerator -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected PreparedStatementcreatePreparedStatementUsingConnection(PreparedSql preparedSql, ManagedConnection connection) Creates aPreparedStatementusing the provided connection and prepared SQL.protected Map<ColumnMetaData, Object> extractGeneratedKeys(List<ColumnMetaData> generatedPrimaryKeys, PreparedStatement preparedStatement) Extract the generated primary key values from the provided prepared statement.protected TableMetaDatafetchTableMetaData(Table table, ConnectionProvider connectionProvider) Retrieve metadata for the specified table, including its primary keys and expressions.protected List<ColumnMetaData> getColumnMetaData(Table table, DatabaseMetaData databaseMetaData) Retrieve column metadata for the specified table.protected org.slf4j.LoggerReturn the logger instance for this database provider.getSequenceColumnValueGenerator(String sequence) SQLite does not support sequences.Methods inherited from class org.litebridge.db.spi.impl.AbstractDatabaseProvider
createAliasTransformer, createColumnIdentifierGenerator, createDeleteSqlGenerator, createInsertSqlGenerator, createSelectSqlGenerator, createSqlFunctionRegistryFactory, createUpdateSqlGenerator, delete, ensureTableMetaData, executeSqlInsert, executeSqlUpdate, getAliasTransformer, getPrimaryKeyColumnNames, getSqlFunctionRegistry, getTypeConverter, insert, nativeSqlQuery, nativeSqlUpdate, prepareNativeStatement, prepareStatement, select, tableMetaData, toSql, update, verifySchemaAndTableExists
-
Constructor Details
-
SQLiteDatabaseProvider
public SQLiteDatabaseProvider()
-
-
Method Details
-
createPreparedStatementUsingConnection
protected PreparedStatement createPreparedStatementUsingConnection(PreparedSql preparedSql, ManagedConnection connection) throws SQLException Description copied from class:AbstractDatabaseProviderCreates aPreparedStatementusing the provided connection and prepared SQL.- Overrides:
createPreparedStatementUsingConnectionin classAbstractDatabaseProvider- Parameters:
preparedSql- the SQL and bind values to useconnection- the connection to use for preparing the statement- Returns:
- the created prepared statement
- Throws:
SQLException- if a database access error occurs
-
extractGeneratedKeys
protected Map<ColumnMetaData,Object> extractGeneratedKeys(List<ColumnMetaData> generatedPrimaryKeys, PreparedStatement preparedStatement) throws SQLException Description copied from class:AbstractDatabaseProviderExtract the generated primary key values from the provided prepared statement.- Overrides:
extractGeneratedKeysin classAbstractDatabaseProvider- Parameters:
generatedPrimaryKeys- the list ofColumnMetaDataobjects representing the generated primary key columnspreparedStatement- the executedPreparedStatementcontaining any generated keys- Returns:
- a map of
ColumnMetaDatato the generated key value - Throws:
SQLException- if an error occurs while retrieving the generated keys
-
fetchTableMetaData
protected TableMetaData fetchTableMetaData(Table table, ConnectionProvider connectionProvider) throws SQLException Description copied from class:AbstractDatabaseProviderRetrieve metadata for the specified table, including its primary keys and expressions.This executes a database query to fetch database metadata.
- Overrides:
fetchTableMetaDatain classAbstractDatabaseProvider- Parameters:
table- the table for which metadata is being fetched, containing schema, catalog, and table name detailsconnectionProvider- theConnectionProviderused to obtain a database connection.- Returns:
- a
TableMetaDataobject containing details about the table's structure, primary keys, and column metadata - Throws:
SQLException- if an error occurs while fetching database metadata
-
getColumnMetaData
protected List<ColumnMetaData> getColumnMetaData(Table table, DatabaseMetaData databaseMetaData) throws SQLException Description copied from class:AbstractDatabaseProviderRetrieve column metadata for the specified table.- Overrides:
getColumnMetaDatain classAbstractDatabaseProvider- Parameters:
table- theTableobject representing the tabledatabaseMetaData- theDatabaseMetaDataobject used to retrieve column information- Returns:
- a list of
ColumnMetaDataobjects representing the table's columns - Throws:
SQLException- if an error occurs while retrieving column metadata
-
getSequenceColumnValueGenerator
public SequenceColumnValueGenerator getSequenceColumnValueGenerator(String sequence) throws UnsupportedOperationException SQLite does not support sequences. Throws anUnsupportedOperationExceptionif called.- Specified by:
getSequenceColumnValueGeneratorin interfaceDatabaseProvider- Overrides:
getSequenceColumnValueGeneratorin classAbstractDatabaseProvider- Parameters:
sequence- the sequence name- Returns:
- N/A; throws an
UnsupportedOperationException - Throws:
UnsupportedOperationException- if called
-
getLogger
protected org.slf4j.Logger getLogger()Description copied from class:AbstractDatabaseProviderReturn the logger instance for this database provider.- Overrides:
getLoggerin classAbstractDatabaseProvider- Returns:
- the logger instance
-