kamailio/debian/patches/upstream/db_postgres-handle-SSL-and-...

44 lines
1.4 KiB

From: S-P Chan <shihping.chan@gmail.com>
Date: Tue, 6 Feb 2024 00:29:55 +0800
Subject: db_postgres: handle SSL and submit query
(cherry-pick from d638c774ed816eec800e72ba2546004215cfe097)
---
src/modules/db_postgres/km_dbase.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/modules/db_postgres/km_dbase.c b/src/modules/db_postgres/km_dbase.c
index 3d58f1a..7948ff0 100644
--- a/src/modules/db_postgres/km_dbase.c
+++ b/src/modules/db_postgres/km_dbase.c
@@ -44,6 +44,7 @@
#include "../../core/hashes.h"
#include "../../core/clist.h"
#define KSR_RTHREAD_NEED_PI
+#define KSR_RTHREAD_NEED_4PP
#include "../../core/rthreads.h"
#include "km_dbase.h"
#include "km_pg_con.h"
@@ -158,7 +159,7 @@ void db_postgres_close(db1_con_t *_h)
* \param _s query string
* \return 0 on success, negative on failure
*/
-static int db_postgres_submit_query(const db1_con_t *_con, const str *_s)
+static int db_postgres_submit_query_impl(const db1_con_t *_con, const str *_s)
{
char *s = NULL;
int i, retries;
@@ -286,6 +287,12 @@ static int db_postgres_submit_query(const db1_con_t *_con, const str *_s)
return -1;
}
+static int db_postgres_submit_query(const db1_con_t *_con, const str *_s)
+{
+ return run_thread4PP((_thread_proto4PP)db_postgres_submit_query_impl,
+ (void *)_con, (void *)_s);
+}
+
void db_postgres_async_exec_task(void *param)
{
str *p;