1 | #include "duckdb/parser/transformer.hpp" |
---|---|
2 | |
3 | namespace duckdb { |
4 | |
5 | vector<string> Transformer::TransformStringList(duckdb_libpgquery::PGList *list) { |
6 | vector<string> result; |
7 | if (!list) { |
8 | return result; |
9 | } |
10 | for (auto node = list->head; node != nullptr; node = node->next) { |
11 | result.emplace_back(args&: reinterpret_cast<duckdb_libpgquery::PGValue *>(node->data.ptr_value)->val.str); |
12 | } |
13 | return result; |
14 | } |
15 | |
16 | string Transformer::TransformAlias(duckdb_libpgquery::PGAlias *root, vector<string> &column_name_alias) { |
17 | if (!root) { |
18 | return ""; |
19 | } |
20 | column_name_alias = TransformStringList(list: root->colnames); |
21 | return root->aliasname; |
22 | } |
23 | |
24 | } // namespace duckdb |
25 |