fixes
This commit is contained in:
parent
3e6ed45562
commit
42a81b1c8e
@ -613,7 +613,7 @@ void file_manager::remove_upload(const std::string &api_path, bool no_lock) {
|
||||
.equals(api_path)
|
||||
.go();
|
||||
if (not result.ok()) {
|
||||
utils::error::raise_api_path_error(function_name, to_api_path,
|
||||
utils::error::raise_api_path_error(function_name, api_path,
|
||||
"failed to remove from upload table");
|
||||
}
|
||||
|
||||
@ -623,8 +623,7 @@ void file_manager::remove_upload(const std::string &api_path, bool no_lock) {
|
||||
.go();
|
||||
if (not result.ok()) {
|
||||
utils::error::raise_api_path_error(
|
||||
function_name, to_api_path,
|
||||
"failed to remove from upload_active table");
|
||||
function_name, api_path, "failed to remove from upload_active table");
|
||||
}
|
||||
|
||||
if (upload_lookup_.find(api_path) != upload_lookup_.end()) {
|
||||
@ -970,6 +969,10 @@ void file_manager::store_resume(const i_open_file &file) {
|
||||
|
||||
void file_manager::swap_renamed_items(std::string from_api_path,
|
||||
std::string to_api_path, bool directory) {
|
||||
static constexpr const std::string_view function_name{
|
||||
static_cast<const char *>(__FUNCTION__),
|
||||
};
|
||||
|
||||
auto file_iter = open_file_lookup_.find(from_api_path);
|
||||
if (file_iter != open_file_lookup_.end()) {
|
||||
auto ptr = std::move(open_file_lookup_[from_api_path]);
|
||||
|
@ -143,23 +143,54 @@ TEST_F(database_test, db_update_query) {
|
||||
query_str.c_str());
|
||||
}
|
||||
|
||||
// auto res = query.go();
|
||||
//
|
||||
// EXPECT_TRUE(res.ok());
|
||||
// EXPECT_TRUE(res.has_row());
|
||||
// std::size_t row_count{};
|
||||
// while (res.has_row()) {
|
||||
// std::optional<db::db_select::row> row;
|
||||
// EXPECT_TRUE(res.get_row(row));
|
||||
// EXPECT_TRUE(row.has_value());
|
||||
// if (row.has_value()) {
|
||||
// for (const auto &column : row.value().get_columns()) {
|
||||
// std::cout << column.get_index() << ':';
|
||||
// std::cout << column.get_name() << ':';
|
||||
// std::cout << column.get_value<std::string>() << std::endl;
|
||||
// }
|
||||
// }
|
||||
// ++row_count;
|
||||
// }
|
||||
// EXPECT_EQ(std::size_t(1U), row_count);
|
||||
TEST_F(database_test, insert_select_delete) {
|
||||
{
|
||||
auto query = db::db_insert{*db3.get(), "table"}
|
||||
.column_value("column1", "test0")
|
||||
.column_value("column2", "test1");
|
||||
auto res = query.go();
|
||||
EXPECT_TRUE(res.ok());
|
||||
}
|
||||
|
||||
{
|
||||
auto query = db::db_select{*db3.get(), "table"};
|
||||
EXPECT_TRUE(res.ok());
|
||||
EXPECT_TRUE(res.has_row());
|
||||
|
||||
std::size_t row_count{};
|
||||
while (res.has_row()) {
|
||||
std::optional<db::db_select::row> row;
|
||||
EXPECT_TRUE(res.get_row(row));
|
||||
EXPECT_TRUE(row.has_value());
|
||||
if (row.has_value()) {
|
||||
for (auto &&column : row.value().get_columns()) {
|
||||
std::cout << column.get_index() << ':';
|
||||
std::cout << column.get_name() << ':';
|
||||
std::cout << column.get_value<std::string>() << std::endl;
|
||||
}
|
||||
}
|
||||
++row_count;
|
||||
}
|
||||
|
||||
EXPECT_EQ(std::size_t(1U), row_count);
|
||||
}
|
||||
|
||||
{
|
||||
auto query = db::db_delete{*db3.get(), "table"};
|
||||
auto res = query.go();
|
||||
EXPECT_TRUE(res.ok());
|
||||
}
|
||||
|
||||
{
|
||||
auto query = db::db_select{*db3.get(), "table"};
|
||||
EXPECT_TRUE(res.ok());
|
||||
|
||||
std::size_t row_count{};
|
||||
while (res.has_row()) {
|
||||
++row_count;
|
||||
}
|
||||
|
||||
EXPECT_EQ(std::size_t(0U), row_count);
|
||||
}
|
||||
}
|
||||
} // namespace repertory
|
||||
|
Loading…
x
Reference in New Issue
Block a user