Module: kamailio
Branch: 5.2
Commit: cd955a22ddceab2356a8bf6ca37b57704baec097
URL:
https://github.com/kamailio/kamailio/commit/cd955a22ddceab2356a8bf6ca37b577…
Author: rdboisvert <rdbprog(a)gmail.com>
Committer: Henning Westerholt <hw(a)skalatan.de>
Date: 2019-11-20T20:20:49+01:00
db_redis: allow deletion of all rows
(cherry picked from commit bf2ecd4dec55d5009e0904392d083e17af91977d)
---
Modified: src/modules/db_redis/redis_dbase.c
---
Diff:
https://github.com/kamailio/kamailio/commit/cd955a22ddceab2356a8bf6ca37b577…
Patch:
https://github.com/kamailio/kamailio/commit/cd955a22ddceab2356a8bf6ca37b577…
---
diff --git a/src/modules/db_redis/redis_dbase.c b/src/modules/db_redis/redis_dbase.c
index c4cd696ead..97fd19ee01 100644
--- a/src/modules/db_redis/redis_dbase.c
+++ b/src/modules/db_redis/redis_dbase.c
@@ -1325,6 +1325,12 @@ static int db_redis_perform_delete(const db1_con_t* _h,
km_redis_con_t *con, con
if (tmp)
db_redis_key_free(&tmp);
+ // skip if delete all rows
+ if (!*manual_keys_count) {
+ db_redis_key_free (&query_v);
+ goto skipkeys;
+ }
+
if (db_redis_key_prepend_string(&query_v, "HMGET", 5) != 0) {
LM_ERR("Failed to set hmget command to pre-delete query\n");
goto error;
@@ -1416,6 +1422,7 @@ static int db_redis_perform_delete(const db1_con_t* _h,
km_redis_con_t *con, con
db_vals = NULL;
db_redis_free_reply(&reply);
+ skipkeys:
if (db_redis_key_add_string(&query_v, "DEL", 3) != 0) {
LM_ERR("Failed to add del command to delete query\n");
goto error;