1#include "duckdb/parser/statement/transaction_statement.hpp"
2#include "duckdb/parser/transformer.hpp"
3
4namespace duckdb {
5
6unique_ptr<TransactionStatement> Transformer::TransformTransaction(duckdb_libpgquery::PGTransactionStmt &stmt) {
7 switch (stmt.kind) {
8 case duckdb_libpgquery::PG_TRANS_STMT_BEGIN:
9 case duckdb_libpgquery::PG_TRANS_STMT_START:
10 return make_uniq<TransactionStatement>(args: TransactionType::BEGIN_TRANSACTION);
11 case duckdb_libpgquery::PG_TRANS_STMT_COMMIT:
12 return make_uniq<TransactionStatement>(args: TransactionType::COMMIT);
13 case duckdb_libpgquery::PG_TRANS_STMT_ROLLBACK:
14 return make_uniq<TransactionStatement>(args: TransactionType::ROLLBACK);
15 default:
16 throw NotImplementedException("Transaction type %d not implemented yet", stmt.kind);
17 }
18}
19
20} // namespace duckdb
21