summaryrefslogtreecommitdiff
path: root/src/interfaces/odbc/connection.h
diff options
context:
space:
mode:
authorHiroshi Inoue2002-04-02 10:50:50 +0000
committerHiroshi Inoue2002-04-02 10:50:50 +0000
commitf8da3990b5437e47b7296a6770a3efd215b326d0 (patch)
tree38b031307f4048be70099ad6daf4c8a901c7a177 /src/interfaces/odbc/connection.h
parentc26a44db08677bccc04426b42973bb372e6e3046 (diff)
[HACKERS] Proposed patch for ODBC driver w/ C-a-n-c-e-l
From: Bradley McLean <[email protected]> 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/connection.h')
-rw-r--r--src/interfaces/odbc/connection.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/interfaces/odbc/connection.h b/src/interfaces/odbc/connection.h
index 5d01dacd214..849350d14d1 100644
--- a/src/interfaces/odbc/connection.h
+++ b/src/interfaces/odbc/connection.h
@@ -126,6 +126,21 @@ typedef struct _StartupPacket6_2
char tty[PATH_SIZE];
} StartupPacket6_2;
+/* Transferred from pqcomm.h: */
+
+
+typedef ProtocolVersion MsgType;
+
+#define PG_PROTOCOL(m,n) (((m) << 16) | (n))
+#define CANCEL_REQUEST_CODE PG_PROTOCOL(1234,5678)
+
+typedef struct CancelRequestPacket
+{
+ /* Note that each field is stored in network byte order! */
+ MsgType cancelRequestCode; /* code to identify a cancel request */
+ unsigned int backendPID; /* PID of client's backend */
+ unsigned int cancelAuthCode; /* secret key to authorize cancel */
+} CancelRequestPacket;
/* Structure to hold all the connection attributes for a specific
connection (used for both registry and file, DSN and DRIVER)
@@ -273,11 +288,14 @@ struct ConnectionClass_
char ms_jet;
char unicode;
char result_uncommitted;
+ char schema_support;
#ifdef MULTIBYTE
char *client_encoding;
char *server_encoding;
#endif /* MULTIBYTE */
int ccsc;
+ int be_pid; /* pid returned by backend */
+ int be_key; /* auth code needed to send cancel */
};
@@ -319,6 +337,7 @@ void CC_lookup_pg_version(ConnectionClass *conn);
void CC_initialize_pg_version(ConnectionClass *conn);
void CC_log_error(const char *func, const char *desc, const ConnectionClass *self);
int CC_get_max_query_len(const ConnectionClass *self);
+int CC_send_cancel_request(const ConnectionClass *conn);
void CC_on_commit(ConnectionClass *conn);
void CC_on_abort(ConnectionClass *conn, BOOL set_no_trans);
void ProcessRollback(ConnectionClass *conn, BOOL undo);