diff options
author | qwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-09-10 17:39:08 +0000 |
---|---|---|
committer | qwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-09-10 17:39:08 +0000 |
commit | afbade65d7a4dfc4134de958c76b9c8b02eb24af (patch) | |
tree | 7bea51d8cd185e0037ec75cc305c830ef07b8366 /main/db.c | |
parent | 32f5cd52026752f476547a46590f522415c4decc (diff) |
Add a counter to the 'database deltree' CLI command.
Note: this is slightly different than the initial patch, because I felt
that using res <= 0 would be a change in behavior.
Closes issue #10687, patch by junky
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@82154 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/db.c')
-rw-r--r-- | main/db.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -104,6 +104,7 @@ int ast_db_deltree(const char *family, const char *keytree) char *keys; int res; int pass; + int counter = 0; if (family) { if (keytree) { @@ -135,11 +136,12 @@ int ast_db_deltree(const char *family, const char *keytree) } if (keymatch(keys, prefix)) { astdb->del(astdb, &key, 0); + counter++; } } astdb->sync(astdb, 0); ast_mutex_unlock(&dblock); - return 0; + return counter; } int ast_db_put(const char *family, const char *keys, const char *value) @@ -291,10 +293,10 @@ static int database_deltree(int fd, int argc, char *argv[]) } else { res = ast_db_deltree(argv[2], NULL); } - if (res) { + if (res < 0) { ast_cli(fd, "Database entries do not exist.\n"); } else { - ast_cli(fd, "Database entries removed.\n"); + ast_cli(fd, "%d database entries removed.\n",res); } return RESULT_SUCCESS; } @@ -629,7 +631,7 @@ static int manager_dbdeltree(struct mansession *s, const struct message *m) else res = ast_db_deltree(family, NULL); - if (res) + if (res < 0) astman_send_error(s, m, "Database entry not found"); else astman_send_ack(s, m, "Key tree deleted successfully"); |