cache MySQL profiling support information

This commit is contained in:
Sebastian Mendel
2008-01-21 11:51:53 +00:00
parent 32ba2d44bf
commit 4a3a83e40c

View File

@@ -1200,22 +1200,33 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice')
/** /**
* Verifies if current MySQL server supports profiling * Verifies if current MySQL server supports profiling
* *
* @uses $_SESSION['profiling_supported'] for caching
* @uses PMA_DBI_fetch_value()
* @uses PMA_MYSQL_INT_VERSION
* @uses defined()
* @access public * @access public
* @return boolean whether profiling is supported * @return boolean whether profiling is supported
* *
* @author Marc Delisle * @author Marc Delisle
*/ */
function PMA_profilingSupported() { function PMA_profilingSupported()
{
if (! isset($_SESSION['profiling_supported'])) {
// 5.0.37 has profiling but for example, 5.1.20 does not // 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) // (avoid a trip to the server for MySQL before 5.0.37)
// and do not set a constant as we might be switching servers // and do not set a constant as we might be switching servers
if (defined('PMA_MYSQL_INT_VERSION') && PMA_MYSQL_INT_VERSION >= 50037 && PMA_DBI_fetch_value("SHOW VARIABLES LIKE 'profiling'")) { if (defined('PMA_MYSQL_INT_VERSION')
return true; && PMA_MYSQL_INT_VERSION >= 50037
&& PMA_DBI_fetch_value("SHOW VARIABLES LIKE 'profiling'")) {
$_SESSION['profiling_supported'] = true;
} else { } else {
return false; $_SESSION['profiling_supported'] = false;
} }
} }
return $_SESSION['profiling_supported'];
}
/** /**
* Displays a form with the Profiling checkbox * Displays a form with the Profiling checkbox
* *
@@ -1224,7 +1235,8 @@ function PMA_profilingSupported() {
* *
* @author Marc Delisle * @author Marc Delisle
*/ */
function PMA_profilingCheckbox($sql_query) { function PMA_profilingCheckbox($sql_query)
{
if (PMA_profilingSupported()) { if (PMA_profilingSupported()) {
echo '<form action="sql.php" method="post">' . "\n"; echo '<form action="sql.php" method="post">' . "\n";
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']);
@@ -1244,7 +1256,8 @@ function PMA_profilingCheckbox($sql_query) {
* *
* @author Marc Delisle * @author Marc Delisle
*/ */
function PMA_profilingResults($profiling_results) { function PMA_profilingResults($profiling_results)
{
echo '<fieldset><legend>' . $GLOBALS['strProfiling'] . '</legend>' . "\n"; echo '<fieldset><legend>' . $GLOBALS['strProfiling'] . '</legend>' . "\n";
echo '<table>' . "\n"; echo '<table>' . "\n";
echo ' <tr>' . "\n"; echo ' <tr>' . "\n";