print column size fix

This commit is contained in:
2021-08-09 09:32:29 +02:00
parent 19585dda8c
commit 474b789d12
5 changed files with 144 additions and 17 deletions

View File

@@ -75,7 +75,6 @@ int Table::load_csv_string(const std::string &content) {
auto csv = csvparser.parseCSV(content);
std::vector<ColDefNode> &colDefs = m_col_defs;
for (auto it = csv.begin() + 1; it != csv.end(); ++it) {
std::vector<std::string> csv_line = *it;
@@ -133,7 +132,8 @@ void Table::print() {
std::vector<int> col_char_sizes{};
for(const auto& col_def : m_col_defs) {
int col_size = col_def.type == ColumnType::varchar_type ? col_def.length : 10;
int col_size = col_def.type == ColumnType::varchar_type ? col_def.length :
col_def.type == ColumnType::float_type ? 20 : 10;
col_char_sizes.push_back(col_size);
out.append(string_padd(col_def.name, col_size, ' ', true) + " | ");