Interface DatabaseProvider

All Known Implementing Classes:
AbstractDatabaseProvider, H2DatabaseProvider, OracleDatabaseProvider, TransactionalDatabaseProvider

public interface DatabaseProvider
Main interface for interacting with a database.

This interface defines the operations for retrieving metadata, executing SQL queries, and managing data within a specific database backend.

  • Method Details

    • tableMetaData

      TableMetaData tableMetaData(Table table, ConnectionProvider connectionProvider) throws SQLException
      Retrieve metadata for the specified table.
      Parameters:
      table - the Table object representing the table for which metadata is to be retrieved.
      connectionProvider - the ConnectionProvider used to get a database connection.
      Returns:
      a TableMetaData object containing metadata information about the specified table, including its columns, primary key, and other details.
      Throws:
      SQLException - if any SQL error occurs while retrieving the metadata.
    • insert

      InsertResult insert(Insert insert, ConnectionProvider connectionProvider) throws SQLException
      Execute an INSERT operation in the database using the provided Insert statement.
      Parameters:
      insert - the Insert statement containing the table, columns, and rows to insert.
      connectionProvider - the ConnectionProvider used to get a database connection.
      Returns:
      an InsertResult containing the number of rows affected and any generated keys.
      Throws:
      SQLException - if any SQL error occurs during the execution of the insert operation.
    • update

      UpdateResult update(Update update, ConnectionProvider connectionProvider) throws SQLException
      Execute an UPDATE operation in the database using the provided Update statement.
      Parameters:
      update - the Update statement containing the table, columns, and rows to update.
      connectionProvider - the ConnectionProvider used to get a database connection.
      Returns:
      an UpdateResult containing the number of rows affected.
      Throws:
      SQLException - if any SQL error occurs during the execution of the update operation.
    • select

      List<Row> select(Select select, ConnectionProvider connectionProvider) throws SQLException
      Execute a SELECT operation in the database using the provided Select statement.
      Parameters:
      select - the Select statement containing information about the table, columns, joins, conditions, ordering, and optional limits for the query.
      connectionProvider - the ConnectionProvider used to get a database connection.
      Returns:
      a List of Row objects representing the results of the SELECT operation.
      Throws:
      SQLException - if any SQL error occurs during the execution of the SELECT operation.
    • delete

      UpdateResult delete(Delete delete, ConnectionProvider connectionProvider) throws SQLException
      Throws:
      SQLException
    • toSql

      String toSql(Select select)
    • getTypeConverter

      TypeConverter getTypeConverter()
      Retrieve the TypeConverter instance associated with the database provider.

      The TypeConverter is used for converting objects between different types, typically for database data type conversions and mapping domain-specific representations.

      Returns:
      the TypeConverter instance for handling data type conversions