Skip to content

Commit

Permalink
only change what is necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
davecramer committed May 10, 2024
1 parent 03dec03 commit eb488fb
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions statement.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,9 @@ PGAPI_FreeStmt(HSTMT hstmt,
if (stmt->execute_parent)
stmt->execute_parent->execute_delegate = NULL;
/* Destroy the statement and free any results, cursors, etc. */
SC_Destructor(stmt);
/* if the connection was already closed return error */
if (SC_Destructor(stmt) == FALSE)
return SQL_ERROR;
}
else if (fOption == SQL_UNBIND)
SC_unbind_cols(stmt);
Expand Down Expand Up @@ -477,6 +479,7 @@ SC_Constructor(ConnectionClass *conn)
char
SC_Destructor(StatementClass *self)
{
char cRet = TRUE;
CSTR func = "SC_Destructor";
QResultClass *res = SC_get_Result(self);

Expand All @@ -498,7 +501,13 @@ SC_Destructor(StatementClass *self)

SC_initialize_stmts(self, TRUE);

/* Free the parsed table information */
if(self->hdbc && !self->hdbc->pqconn)
{
SC_set_error(self, STMT_COMMUNICATION_ERROR, "connection error.", func);
cRet = FALSE;
}

/* Free the parsed table information */
SC_initialize_cols_info(self, FALSE, TRUE);

NULL_THE_NAME(self->cursor_name);
Expand All @@ -525,7 +534,7 @@ SC_Destructor(StatementClass *self)

MYLOG(0, "leaving\n");

return TRUE;
return cRet;
}

void
Expand Down

0 comments on commit eb488fb

Please sign in to comment.