From 4ef01c1382b482be9126fadfb9729379fba11242 Mon Sep 17 00:00:00 2001 From: ErodeesFleurs <862959461@qq.com> Date: Mon, 29 Jul 2024 14:18:35 +0800 Subject: [PATCH] oops --- src/common/common.h | 3 ++- src/system/sm_manager.cpp | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/common/common.h b/src/common/common.h index 8817d97..b1379ce 100644 --- a/src/common/common.h +++ b/src/common/common.h @@ -59,7 +59,8 @@ struct Value { } else if constexpr (std::is_same_v<T, std::string>) { set_str(val); } else { - throw std::runtime_error("Invalid value type"); + throw std::runtime_error("Invalid value type: " + + std::string(typeid(T).name())); } return *this; } diff --git a/src/system/sm_manager.cpp b/src/system/sm_manager.cpp index 3aaf470..91b9415 100644 --- a/src/system/sm_manager.cpp +++ b/src/system/sm_manager.cpp @@ -450,12 +450,16 @@ void SmManager::load_record(const std::string file_path, int idx = 0; while (std::getline(ss, value, ',')) { Value x; + // std::cerr << "value: " << value << std::endl; if (tab_meta.cols[idx].type == ColType::TYPE_INT) { - x = std::stoi(value); + x.set_int(std::stoi(value)); + // x = std::stoi(value); } else if (tab_meta.cols[idx].type == ColType::TYPE_FLOAT) { - x = std::stod(value); + x.set_float(std::stod(value)); + // x = std::stod(value); } else { - x = value; + x.set_str(value); + // x = value; } x.init_raw(tab_meta.cols[idx].len); record.rewrite(x.raw->data, tab_meta.cols[idx].offset, -- GitLab