#ifndef SQLITE_DATABASE_H #define SQLITE_DATABASE_H #include "database_interface.h" #include #include // Forward declaration class SQLiteStatement; // SQLite implementation of the DatabaseInterface class SQLiteDatabase : public DatabaseInterface { private: sqlite3 *db_; // Pointer to SQLite database connection // Helper functions int executeNonQuery( const std::string &query, const std::function &bindFunc = nullptr); std::vector> executeSelectQuery( const std::string &query, const std::function &bindFunc = nullptr); friend class SQLiteDatabaseForeignKeyTest; friend class SQLiteDatabaseCRUDTest; friend class SQLiteDatabaseTriggerTest; public: // Verification of the database availability bool isDatabaseAvailable() override { return db_ != nullptr; } public: SQLiteDatabase(const std::string &db_file); ~SQLiteDatabase(); SQLiteDatabase(const SQLiteDatabase &) = delete; SQLiteDatabase &operator=(const SQLiteDatabase &) = delete; SQLiteDatabase(SQLiteDatabase &&) noexcept; SQLiteDatabase &operator=(SQLiteDatabase &&) noexcept; // Genre operations bool addGenre(const NewGenre &genre) override; bool removeGenre(int genre_id) override; bool updateGenre(const Genre &genre) override; Genre getGenre(int genre_id) override; std::vector getAllGenres() override; // Movie operations bool addMovie(const NewMovie &movie) override; bool removeMovie(int movie_id) override; bool updateMovie(const Movie &movie) override; Movie getMovie(int movie_id) override; std::vector getAllMovies() override; // Hall operations bool addHall(const NewHall &hall) override; bool removeHall(int hall_id) override; bool updateHall(const Hall &hall) override; Hall getHall(int hall_id) override; std::vector getAllHalls() override; // Session operations bool addSession(const NewSession &session) override; bool removeSession(int session_id) override; bool updateSession(const Session &session) override; Session getSession(int session_id) override; std::vector getAllSessions() override; // Ticket operations bool addTicket(const NewTicket &ticket) override; bool removeTicket(int ticket_id) override; bool updateTicket(const Ticket &ticket) override; Ticket getTicket(int ticket_id) override; std::vector getAllTickets() override; // Refund operations bool addRefund(const NewRefund &refund) override; bool removeRefund(int refund_id) override; bool updateRefund(const Refund &refund) override; Refund getRefund(int refund_id) override; std::vector getAllRefunds() override; }; #endif // SQLITE_DATABASE_H