[Asterisk-code-review] db: Fix incorrect DB tree count for AMI. (asterisk[20])

Friendly Automation asteriskteam at digium.com
Mon Sep 26 14:11:30 CDT 2022


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/19365 )

Change subject: db: Fix incorrect DB tree count for AMI.
......................................................................

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
---
M main/db.c
1 file changed, 20 insertions(+), 1 deletion(-)

Approvals:
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit




diff --git a/main/db.c b/main/db.c
index 2ad430e..a807fdd 100644
--- a/main/db.c
+++ b/main/db.c
@@ -999,6 +999,7 @@
 	const char *family = astman_get_header(m, "Family");
 	const char *key = astman_get_header(m, "Key");
 	sqlite3_stmt *stmt = gettree_stmt;
+	int count = 0;
 
 	if (!ast_strlen_zero(family) && !ast_strlen_zero(key)) {
 		/* Family and key tree */
@@ -1044,12 +1045,13 @@
 			"%s"
 			"\r\n",
 			key_s, value_s, idText);
+		count++;
 	}
 
 	sqlite3_reset(stmt);
 	ast_mutex_unlock(&dblock);
 
-	astman_send_list_complete_start(s, m, "DBGetTreeComplete", 1);
+	astman_send_list_complete_start(s, m, "DBGetTreeComplete", count);
 	astman_send_list_complete_end(s);
 
 	return 0;

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/19365
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 20
Gerrit-Change-Id: I46d8992710f1b8524426b1255f57d1ef4a4934d4
Gerrit-Change-Number: 19365
Gerrit-PatchSet: 2
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220926/012e1d02/attachment.html>


More information about the asterisk-code-review mailing list