From ba7ee9bfc97aa11f4c72e5f64891f51412553570 Mon Sep 17 00:00:00 2001 From: "Michael L. Young" Date: Tue, 12 Mar 2013 21:19:39 +0000 Subject: Fix Sorting Order For Parking Lots Stored In Static Realtime When retrieving the parking lots from a MySQL database table, the current order is "filename, cat_metric desc, var_metric asc, category". If there are multiple parking lots with the same cat_metric but different categories, everything is being sorted on cat_metric first resulting in errors when loading the parking lots. This patch fixes the problem by sorting on the category field first, then the cat_metric field. (closes issue ASTERISK-21035) Reported by: Alex Epshteyn Patches: asterisk-21035-orderby.diff Michael L. Young (license 5026) ........ Merged revisions 382942 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 382943 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382954 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- addons/res_config_mysql.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons') diff --git a/addons/res_config_mysql.c b/addons/res_config_mysql.c index 7b1f058ec..71f21db46 100644 --- a/addons/res_config_mysql.c +++ b/addons/res_config_mysql.c @@ -937,7 +937,7 @@ static struct ast_config *config_mysql(const char *database, const char *table, return NULL; } - ast_str_set(&sql, 0, "SELECT category, var_name, var_val, cat_metric FROM %s WHERE filename='%s' and commented=0 ORDER BY filename, cat_metric desc, var_metric asc, category, var_name, var_val, id", table, file); + ast_str_set(&sql, 0, "SELECT category, var_name, var_val, cat_metric FROM %s WHERE filename='%s' and commented=0 ORDER BY filename, category, cat_metric desc, var_metric asc, var_name, var_val, id", table, file); ast_debug(1, "MySQL RealTime: Static SQL: %s\n", ast_str_buffer(sql)); -- cgit v1.2.3