Simplified some path writes
This commit is contained in:
@@ -72,9 +72,9 @@ namespace lms::db
|
||||
// Session living class handling the database and the login
|
||||
Db::Db(const std::filesystem::path& dbPath, std::size_t connectionCount)
|
||||
{
|
||||
LMS_LOG(DB, INFO, "Creating connection pool on file " << dbPath.string());
|
||||
LMS_LOG(DB, INFO, "Creating connection pool on file " << dbPath);
|
||||
|
||||
auto connection{ std::make_unique<Connection>(dbPath.string()) };
|
||||
auto connection{ std::make_unique<Connection>(dbPath) };
|
||||
if (core::IConfig * config{ core::Service<core::IConfig>::get() }) // may not be here on testU
|
||||
connection->setProperty("show-queries", config->getBool("db-show-queries", false) ? "true" : "false");
|
||||
|
||||
|
||||
@@ -89,17 +89,12 @@ namespace lms::db
|
||||
if (path.empty())
|
||||
return path;
|
||||
|
||||
// Convert the path to string
|
||||
std::string pathStr{ path.string() };
|
||||
|
||||
// Check if the last character is a directory separator
|
||||
if (pathStr.back() != std::filesystem::path::preferred_separator)
|
||||
{
|
||||
// If not, add the preferred separator
|
||||
pathStr += std::filesystem::path::preferred_separator;
|
||||
}
|
||||
|
||||
// Return the new path
|
||||
return std::filesystem::path{ pathStr };
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace lms::db
|
||||
{
|
||||
session.checkReadTransaction();
|
||||
|
||||
return utils::fetchQuerySingleResult(session.getDboSession()->query<Wt::Dbo::ptr<PlayListFile>>("SELECT pl_f from playlist_file pl_f").where("pl_f.absolute_file_path = ?").bind(p.string()));
|
||||
return utils::fetchQuerySingleResult(session.getDboSession()->query<Wt::Dbo::ptr<PlayListFile>>("SELECT pl_f from playlist_file pl_f").where("pl_f.absolute_file_path = ?").bind(p));
|
||||
}
|
||||
|
||||
void PlayListFile::find(Session& session, PlayListFileId& lastRetrievedId, std::size_t count, const std::function<void(const pointer&)>& func)
|
||||
|
||||
@@ -233,7 +233,7 @@ namespace lms::db
|
||||
{
|
||||
session.checkReadTransaction();
|
||||
|
||||
return utils::fetchQuerySingleResult(session.getDboSession()->query<Wt::Dbo::ptr<Track>>("SELECT t from track t").where("t.absolute_file_path = ?").bind(p.string()));
|
||||
return utils::fetchQuerySingleResult(session.getDboSession()->query<Wt::Dbo::ptr<Track>>("SELECT t from track t").where("t.absolute_file_path = ?").bind(p));
|
||||
}
|
||||
|
||||
Track::pointer Track::find(Session& session, TrackId id)
|
||||
|
||||
Reference in New Issue
Block a user