[sr-dev] git:master:127beb37: sqlops: exported sql_query_async() to kemi framework

Daniel-Constantin Mierla miconda at gmail.com
Sun Apr 1 10:51:50 CEST 2018


Module: kamailio
Branch: master
Commit: 127beb37ff647bc721407b9fa1d5cd61c20dd17d
URL: https://github.com/kamailio/kamailio/commit/127beb37ff647bc721407b9fa1d5cd61c20dd17d

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-03-31T13:09:25+02:00

sqlops: exported sql_query_async() to kemi framework

---

Modified: src/modules/sqlops/sqlops.c

---

Diff:  https://github.com/kamailio/kamailio/commit/127beb37ff647bc721407b9fa1d5cd61c20dd17d.diff
Patch: https://github.com/kamailio/kamailio/commit/127beb37ff647bc721407b9fa1d5cd61c20dd17d.patch

---

diff --git a/src/modules/sqlops/sqlops.c b/src/modules/sqlops/sqlops.c
index dbad0c78c3..d2d20cc7df 100644
--- a/src/modules/sqlops/sqlops.c
+++ b/src/modules/sqlops/sqlops.c
@@ -452,6 +452,24 @@ static int ki_sqlops_query(sip_msg_t *msg, str *scon, str *squery, str *sres)
 	return sqlops_do_query(scon, squery, sres);
 }
 
+static int ki_sqlops_query_async(sip_msg_t *msg, str *scon, str *squery)
+{
+	sql_con_t *con = NULL;
+
+	if (scon == NULL || scon->s == NULL || scon->len<=0) {
+		LM_ERR("invalid connection name\n");
+		return -1;
+	}
+
+	con = sql_get_connection(scon);
+	if(con==NULL) {
+		LM_ERR("invalid connection [%.*s]\n", scon->len, scon->s);
+		return -1;
+	}
+
+	return sql_do_query_async(con, squery);
+}
+
 static int ki_sqlops_reset_result(sip_msg_t *msg, str *sres)
 {
 	sqlops_reset_result(sres);
@@ -508,6 +526,11 @@ static sr_kemi_t sr_kemi_sqlops_exports[] = {
 		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR,
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
 	},
+	{ str_init("sqlops"), str_init("sql_query_async"),
+		SR_KEMIP_INT, ki_sqlops_query_async,
+		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+	},
 
 	{ {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }
 };




More information about the sr-dev mailing list