1#include "duckdb/parser/statement/load_statement.hpp"
2#include "duckdb/parser/transformer.hpp"
3
4namespace duckdb {
5
6unique_ptr<LoadStatement> Transformer::TransformLoad(duckdb_libpgquery::PGLoadStmt &stmt) {
7 D_ASSERT(stmt.type == duckdb_libpgquery::T_PGLoadStmt);
8
9 auto load_stmt = make_uniq<LoadStatement>();
10 auto load_info = make_uniq<LoadInfo>();
11 load_info->filename = std::string(stmt.filename);
12 switch (stmt.load_type) {
13 case duckdb_libpgquery::PG_LOAD_TYPE_LOAD:
14 load_info->load_type = LoadType::LOAD;
15 break;
16 case duckdb_libpgquery::PG_LOAD_TYPE_INSTALL:
17 load_info->load_type = LoadType::INSTALL;
18 break;
19 case duckdb_libpgquery::PG_LOAD_TYPE_FORCE_INSTALL:
20 load_info->load_type = LoadType::FORCE_INSTALL;
21 break;
22 }
23 load_stmt->info = std::move(load_info);
24 return load_stmt;
25}
26
27} // namespace duckdb
28