some TODO items squezed

This commit is contained in:
2021-12-19 12:07:26 +01:00
parent eebb270f47
commit 04c0ed3f03
5 changed files with 49 additions and 35 deletions

View File

@@ -147,7 +147,7 @@ void Table::create_row_from_vector(const std::vector<ColDefNode> &colDefs, const
commit_row(new_row);
}
void Table::print() {
void Table::print() {
std::string out{"| "};
std::string out2{"+-"};
@@ -261,7 +261,6 @@ bool Table::drop_index(const std::string &index_name) {
return false;
}
void Table::index_row(Index &index, const ColDefNode &col_def, const Row &row, const size_t rowid) {
index.insert(reinterpret_cast<ColValue *>(&row[col_def.order]), rowid);
}
@@ -275,7 +274,6 @@ void Table::reindex_row(Index &index, const ColDefNode &col_def, const Row &old_
index_row(index, col_def, new_row, rowid);
}
void Table::index_row(const Row &row) {
if (!m_indexes.empty()) {
const size_t rowid = get_rowid(row);
@@ -306,7 +304,6 @@ void Table::reindex_row(const Row &old_row, const Row &new_row) {
}
}
void Table::index_rows(const std::string &index_name) {
auto index = get_index(index_name);
@@ -318,7 +315,6 @@ void Table::index_rows(const std::string &index_name) {
}
}
Index * Table::get_index(const std::string &index_name) {
auto it = std::find_if(m_indexes.begin(), m_indexes.end(),
[&index_name](const Index &idx) {
@@ -337,6 +333,13 @@ Index * Table::get_index_for_column(const std::string &col_name) {
return (it != m_indexes.end()) ? &(*it) : nullptr;
}
bool Table::empty() {
if (m_rows.empty()) return true;
for (const auto & r : m_rows)
if (r.is_visible()) return false;
return true;
}
Row *Table::rows_scanner::next() {
if (m_use_rowids) {