some refactorings

This commit is contained in:
2022-01-02 12:45:53 +01:00
parent d3a373ce94
commit ebb69b6096
10 changed files with 57 additions and 54 deletions

View File

@@ -19,7 +19,7 @@ std::vector<std::pair<std::string, std::string>> Settings::m_settings =
long Settings::string_to_long(const std::string &intstr) {
try {
return std::stol(intstr);
} catch (std::invalid_argument &e) {
} catch (const std::invalid_argument &e) {
throw Exception("error parsing as integer: " + intstr);
}
}

View File

@@ -183,7 +183,7 @@ void Table::commit_row(Row &row) {
try {
validate_row(row);
index_row(row);
} catch (Exception &e) {
} catch (const Exception &e) {
throw e;
}
}

View File

@@ -11,7 +11,7 @@ std::unique_ptr<Table> USql::execute(const std::string &command) {
std::unique_ptr<Node> node = m_parser.parse(command);
return execute(*node);
} catch (std::exception &e) {
} catch (const std::exception &e) {
return create_stmt_result_table(-1, e.what(), 0);
}

View File

@@ -82,8 +82,7 @@ std::unique_ptr<ValueNode> USql::pp_function(const std::vector<std::unique_ptr<V
return std::make_unique<StringValueNode>(parsed_value->getStringValue());
}
std::unique_ptr<ValueNode>
USql::max_function(const std::vector<std::unique_ptr<ValueNode>> &evaluatedPars, const ColDefNode *col_def_node, ColValue *agg_func_value) {
std::unique_ptr<ValueNode> USql::max_function(const std::vector<std::unique_ptr<ValueNode>> &evaluatedPars, const ColDefNode *col_def_node, ColValue *agg_func_value) {
if (col_def_node->type == ColumnType::integer_type || col_def_node->type == ColumnType::date_type) {
if (!evaluatedPars[0]->isNull()) {
auto val = evaluatedPars[0]->getIntegerValue();