bug #1824506 [profiling] Profile command repeated on older MySQL servers

This commit is contained in:
Marc Delisle
2007-11-02 17:34:58 +00:00
parent 1410002c86
commit a4be8e0efd
4 changed files with 26 additions and 9 deletions

View File

@@ -20,6 +20,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
- patch #1821154, HTTP authentication: fix auth working with php/mod_fastcgi,
thanks to yarodin
- wrong default charset in case of broken session
- bug #1824506 [profiling] Profile command repeated on older MySQL servers
2.11.2.0 (2007-10-27)
- patch #1791576 HTTP auth: support REDIRECT_REMOTE_USER, thanks to Allard

View File

@@ -906,11 +906,11 @@ if (! defined('PMA_MINIMUM_COMMON')) {
* (note: when $cfg['ServerDefault'] = 0, constant is not defined)
*/
if (defined('PMA_MYSQL_INT_VERSION') && PMA_MYSQL_INT_VERSION >= 50037 && isset($_REQUEST['profiling'])) {
$_SESSION['profiling'] = true;
if (PMA_profilingSupported() && isset($_REQUEST['profiling'])) {
$_SESSION['profiling'] = true;
} elseif (isset($_REQUEST['profiling_form'])) {
// the checkbox was unchecked
unset($_SESSION['profiling']);
// the checkbox was unchecked
unset($_SESSION['profiling']);
}
} // end if !defined('PMA_MINIMUM_COMMON')

View File

@@ -1223,6 +1223,24 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice')
echo '</div><br />' . "\n";
} // end of the 'PMA_showMessage()' function
/**
* Verifies if current MySQL server supports profiling
*
* @access public
* @return boolean whether profiling is supported
*
* @author Marc Delisle
*/
function PMA_profilingSupported() {
// 5.0.37 has profiling but for example, 5.1.20 does not
// (avoid a trip to the server for MySQL before 5.0.37)
// and do not set a constant as we might be switching servers
if (PMA_MYSQL_INT_VERSION >= 50037 && PMA_DBI_fetch_value("SHOW VARIABLES LIKE 'profiling'")) {
return true;
} else {
return false;
}
}
/**
* Displays a form with the Profiling checkbox
@@ -1233,9 +1251,7 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice')
* @author Marc Delisle
*/
function PMA_profilingCheckbox($sql_query) {
// 5.0.37 has profiling but for example, 5.1.20 does not
// (avoid doing a fetch_value for MySQL before 5.0.37)
if (PMA_MYSQL_INT_VERSION >= 50037 && PMA_DBI_fetch_value("SHOW VARIABLES LIKE 'profiling'")) {
if (PMA_profilingSupported()) {
echo '<form action="sql.php" method="post">' . "\n";
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']);
echo '<input type="hidden" name="sql_query" value="' . $sql_query . '" />' . "\n";

View File

@@ -290,7 +290,7 @@ if (isset($GLOBALS['show_as_php']) || !empty($GLOBALS['validatequery'])) {
unset($result);
$num_rows = 0;
} else {
if (isset($_SESSION['profiling'])) {
if (isset($_SESSION['profiling']) && PMA_profilingSupported()) {
PMA_DBI_query('SET PROFILING=1;');
}
@@ -335,7 +335,7 @@ if (isset($GLOBALS['show_as_php']) || !empty($GLOBALS['validatequery'])) {
}
// Grabs the profiling results
if (isset($_SESSION['profiling'])) {
if (isset($_SESSION['profiling']) && PMA_profilingSupported()) {
$profiling_results = PMA_DBI_fetch_result('SHOW PROFILE;');
}