Removed method from public interface
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <Wt/Dbo/SqlConnectionPool.h>
|
#include <Wt/Dbo/SqlConnectionPool.h>
|
||||||
@@ -37,7 +38,7 @@ namespace lms::db
|
|||||||
|
|
||||||
Session& getTLSSession() override;
|
Session& getTLSSession() override;
|
||||||
|
|
||||||
void executeSql(const std::string& sql) override;
|
void executeSql(const std::string& sql);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Db(const Db&) = delete;
|
Db(const Db&) = delete;
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ namespace lms::db::Migration
|
|||||||
class ScopedNoForeignKeys
|
class ScopedNoForeignKeys
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ScopedNoForeignKeys(IDb& db)
|
ScopedNoForeignKeys(Db& db)
|
||||||
: _db{ db }
|
: _db{ db }
|
||||||
{
|
{
|
||||||
_db.executeSql("PRAGMA foreign_keys=OFF");
|
_db.executeSql("PRAGMA foreign_keys=OFF");
|
||||||
@@ -83,7 +83,7 @@ namespace lms::db::Migration
|
|||||||
ScopedNoForeignKeys& operator=(const ScopedNoForeignKeys&) = delete;
|
ScopedNoForeignKeys& operator=(const ScopedNoForeignKeys&) = delete;
|
||||||
ScopedNoForeignKeys& operator=(ScopedNoForeignKeys&&) = delete;
|
ScopedNoForeignKeys& operator=(ScopedNoForeignKeys&&) = delete;
|
||||||
|
|
||||||
IDb& _db;
|
Db& _db;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@@ -1422,7 +1422,7 @@ WHERE art.image_id IS NULL)");
|
|||||||
{
|
{
|
||||||
constexpr std::string_view outdatedMsg{ "Outdated database, please rebuild it (delete the .db file and restart)" };
|
constexpr std::string_view outdatedMsg{ "Outdated database, please rebuild it (delete the .db file and restart)" };
|
||||||
|
|
||||||
ScopedNoForeignKeys noPragmaKeys{ session.getDb() };
|
ScopedNoForeignKeys noPragmaKeys{ static_cast<Db&>(session.getDb()) };
|
||||||
|
|
||||||
using MigrationFunction = std::function<void(Session&)>;
|
using MigrationFunction = std::function<void(Session&)>;
|
||||||
|
|
||||||
|
|||||||
@@ -360,7 +360,7 @@ namespace lms::db
|
|||||||
// We manually take a lock here since vacuum cannot be inside a transaction
|
// We manually take a lock here since vacuum cannot be inside a transaction
|
||||||
{
|
{
|
||||||
std::unique_lock lock{ static_cast<Db&>(_db).getMutex() };
|
std::unique_lock lock{ static_cast<Db&>(_db).getMutex() };
|
||||||
_db.executeSql("VACUUM");
|
static_cast<Db&>(_db).executeSql("VACUUM");
|
||||||
}
|
}
|
||||||
|
|
||||||
LMS_LOG(DB, INFO, "Vacuum complete!");
|
LMS_LOG(DB, INFO, "Vacuum complete!");
|
||||||
|
|||||||
@@ -31,8 +31,6 @@ namespace lms::db
|
|||||||
virtual ~IDb() = default;
|
virtual ~IDb() = default;
|
||||||
|
|
||||||
virtual Session& getTLSSession() = 0;
|
virtual Session& getTLSSession() = 0;
|
||||||
|
|
||||||
virtual void executeSql(const std::string& sql) = 0; // TODO make this private
|
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unique_ptr<IDb> createDb(const std::filesystem::path& dbPath, std::size_t connectionCount = 10);
|
std::unique_ptr<IDb> createDb(const std::filesystem::path& dbPath, std::size_t connectionCount = 10);
|
||||||
|
|||||||
Reference in New Issue
Block a user