1#include "duckdb/parser/statement/pragma_statement.hpp"
2#include "duckdb/parser/transformer.hpp"
3
4using namespace duckdb;
5using namespace std;
6
7unique_ptr<PragmaStatement> Transformer::TransformShow(PGNode *node) {
8 // we transform SHOW x into PRAGMA SHOW('x')
9
10 auto stmt = reinterpret_cast<PGVariableShowStmt *>(node);
11
12 auto result = make_unique<PragmaStatement>();
13 auto &info = *result->info;
14
15 if (string(stmt->name) == "tables") {
16 // show all tables
17 info.name = "show_tables";
18 info.pragma_type = PragmaType::NOTHING;
19 } else {
20 // show one specific table
21 info.name = "show";
22 info.pragma_type = PragmaType::CALL;
23 info.parameters.push_back(Value(stmt->name));
24 }
25
26 return result;
27}
28