Interface BaseDB

All Known Implementing Classes:
FileAsDataBase

public interface BaseDB
BaseDB接口定義了連接到數據庫和斷開與數據庫的基本操作。
Since:
2024-02-22
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    默認的JDBC鏈接。
    static final String
    SQLite數據庫的JDBC鏈接。
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    建立與數據庫的連接。
    void
    關閉與數據庫的連接。
    void
    runNormal(String command)
    在數據庫上執行非查詢SQL命令。
    runSearch(String command)
    在數據庫上執行SQL查詢命令並返回生成的ResultSet。
  • Field Details

  • Method Details

    • connect

      void connect() throws SQLException
      建立與數據庫的連接。
      Throws:
      SQLException - 如果發生數據庫訪問錯誤
    • disconnect

      void disconnect() throws SQLException
      關閉與數據庫的連接。
      Throws:
      SQLException - 如果發生數據庫訪問錯誤
    • runNormal

      void runNormal(String command) throws SQLException
      在數據庫上執行非查詢SQL命令。
      Parameters:
      command - 要執行的SQL命令
      Throws:
      SQLException - 如果發生數據庫訪問錯誤或SQL命令執行失敗
    • runSearch

      ResultSet runSearch(String command) throws SQLException
      在數據庫上執行SQL查詢命令並返回生成的ResultSet。
      Parameters:
      command - 要執行的SQL命令
      Returns:
      SQL命令執行生成的ResultSet
      Throws:
      SQLException - 如果發生數據庫訪問錯誤或SQL命令執行失敗