1#include "duckdb/planner/binder.hpp"
2#include "duckdb/parser/statement/alter_table_statement.hpp"
3#include "duckdb/parser/statement/transaction_statement.hpp"
4#include "duckdb/parser/statement/pragma_statement.hpp"
5#include "duckdb/planner/operator/logical_simple.hpp"
6#include "duckdb/catalog/catalog.hpp"
7
8using namespace std;
9
10//! This file contains the binder definitions for statements that do not need to be bound at all and only require a
11//! straightforward conversion
12
13namespace duckdb {
14
15BoundStatement Binder::Bind(AlterTableStatement &stmt) {
16 BoundStatement result;
17 result.names = {"Success"};
18 result.types = {SQLType::BOOLEAN};
19 auto table =
20 Catalog::GetCatalog(context).GetEntry<TableCatalogEntry>(context, stmt.info->schema, stmt.info->table, true);
21 if (table && !table->temporary) {
22 // we can only alter temporary tables in read-only mode
23 this->read_only = false;
24 }
25 result.plan = make_unique<LogicalSimple>(LogicalOperatorType::ALTER, move(stmt.info));
26 return result;
27}
28
29BoundStatement Binder::Bind(PragmaStatement &stmt) {
30 BoundStatement result;
31 result.names = {"Success"};
32 result.types = {SQLType::BOOLEAN};
33 result.plan = make_unique<LogicalSimple>(LogicalOperatorType::PRAGMA, move(stmt.info));
34 return result;
35}
36
37BoundStatement Binder::Bind(TransactionStatement &stmt) {
38 // transaction statements do not require a valid transaction
39 this->requires_valid_transaction = false;
40
41 BoundStatement result;
42 result.names = {"Success"};
43 result.types = {SQLType::BOOLEAN};
44 result.plan = make_unique<LogicalSimple>(LogicalOperatorType::TRANSACTION, move(stmt.info));
45 return result;
46}
47
48} // namespace duckdb
49