slightly better print, column alias supported
This commit is contained in:
14
parser.cpp
14
parser.cpp
@@ -241,12 +241,18 @@ namespace usql {
|
||||
auto column_value = parse_expression();
|
||||
std::string column_alias;
|
||||
|
||||
if (column_value->node_type == NodeType::database_value) {
|
||||
column_alias = ((DatabaseValueNode*) column_value.get())->col_name;
|
||||
if (m_lexer.tokenType() == TokenType::keyword_as) {
|
||||
m_lexer.skipToken(TokenType::keyword_as);
|
||||
column_alias = m_lexer.consumeCurrentToken().token_string;
|
||||
} else {
|
||||
column_alias = "c" + std::to_string(i);
|
||||
i++;
|
||||
if (column_value->node_type == NodeType::database_value) {
|
||||
column_alias = ((DatabaseValueNode*) column_value.get())->col_name;
|
||||
} else {
|
||||
column_alias = "c" + std::to_string(i);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
cols->push_back(SelectColNode{std::move(column_value), column_alias});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user