From: Michael L. Young Date: Tue, 12 Mar 2013 21:19:39 +0000 (+0000) Subject: Fix Sorting Order For Parking Lots Stored In Static Realtime X-Git-Tag: 13.0.0-beta1~2016 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba7ee9bfc97aa11f4c72e5f64891f51412553570;p=thirdparty%2Fasterisk.git 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 --- diff --git a/addons/res_config_mysql.c b/addons/res_config_mysql.c index 7b1f058ec5..71f21db468 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));