Skip to content

Commit 7fdc633

Browse files
InterLinked1Friendly Automation
authored and
Friendly Automation
committed
db: Fix incorrect DB tree count for AMI.
The DBGetTree AMI action's ListItem previously always reported 1, regardless of the count. This is corrected to report the actual count. ASTERISK-30245 #close patches: gettreecount.diff submitted by Birger Harzenetter (license 5870) Change-Id: I46d8992710f1b8524426b1255f57d1ef4a4934d4
1 parent 6d163f7 commit 7fdc633

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

main/db.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,7 @@ static int manager_db_tree_get(struct mansession *s, const struct message *m)
999999
const char *family = astman_get_header(m, "Family");
10001000
const char *key = astman_get_header(m, "Key");
10011001
sqlite3_stmt *stmt = gettree_stmt;
1002+
int count = 0;
10021003

10031004
if (!ast_strlen_zero(family) && !ast_strlen_zero(key)) {
10041005
/* Family and key tree */
@@ -1044,12 +1045,13 @@ static int manager_db_tree_get(struct mansession *s, const struct message *m)
10441045
"%s"
10451046
"\r\n",
10461047
key_s, value_s, idText);
1048+
count++;
10471049
}
10481050

10491051
sqlite3_reset(stmt);
10501052
ast_mutex_unlock(&dblock);
10511053

1052-
astman_send_list_complete_start(s, m, "DBGetTreeComplete", 1);
1054+
astman_send_list_complete_start(s, m, "DBGetTreeComplete", count);
10531055
astman_send_list_complete_end(s);
10541056

10551057
return 0;

0 commit comments

Comments
 (0)