1//===----------------------------------------------------------------------===//
2// DuckDB
3//
4// duckdb/planner/planner.hpp
5//
6//
7//===----------------------------------------------------------------------===//
8
9#pragma once
10
11#include "duckdb/parser/sql_statement.hpp"
12#include "duckdb/planner/binder.hpp"
13#include "duckdb/planner/logical_operator.hpp"
14#include "duckdb/planner/expression/bound_parameter_data.hpp"
15
16namespace duckdb {
17class ClientContext;
18class PreparedStatementData;
19
20//! The planner creates a logical query plan from the parsed SQL statements
21//! using the Binder and LogicalPlanGenerator.
22class Planner {
23 friend class Binder;
24
25public:
26 explicit Planner(ClientContext &context);
27
28 unique_ptr<LogicalOperator> plan;
29 vector<string> names;
30 vector<LogicalType> types;
31 bound_parameter_map_t value_map;
32 vector<BoundParameterData> parameter_data;
33
34 shared_ptr<Binder> binder;
35 ClientContext &context;
36
37 StatementProperties properties;
38
39public:
40 void CreatePlan(unique_ptr<SQLStatement> statement);
41 static void VerifyPlan(ClientContext &context, unique_ptr<LogicalOperator> &op,
42 bound_parameter_map_t *map = nullptr);
43
44private:
45 void CreatePlan(SQLStatement &statement);
46 shared_ptr<PreparedStatementData> PrepareSQLStatement(unique_ptr<SQLStatement> statement);
47};
48} // namespace duckdb
49