You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
proxysql/deps/postgresql/get_result_from_pgconn.patch

41 lines
1.2 KiB

diff --git src/interfaces/libpq/fe-exec.c src/interfaces/libpq/fe-exec.c
index fa9d6aad..cd5cd23d 100644
--- src/interfaces/libpq/fe-exec.c
+++ src/interfaces/libpq/fe-exec.c
@@ -4467,3 +4467,20 @@ PQunescapeBytea(const unsigned char *strtext, size_t *retbuflen)
*retbuflen = buflen;
return tmpbuf;
}
+
+/*
+ * PQgetResultFromPGconn
+ * Get error result from PGconn
+ */
+const PGresult *
+PQgetResultFromPGconn(PGconn *conn)
+{
+ if (!conn)
+ return NULL;
+
+ if (conn->asyncStatus != PGASYNC_IDLE)
+ return NULL;
+
+ return conn->result;
+}
+
diff --git src/interfaces/libpq/libpq-fe.h src/interfaces/libpq/libpq-fe.h
index 7476dbe0..472d0083 100644
--- src/interfaces/libpq/libpq-fe.h
+++ src/interfaces/libpq/libpq-fe.h
@@ -668,6 +668,9 @@ extern PQsslKeyPassHook_OpenSSL_type PQgetSSLKeyPassHook_OpenSSL(void);
extern void PQsetSSLKeyPassHook_OpenSSL(PQsslKeyPassHook_OpenSSL_type hook);
extern int PQdefaultSSLKeyPassHook_OpenSSL(char *buf, int size, PGconn *conn);
+/* Get PGresult directly from PGconn. WARNING: DO NOT RELEASE THIS RESULT */
+extern const PGresult *PQgetResultFromPGconn(PGconn *conn);
+
#ifdef __cplusplus
}
#endif