Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

during call SQLFreeHandle, if the connection is broken the client is not notified #12

Merged
Merged
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
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