mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 18:55:19 +00:00 
			
		
		
		
	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
This commit is contained in:
		
				
					committed by
					
						 Friendly Automation
						Friendly Automation
					
				
			
			
				
	
			
			
			
						parent
						
							0a0b141278
						
					
				
				
					commit
					aefb9fc216
				
			| @@ -999,6 +999,7 @@ static int manager_db_tree_get(struct mansession *s, const struct message *m) | |||||||
| 	const char *family = astman_get_header(m, "Family"); | 	const char *family = astman_get_header(m, "Family"); | ||||||
| 	const char *key = astman_get_header(m, "Key"); | 	const char *key = astman_get_header(m, "Key"); | ||||||
| 	sqlite3_stmt *stmt = gettree_stmt; | 	sqlite3_stmt *stmt = gettree_stmt; | ||||||
|  | 	int count = 0; | ||||||
|  |  | ||||||
| 	if (!ast_strlen_zero(family) && !ast_strlen_zero(key)) { | 	if (!ast_strlen_zero(family) && !ast_strlen_zero(key)) { | ||||||
| 		/* Family and key tree */ | 		/* Family and key tree */ | ||||||
| @@ -1044,12 +1045,13 @@ static int manager_db_tree_get(struct mansession *s, const struct message *m) | |||||||
| 			"%s" | 			"%s" | ||||||
| 			"\r\n", | 			"\r\n", | ||||||
| 			key_s, value_s, idText); | 			key_s, value_s, idText); | ||||||
|  | 		count++; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	sqlite3_reset(stmt); | 	sqlite3_reset(stmt); | ||||||
| 	ast_mutex_unlock(&dblock); | 	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); | 	astman_send_list_complete_end(s); | ||||||
|  |  | ||||||
| 	return 0; | 	return 0; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user