aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/odbc/execute.c
diff options
context:
space:
mode:
authorHiroshi Inoue <inoue@tpf.co.jp>2002-04-02 10:50:50 +0000
committerHiroshi Inoue <inoue@tpf.co.jp>2002-04-02 10:50:50 +0000
commitf8da3990b5437e47b7296a6770a3efd215b326d0 (patch)
tree38b031307f4048be70099ad6daf4c8a901c7a177 /src/interfaces/odbc/execute.c
parentc26a44db08677bccc04426b42973bb372e6e3046 (diff)
downloadpostgresql-f8da3990b5437e47b7296a6770a3efd215b326d0.tar.gz
postgresql-f8da3990b5437e47b7296a6770a3efd215b326d0.zip
[HACKERS] Proposed patch for ODBC driver w/ C-a-n-c-e-l
From: Bradley McLean <brad@bradm.net> Patch against 7,2 submitted for comment. This seems to work just fine; Now, when our users submit a 2 hour query with four million row sorts by accident, then cancel it 30 seconds later, it doesn't bog down the server ...
Diffstat (limited to 'src/interfaces/odbc/execute.c')
-rw-r--r--src/interfaces/odbc/execute.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/interfaces/odbc/execute.c b/src/interfaces/odbc/execute.c
index 11893321f84..14ed086e83a 100644
--- a/src/interfaces/odbc/execute.c
+++ b/src/interfaces/odbc/execute.c
@@ -573,6 +573,7 @@ PGAPI_Cancel(
{
static char *func = "PGAPI_Cancel";
StatementClass *stmt = (StatementClass *) hstmt;
+ ConnectionClass *conn;
RETCODE result;
ConnInfo *ci;
@@ -589,7 +590,8 @@ PGAPI_Cancel(
SC_log_error(func, "", NULL);
return SQL_INVALID_HANDLE;
}
- ci = &(SC_get_conn(stmt)->connInfo);
+ conn = SC_get_conn(stmt);
+ ci = &(conn->connInfo);
/*
* Not in the middle of SQLParamData/SQLPutData so cancel like a
@@ -598,6 +600,11 @@ PGAPI_Cancel(
if (stmt->data_at_exec < 0)
{
/*
+ * Tell the Backend that we're cancelling this request
+ */
+ if (stmt->status == STMT_EXECUTING)
+ CC_send_cancel_request(conn);
+ /*
* MAJOR HACK for Windows to reset the driver manager's cursor
* state: Because of what seems like a bug in the Odbc driver
* manager, SQLCancel does not act like a SQLFreeStmt(CLOSE), as