select * added
This commit is contained in:
21
parser.cpp
21
parser.cpp
@@ -226,17 +226,24 @@ namespace usql {
|
||||
|
||||
int i = 1;
|
||||
while (m_lexer.tokenType() != TokenType::keyword_from) {
|
||||
auto column_value = parse_value();
|
||||
std::string column_alias;
|
||||
if (m_lexer.tokenType()==TokenType::multiply) {
|
||||
std::string name = m_lexer.consumeCurrentToken().token_string;
|
||||
auto multiply_char = std::make_unique<ColNameNode>(name);
|
||||
|
||||
if (column_value->node_type == NodeType::column_name) {
|
||||
column_alias = ((ColNameNode*) column_value.get())->name;
|
||||
cols->push_back(SelectColNode{std::move(multiply_char), "*"});
|
||||
} else {
|
||||
column_alias = "c" + std::to_string(i);
|
||||
i++;
|
||||
auto column_value = parse_value();
|
||||
std::string column_alias;
|
||||
|
||||
if (column_value->node_type == NodeType::column_name) {
|
||||
column_alias = ((ColNameNode*) column_value.get())->name;
|
||||
} else {
|
||||
column_alias = "c" + std::to_string(i);
|
||||
i++;
|
||||
}
|
||||
cols->push_back(SelectColNode{std::move(column_value), column_alias});
|
||||
}
|
||||
|
||||
cols->push_back(SelectColNode{std::move(column_value), column_alias});
|
||||
|
||||
m_lexer.skipTokenOptional(TokenType::comma);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user