Interface Database

All Known Implementing Classes:
FileDatabase

public interface Database
  • Method Details

    • isConnected

      boolean isConnected()
    • openConnection

      void openConnection()
    • closeConnection

      void closeConnection()
    • getDataSource

      DataSource getDataSource()
      Retrieves the DataSource associated with this database.
      Returns:
      The DataSource instance used for database connections.
    • createTableIfNotExists

      void createTableIfNotExists(String name, String... columns)
    • dropTable

      void dropTable(String table)
    • renameTable

      void renameTable(String table, String newName)
    • addColumn

      void addColumn(String table, String columnName)
    • renameColumn

      void renameColumn(String table, String column, String newName)
    • clearTable

      void clearTable(String table)
    • insert

      DatabaseStatement insert(String table, String... columns)
    • merge

      DatabaseStatement merge(String table, String primaryKey, String... columns)
    • selectAll

      DatabaseStatement selectAll(String table)
    • createStatement

      DatabaseStatement createStatement(String sql)
      Creates a statement for this database with the given sql
      Parameters:
      sql - the sql statement
      Returns:
      a new DatabaseStatement
    • execute

      void execute(String sql)
      Executes a SQL statement against the database.
      Parameters:
      sql - The SQL statement to execute.
    • executeUpdate

      int executeUpdate(String sql)
      Executes an SQL statement that may modify the database (such as INSERT, UPDATE, DELETE).
      Parameters:
      sql - The SQL statement to execute.
      Returns:
      The number of rows affected by the statement.
    • executeLargeUpdate

      long executeLargeUpdate(String sql)
      Executes a large update SQL statement that may modify the database.
      Parameters:
      sql - The SQL statement to execute.
      Returns:
      The number of rows affected by the statement.
    • executeQuery

      void executeQuery(String sql, QueryReader reader)
      Executes an SQL query and processes the results using a QueryReader.
      Parameters:
      sql - The SQL query to execute.
      reader - The QueryReader implementation to process the query results.
    • executeRowQuery

      void executeRowQuery(String sql, QueryReader reader)
      Executes an SQL query and processes the results using a QueryReader.
      Parameters:
      sql - The SQL query to execute.
      reader - The QueryReader implementation to process the query results.