1 | #include "duckdb/execution/operator/helper/physical_prepare.hpp" |
---|---|
2 | #include "duckdb/main/client_context.hpp" |
3 | #include "duckdb/catalog/catalog_entry/prepared_statement_catalog_entry.hpp" |
4 | |
5 | using namespace duckdb; |
6 | using namespace std; |
7 | |
8 | void PhysicalPrepare::GetChunkInternal(ClientContext &context, DataChunk &chunk, PhysicalOperatorState *state) { |
9 | // create the catalog entry |
10 | auto entry = make_unique<PreparedStatementCatalogEntry>(name, move(prepared)); |
11 | entry->catalog = &context.catalog; |
12 | |
13 | // now store plan in context |
14 | auto &dependencies = entry->prepared->dependencies; |
15 | if (!context.prepared_statements->CreateEntry(context.ActiveTransaction(), name, move(entry), dependencies)) { |
16 | throw Exception("Failed to prepare statement"); |
17 | } |
18 | state->finished = true; |
19 | } |
20 |