FS-6910 #resolve Multiple entry with the same first, last name or extension in the directory would only return 1 entry. Fix issue where group by would produce multiple row of count(*) result. Using distinct instead wouldn't solve the issue in SQLITE because of a bug, so solution is to use a subselect.
This commit is contained in:
parent
59352005d0
commit
2ca349a3f8
|
@ -873,7 +873,7 @@ switch_status_t navigate_entrys(switch_core_session_t *session, dir_profile_t *p
|
||||||
globals.hostname, switch_core_session_get_uuid(session), (params->search_by == SEARCH_BY_LAST_NAME ? "last_name_digit" : "first_name_digit"), params->digits);
|
globals.hostname, switch_core_session_get_uuid(session), (params->search_by == SEARCH_BY_LAST_NAME ? "last_name_digit" : "first_name_digit"), params->digits);
|
||||||
}
|
}
|
||||||
|
|
||||||
sql = switch_mprintf("select count(*) from directory_search where %s group by last_name, first_name, extension", sql_where);
|
sql = switch_mprintf("select count(*) from (select distinct first_name, last_name, extension from directory_search where %s) AS dsearch", sql_where);
|
||||||
|
|
||||||
directory_execute_sql_callback(globals.mutex, sql, sql2str_callback, &cbt);
|
directory_execute_sql_callback(globals.mutex, sql, sql2str_callback, &cbt);
|
||||||
switch_safe_free(sql);
|
switch_safe_free(sql);
|
||||||
|
|
Loading…
Reference in New Issue