Skip to content

Commit

Permalink
Remove ParamListInfo argument from functions
Browse files Browse the repository at this point in the history
  • Loading branch information
mkaruza committed Oct 4, 2024
1 parent 9771592 commit e0b0b14
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions include/pgduckdb/pgduckdb_planner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ extern "C" {

extern bool duckdb_explain_analyze;

PlannedStmt *DuckdbPlanNode(Query *parse, int cursor_options, ParamListInfo bound_params);
PlannedStmt *DuckdbPlanNode(Query *parse, int cursor_options);
std::tuple<duckdb::unique_ptr<duckdb::PreparedStatement>, duckdb::unique_ptr<duckdb::Connection>>
DuckdbPrepare(const Query *query, ParamListInfo bound_params);
DuckdbPrepare(const Query *query);
4 changes: 2 additions & 2 deletions src/pgduckdb_hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ static PlannedStmt *
DuckdbPlannerHook(Query *parse, const char *query_string, int cursor_options, ParamListInfo bound_params) {
if (pgduckdb::IsExtensionRegistered()) {
if (duckdb_execution && IsAllowedStatement(parse)) {
PlannedStmt *duckdbPlan = DuckdbPlanNode(parse, cursor_options, bound_params);
PlannedStmt *duckdbPlan = DuckdbPlanNode(parse, cursor_options);
if (duckdbPlan) {
return duckdbPlan;
}
Expand All @@ -129,7 +129,7 @@ DuckdbPlannerHook(Query *parse, const char *query_string, int cursor_options, Pa
if (!IsAllowedStatement(parse)) {
elog(ERROR, "(PGDuckDB/DuckdbPlannerHook) Only SELECT statements involving DuckDB are supported.");
}
PlannedStmt *duckdbPlan = DuckdbPlanNode(parse, cursor_options, bound_params);
PlannedStmt *duckdbPlan = DuckdbPlanNode(parse, cursor_options);
if (duckdbPlan) {
return duckdbPlan;
}
Expand Down
2 changes: 1 addition & 1 deletion src/pgduckdb_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Duckdb_CreateCustomScanState(CustomScan *cscan) {
void
Duckdb_BeginCustomScan(CustomScanState *cscanstate, EState *estate, int eflags) {
DuckdbScanState *duckdb_scan_state = (DuckdbScanState *)cscanstate;
auto prepare_result = DuckdbPrepare(duckdb_scan_state->query, estate->es_param_list_info);
auto prepare_result = DuckdbPrepare(duckdb_scan_state->query);
auto prepared_query = std::move(std::get<0>(prepare_result));
auto duckdb_connection = std::move(std::get<1>(prepare_result));

Expand Down
10 changes: 5 additions & 5 deletions src/pgduckdb_planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ extern "C" {
bool duckdb_explain_analyze = false;

std::tuple<duckdb::unique_ptr<duckdb::PreparedStatement>, duckdb::unique_ptr<duckdb::Connection>>
DuckdbPrepare(const Query *query, ParamListInfo bound_params) {
DuckdbPrepare(const Query *query) {

Query *copied_query = (Query *)copyObjectImpl(query);
/*
Expand Down Expand Up @@ -61,11 +61,11 @@ DuckdbPrepare(const Query *query, ParamListInfo bound_params) {
}

static Plan *
CreatePlan(Query *query, ParamListInfo bound_params) {
CreatePlan(Query *query) {
/*
* Prepare the query, se we can get the returned types and column names.
*/
auto prepare_result = DuckdbPrepare(query, bound_params);
auto prepare_result = DuckdbPrepare(query);
auto prepared_query = std::move(std::get<0>(prepare_result));

if (prepared_query->HasError()) {
Expand Down Expand Up @@ -114,9 +114,9 @@ CreatePlan(Query *query, ParamListInfo bound_params) {
}

PlannedStmt *
DuckdbPlanNode(Query *parse, int cursor_options, ParamListInfo bound_params) {
DuckdbPlanNode(Query *parse, int cursor_options) {
/* We need to check can we DuckDB create plan */
Plan *duckdb_plan = (Plan *)castNode(CustomScan, CreatePlan(parse, bound_params));
Plan *duckdb_plan = (Plan *)castNode(CustomScan, CreatePlan(parse));

if (!duckdb_plan) {
return nullptr;
Expand Down

0 comments on commit e0b0b14

Please sign in to comment.