Skip to content

Commit

Permalink
db_redis: allow deletion of all rows
Browse files Browse the repository at this point in the history
(cherry picked from commit bf2ecd4)
  • Loading branch information
rdboisvert authored and henningw committed Nov 20, 2019
1 parent ec04243 commit cd955a2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/modules/db_redis/redis_dbase.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit cd955a2

Please sign in to comment.