[sr-dev] git:5.3:159e32c2: db_redis: allow deletion of all rows

Henning Westerholt hw at skalatan.de
Wed Nov 20 20:21:22 CET 2019


Module: kamailio
Branch: 5.3
Commit: 159e32c2c2cc3f2c5c3c226be3406bd91ca9a052
URL: https://github.com/kamailio/kamailio/commit/159e32c2c2cc3f2c5c3c226be3406bd91ca9a052

Author: rdboisvert <rdbprog at gmail.com>
Committer: Henning Westerholt <hw at skalatan.de>
Date: 2019-11-20T20:21:10+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/159e32c2c2cc3f2c5c3c226be3406bd91ca9a052.diff
Patch: https://github.com/kamailio/kamailio/commit/159e32c2c2cc3f2c5c3c226be3406bd91ca9a052.patch

---

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;




More information about the sr-dev mailing list