diff --git a/usql/row.h b/usql/row.h index b4edf66..4ffb9cf 100644 --- a/usql/row.h +++ b/usql/row.h @@ -171,7 +171,7 @@ public: case 5: return (ColValue &) *std::get_if(&m_columns[i]); default: - throw Exception("should not happen"); + throw Exception("ColValue &operator[](int i), type index invalid :" + std::to_string(type_index)); } } diff --git a/usql/usql_dml.cpp b/usql/usql_dml.cpp index eeca189..ed3dc6b 100644 --- a/usql/usql_dml.cpp +++ b/usql/usql_dml.cpp @@ -155,8 +155,7 @@ void USql::setup_order_columns(std::vector &node, Table *table) { void USql::execute_distinct(SelectFromTableNode &node, Table *result) { if (!node.distinct) return; - auto compare_rows = [](const Row &a, const Row &b) { return a.compare(b) >= 0; }; - std::sort(result->m_rows.begin(), result->m_rows.end(), compare_rows); + std::sort(result->m_rows.begin(), result->m_rows.end(), [](const Row &a, const Row &b) { return a.compare(b) > 0; }); result->m_rows.erase(std::unique(result->m_rows.begin(), result->m_rows.end()), result->m_rows.end()); }