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