usql update

This commit is contained in:
2021-08-23 18:14:05 +02:00
parent 8d220356f2
commit 0e90d6047c
28 changed files with 1623 additions and 3774 deletions

View File

@@ -4,35 +4,42 @@
#include "row.h"
#include <vector>
#include <list>
namespace usql {
struct Table {
Table(const Table &other);
Table(const std::string name, const std::vector<ColDefNode> columns);
Table(const std::string& name, const std::vector<ColDefNode>& columns);
ColDefNode get_column_def(const std::string &col_name);
ColDefNode get_column_def(int col_index);
int columns_count() const { return m_col_defs.size(); };
[[nodiscard]] int columns_count() const { return (int) m_col_defs.size(); };
[[nodiscard]] size_t rows_count() const { return m_rows.size(); };
Row create_empty_row(); // TODO this means unnecessary copying
void add_row(const Row &row);
void add_copy_of_row(const Row &row);
Row& create_empty_row();
void commit_row(const Row &row);
void commit_copy_of_row(const Row &row);
void validate_column(const ColDefNode *col_def, ValueNode *col_val);
void validate_column(const ColDefNode *col_def, ColValue *col_val);
static void validate_column(const ColDefNode *col_def, ValueNode *col_val);
static void validate_column(const ColDefNode *col_def, ColValue &col_val);
void validate_row(const Row &row);
std::string csv_string();
int load_csv_string(const std::string &content);
int load_csv_file(const std::string &filename);
void print();
std::string m_name;
std::vector<ColDefNode> m_col_defs;
std::list<Row> m_rows;
std::vector<Row> m_rows;
static long string_to_long(const std::string &s) ;
static double string_to_double(const std::string &s) ;
void create_row_from_vector(const std::vector<ColDefNode> &colDefs, const std::vector<std::string> &csv_line);
};
}
}