From b9c61c7dc1221efb54fa12de8bc9a29f4ad47c3d Mon Sep 17 00:00:00 2001 From: Atul Pratap Singh Date: Fri, 22 Feb 2013 15:08:14 +0530 Subject: [PATCH] Fix bug:3829 Enabling query profiling crashes javascript based navigation --- ChangeLog | 1 + js/sql.js | 13 ++++++++----- sql.php | 6 ++++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 26a7aeb6b5..e0d14daa58 100644 --- a/ChangeLog +++ b/ChangeLog @@ -94,6 +94,7 @@ underscore - rfe #1386 Add IF NOT EXISTS clause when copying database - No longer package .travis.yml configuration file when creating a release. - bug #3830 Can't export custom query because it lowercases table names +- bug #3829 Enabling query profiling crashes javascript based navigation 3.5.8.0 (not yet released) - bug #3828 MariaDB reported as MySQL diff --git a/js/sql.js b/js/sql.js index 0dee205150..b1e5208659 100644 --- a/js/sql.js +++ b/js/sql.js @@ -561,17 +561,20 @@ AJAX.registerOnload('sql.js', function() { */ function makeProfilingChart() { - if ($('#profilingchart').length == 0) { + if ($('#profilingchart').length == 0 + || $('#profilingchart').html().length != 0 + ) { return; } - + var data = []; - $.each(jQuery.parseJSON($('#profilingchart').html()),function(key,value) { + $.each(jQuery.parseJSON($('#profilingChartData').html()),function(key,value) { data.push([key,parseFloat(value)]); }); - // Prevent the user from seeing the JSON code - $('div#profilingchart').html('').show(); + // Remove chart and data divs contents + $('#profilingchart').html('').show(); + $('#profilingChartData').html(''); PMA_createProfilingChartJqplot('profilingchart', data); } diff --git a/sql.php b/sql.php index 2f5717f511..36ed636458 100644 --- a/sql.php +++ b/sql.php @@ -1150,7 +1150,7 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) { echo ''; echo '
' . __('Profiling') . '' . "\n"; @@ -1182,9 +1182,11 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) { echo '' . "\n"; echo ''; //require_once 'libraries/chart.lib.php'; - echo '
' . "\n"; }