Browse code

db_redis: allow deletion of all rows

rdboisvert authored on 19/11/2019 21:05:34 • Henning Westerholt committed on 20/11/2019 19:20:10
Showing 1 changed files
... ...
@@ -1325,6 +1325,12 @@ static int db_redis_perform_delete(const db1_con_t* _h, km_redis_con_t *con, con
1325 1325
         if (tmp)
1326 1326
             db_redis_key_free(&tmp);
1327 1327
 
1328
+        // skip if delete all rows
1329
+        if (!*manual_keys_count) {
1330
+          db_redis_key_free (&query_v);
1331
+          goto skipkeys;
1332
+        }
1333
+
1328 1334
         if (db_redis_key_prepend_string(&query_v, "HMGET", 5) != 0) {
1329 1335
             LM_ERR("Failed to set hmget command to pre-delete query\n");
1330 1336
             goto error;
... ...
@@ -1416,6 +1422,7 @@ static int db_redis_perform_delete(const db1_con_t* _h, km_redis_con_t *con, con
1416 1422
         db_vals = NULL;
1417 1423
         db_redis_free_reply(&reply);
1418 1424
 
1425
+      skipkeys:
1419 1426
         if (db_redis_key_add_string(&query_v, "DEL", 3) != 0) {
1420 1427
             LM_ERR("Failed to add del command to delete query\n");
1421 1428
             goto error;