simple distinct added

This commit is contained in:
2021-08-01 14:31:19 +02:00
parent 4a344d0e77
commit 50a7993a2e
9 changed files with 41 additions and 12 deletions

View File

@@ -208,10 +208,16 @@ namespace usql {
}
std::unique_ptr<Node> Parser::parse_select_from_table() {
bool distinct = false;
auto cols = std::make_unique<std::vector<SelectColNode>>();
m_lexer.skipToken(TokenType::keyword_select);
if (m_lexer.tokenType() == TokenType::keyword_distinct) {
distinct = true;
m_lexer.skipToken(TokenType::keyword_distinct);
}
int i = 1;
while (m_lexer.tokenType() != TokenType::keyword_from) {
auto column_value = parse_value();
@@ -240,7 +246,7 @@ namespace usql {
OffsetLimitNode offsetlimit_node = parse_offset_limit_clause();
return std::make_unique<SelectFromTableNode>(table_name, std::move(cols), std::move(where_node), orderby_node, offsetlimit_node);
return std::make_unique<SelectFromTableNode>(table_name, std::move(cols), std::move(where_node), orderby_node, offsetlimit_node, distinct);
}
std::unique_ptr<Node> Parser::parse_delete_from_table() {