Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions ext/pdo_pgsql/pgsql_statement.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ static void pgsql_stmt_finish(pdo_pgsql_stmt *S, int fin_mode)

S->is_prepared = false;
}

if ((fin_mode & (FIN_CLOSE|FIN_ABORT)) && H->running_stmt == S) {
H->running_stmt = NULL;
}
}

static int pgsql_stmt_dtor(pdo_stmt_t *stmt)
Expand All @@ -204,10 +208,6 @@ static int pgsql_stmt_dtor(pdo_stmt_t *stmt)

pgsql_stmt_finish(S, FIN_DISCARD|(server_obj_usable ? FIN_CLOSE|FIN_ABORT : 0));

if (server_obj_usable && S->H->running_stmt == S) {
S->H->running_stmt = NULL;
}

if (S->stmt_name) {
efree(S->stmt_name);
S->stmt_name = NULL;
Expand Down Expand Up @@ -273,7 +273,6 @@ static int pgsql_stmt_execute(pdo_stmt_t *stmt)
* (maybe it will change with pipeline mode in libpq 14?) */
if (S->is_unbuffered && H->running_stmt) {
pgsql_stmt_finish(H->running_stmt, FIN_CLOSE);
H->running_stmt = NULL;
}
/* ensure that we free any previous unfetched results */
pgsql_stmt_finish(S, 0);
Expand Down
Loading