| 1 | #include "duckdb/parser/transformer.hpp" | 
|---|---|
| 2 | #include "duckdb/parser/expression/function_expression.hpp" | 
| 3 | #include "duckdb/parser/statement/call_statement.hpp" | 
| 4 | #include "duckdb/parser/expression/constant_expression.hpp" | 
| 5 | |
| 6 | namespace duckdb { | 
| 7 | |
| 8 | unique_ptr<SQLStatement> Transformer::TransformCheckpoint(duckdb_libpgquery::PGCheckPointStmt &stmt) { | 
| 9 | vector<unique_ptr<ParsedExpression>> children; | 
| 10 | // transform into "CALL checkpoint()" or "CALL force_checkpoint()" | 
| 11 | 	auto checkpoint_name = stmt.force ? "force_checkpoint": "checkpoint";  | 
| 12 | auto result = make_uniq<CallStatement>(); | 
| 13 | auto function = make_uniq<FunctionExpression>(args&: checkpoint_name, args: std::move(children)); | 
| 14 | if (stmt.name) { | 
| 15 | function->children.push_back(x: make_uniq<ConstantExpression>(args: Value(stmt.name))); | 
| 16 | } | 
| 17 | result->function = std::move(function); | 
| 18 | return std::move(result); | 
| 19 | } | 
| 20 | |
| 21 | } // namespace duckdb | 
| 22 |