Skip to content

Commit

Permalink
only change what is necessary (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
davecramer authored Aug 6, 2024
1 parent 6970154 commit 5949d81
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 @@ -301,7 +301,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 @@ -482,6 +484,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 @@ -508,7 +511,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 @@ -535,7 +544,7 @@ SC_Destructor(StatementClass *self)

MYLOG(0, "leaving\n");

return TRUE;
return cRet;
}

void
Expand Down

0 comments on commit 5949d81

Please sign in to comment.