018fdf5516
Update the Database class to include explicit methods for fetching various entity types, managing relationships, and querying file paths. Implement hashing logic in the File module to facilitate tracking by unique identifiers. Add C++20 support in configuration files.
37 lines
1.2 KiB
C++
37 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include "Containers.h"
|
|
|
|
#include <cstdint>
|
|
#include <optional>
|
|
#include <set>
|
|
#include <sqlite3.h>
|
|
|
|
using queue = std::vector<Track>;
|
|
|
|
class Database {
|
|
public:
|
|
Database( const char* filename );
|
|
~Database();
|
|
void fetch( const std::string& query ) const;
|
|
void fetchAlbum( const std::string& album ) const;
|
|
void fetchAll( std::vector<Track>& entries ) const;
|
|
void fetchAll( std::map<std::string, Track>& entries ) const;
|
|
void fetchHashes( std::set<uint_fast64_t>& hashes );
|
|
std::set<const char*> fetchFilePaths();
|
|
std::optional<int> getArtistId( const std::string& artistName );
|
|
std::optional<int> getAlbumId( const std::string& albumTitle );
|
|
std::optional<int> getGenreId( const std::string& genre );
|
|
void addTrack( Track t);
|
|
void addArtist( const std::string& artistName );
|
|
void addAlbum( Track t);
|
|
void addGenre( std::string& genre );
|
|
void setActive( bool active );
|
|
void updateFilePath( const std::string& filePath );
|
|
|
|
sqlite3* getDb() { return db_; };
|
|
private:
|
|
sqlite3* db_;
|
|
sqlite3_stmt* stmnt;
|
|
};
|