Merge remote-tracking branch 'origin/master'

This commit is contained in:
Pootle server 2011-08-19 10:40:08 +02:00
commit b79e4483ab
9 changed files with 259 additions and 255 deletions

View File

@ -128,8 +128,7 @@ if (isset($_REQUEST['submit_search'])) {
$sqlstr_delete = 'DELETE';
// Fields to select
$tblfields = PMA_DBI_fetch_result('SHOW FIELDS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($GLOBALS['db']),
null, 'Field');
$tblfields = PMA_DBI_get_columns($GLOBALS['db'], $table);
// Table to use
$sqlstr_from = ' FROM ' . PMA_backquote($GLOBALS['db']) . '.' . PMA_backquote($table);
@ -148,8 +147,8 @@ if (isset($_REQUEST['submit_search'])) {
$thefieldlikevalue = array();
foreach ($tblfields as $tblfield) {
if (! isset($field) || strlen($field) == 0 || $tblfield == $field) {
$thefieldlikevalue[] = 'CONVERT(' . PMA_backquote($tblfield) . ' USING utf8)'
if (! isset($field) || strlen($field) == 0 || $tblfield['Field'] == $field) {
$thefieldlikevalue[] = 'CONVERT(' . PMA_backquote($tblfield['Field']) . ' USING utf8)'
. ' ' . $like_or_regex . ' '
. "'" . $automatic_wildcard
. $search_word

View File

@ -298,21 +298,14 @@ function PMA_replication_synchronize_db($db, $src_link, $trg_link, $data = true)
{
$src_db = $trg_db = $db;
$src_connection = PMA_DBI_select_db($src_db, $src_link);
$trg_connection = PMA_DBI_select_db($trg_db, $trg_link);
$src_tables = PMA_DBI_get_tables($src_db, $src_link);
$source_tables_num = sizeof($src_tables);
$trg_tables = PMA_DBI_get_tables($trg_db, $trg_link);
$target_tables_num = sizeof($trg_tables);
/**
* initializing arrays to save table names
*/
$unmatched_num_src = 0;
$source_tables_uncommon = array();
$unmatched_num_trg = 0;
$target_tables_uncommon = array();
$matching_tables = array();
$matching_tables_num = 0;
@ -367,6 +360,7 @@ function PMA_replication_synchronize_db($db, $src_link, $trg_link, $data = true)
$source_indexes = array();
$target_indexes = array();
$add_indexes_array = array();
$alter_indexes_array = array();
$remove_indexes_array = array();
$criteria = array('Field', 'Type', 'Null', 'Collation', 'Key', 'Default', 'Comment');
@ -378,17 +372,11 @@ function PMA_replication_synchronize_db($db, $src_link, $trg_link, $data = true)
$add_indexes_array, $alter_indexes_array,$remove_indexes_array, $counter);
}
$matching_table_data_diff = array();
$matching_table_structure_diff = array();
$uncommon_table_structure_diff = array();
$uncommon_table_data_diff = array();
$uncommon_tables = $source_tables_uncommon;
/**
* Generating Create Table query for all the non-matching tables present in Source but not in Target and populating tables.
*/
for ($q = 0; $q < sizeof($source_tables_uncommon); $q++) {
if (isset($uncommon_tables[$q])) {
if (isset($source_tables_uncommon[$q])) {
PMA_createTargetTables($src_db, $trg_db, $src_link, $trg_link, $source_tables_uncommon, $q, $uncommon_tables_fields, false);
}
if (isset($row_count[$q]) && $data) {

View File

@ -923,8 +923,8 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
$pdf->SetX(10);
$pdf->Cell(0, 6, $i . ' ' . $table, 0, 1, 'L', 0, $pdf->PMA_links['doc'][$table]['-']);
// $pdf->Ln(1);
$result = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table) . ';');
while ($row = PMA_DBI_fetch_assoc($result)) {
$fields = PMA_DBI_get_columns($GLOBALS['db'], $table);
foreach($fields as $row) {
$pdf->SetX(20);
$field_name = $row['Field'];
$pdf->PMA_links['doc'][$table][$field_name] = $pdf->AddLink();

View File

@ -38,7 +38,7 @@ class PMA_User_Schema
public function processUserChoice()
{
global $action_choose,$db,$cfgRelation,$cfg;
global $action_choose, $db, $cfgRelation;
if (isset($this->action)) {
switch ($this->action) {
@ -207,7 +207,7 @@ class PMA_User_Schema
*/
public function showTableDashBoard()
{
global $db,$cfgRelation,$table,$cfg,$with_field_names;
global $db, $cfgRelation, $table, $with_field_names;
/*
* We will need an array of all tables in this db
*/
@ -479,7 +479,7 @@ class PMA_User_Schema
*/
private function _displayScratchboardTables($array_sh_page)
{
global $with_field_names,$cfg,$db;
global $with_field_names, $db;
?>
<script type="text/javascript" src="./js/dom-drag.js"></script>
<form method="post" action="schema_edit.php" name="dragdrop">
@ -505,22 +505,14 @@ class PMA_User_Schema
$reset_draginit .= ' document.edcoord.elements["c_table_' . $i . '[x]"].value = "2"' . "\n";
$reset_draginit .= ' document.edcoord.elements["c_table_' . $i . '[y]"].value = "' . (15 * $i) . '"' . "\n";
$local_query = 'SHOW FIELDS FROM '
. PMA_backquote($temp_sh_page['table_name'])
. ' FROM ' . PMA_backquote($db);
$fields_rs = PMA_DBI_query($local_query);
unset($local_query);
$fields_cnt = PMA_DBI_num_rows($fields_rs);
echo '<div id="table_' . $i . '" class="pdflayout_table"><u>' . $temp_sh_page['table_name'] . '</u>';
if (isset($with_field_names)) {
while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
echo '<br />' . htmlspecialchars($row['Field']) . "\n";
$fields = PMA_DBI_get_columns($db, $temp_sh_page['table_name']);
foreach ($fields as $row) {
echo '<br />' . htmlspecialchars($row['Field']) . "\n";
}
}
echo '</div>' . "\n";
PMA_DBI_free_result($fields_rs);
unset($fields_rs);
$i++;
}
?>

View File

@ -213,9 +213,7 @@ function PMA_sqlQueryFormInsert($query = '', $is_querywindow = false, $delimiter
// Get the list and number of fields
// we do a try_query here, because we could be in the query window,
// trying to synchonize and the table has not yet been created
$fields_list = PMA_DBI_fetch_result(
'SHOW FULL COLUMNS FROM ' . PMA_backquote($db)
. '.' . PMA_backquote($GLOBALS['table']));
$fields_list = PMA_DBI_get_columns($db, $GLOBALS['table'], true);
$tmp_db_link = '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase']
. '?' . PMA_generate_common_url($db) . '"';

View File

@ -59,12 +59,11 @@ function PMA_tbl_getFields($table,$db) {
// Gets the list and number of fields
$result = PMA_DBI_query('SHOW FULL FIELDS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db) . ';', null, PMA_DBI_QUERY_STORE);
$fields_cnt = PMA_DBI_num_rows($result);
$fields = PMA_DBI_get_columns($db, $table, true);
$fields_list = $fields_null = $fields_type = $fields_collation = array();
$geom_column_present = false;
$geom_types = PMA_getGISDatatypes();
while ($row = PMA_DBI_fetch_assoc($result)) {
foreach ($fields as $row) {
$fields_list[] = $row['Field'];
$type = $row['Type'];
// check whether table contains geometric columns
@ -96,8 +95,6 @@ function PMA_tbl_getFields($table,$db) {
? $row['Collation']
: '';
} // end while
PMA_DBI_free_result($result);
unset($result, $type);
return array($fields_list,$fields_type,$fields_collation,$fields_null, $geom_column_present);

View File

@ -15,8 +15,9 @@ if (! defined('PMA_NO_VARIABLES_IMPORT')) {
define('PMA_NO_VARIABLES_IMPORT', true);
}
if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true)
if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
$GLOBALS['is_header_sent'] = true;
}
require_once './libraries/common.inc.php';
@ -31,166 +32,173 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
// real-time charting data
if (isset($_REQUEST['chart_data'])) {
switch($_REQUEST['type']) {
// Process and Connections realtime chart
case 'proc':
$c = PMA_DBI_fetch_result("SHOW GLOBAL STATUS WHERE Variable_name = 'Connections'", 0, 1);
$result = PMA_DBI_query('SHOW PROCESSLIST');
$num_procs = PMA_DBI_num_rows($result);
// Process and Connections realtime chart
case 'proc':
$c = PMA_DBI_fetch_result("SHOW GLOBAL STATUS WHERE Variable_name = 'Connections'", 0, 1);
$result = PMA_DBI_query('SHOW PROCESSLIST');
$num_procs = PMA_DBI_num_rows($result);
$ret = array(
'x' => microtime(true)*1000,
'y_proc' => $num_procs,
'y_conn' => $c['Connections']
);
$ret = array(
'x' => microtime(true) * 1000,
'y_proc' => $num_procs,
'y_conn' => $c['Connections']
);
exit(json_encode($ret));
exit(json_encode($ret));
// Query realtime chart
case 'queries':
$queries = PMA_DBI_fetch_result(
"SHOW GLOBAL STATUS
WHERE (Variable_name LIKE 'Com_%' OR Variable_name = 'Questions')
AND Value > 0'", 0, 1);
cleanDeprecated($queries);
// admin commands are not queries
unset($queries['Com_admin_commands']);
$questions = $queries['Questions'];
unset($queries['Questions']);
// Query realtime chart
case 'queries':
$queries = PMA_DBI_fetch_result(
"SHOW GLOBAL STATUS
WHERE (Variable_name LIKE 'Com_%' OR Variable_name = 'Questions')
AND Value > 0'", 0, 1);
cleanDeprecated($queries);
// admin commands are not queries
unset($queries['Com_admin_commands']);
$questions = $queries['Questions'];
unset($queries['Questions']);
//$sum=array_sum($queries);
$ret = array(
'x' => microtime(true)*1000,
'y' => $questions,
'pointInfo' => $queries
);
//$sum=array_sum($queries);
$ret = array(
'x' => microtime(true) * 1000,
'y' => $questions,
'pointInfo' => $queries
);
exit(json_encode($ret));
exit(json_encode($ret));
// Traffic realtime chart
case 'traffic':
$traffic = PMA_DBI_fetch_result(
"SHOW GLOBAL STATUS
WHERE Variable_name = 'Bytes_received'
OR Variable_name = 'Bytes_sent'", 0, 1);
// Traffic realtime chart
case 'traffic':
$traffic = PMA_DBI_fetch_result(
"SHOW GLOBAL STATUS
WHERE Variable_name = 'Bytes_received'
OR Variable_name = 'Bytes_sent'", 0, 1);
$ret = array(
'x' => microtime(true)*1000,
'y_sent' => $traffic['Bytes_sent'],
'y_received' => $traffic['Bytes_received']
);
$ret = array(
'x' => microtime(true) * 1000,
'y_sent' => $traffic['Bytes_sent'],
'y_received' => $traffic['Bytes_received']
);
exit(json_encode($ret));
exit(json_encode($ret));
// Data for the monitor
case 'chartgrid':
$ret = json_decode($_REQUEST['requiredData'], true);
$statusVars = array();
$serverVars = array();
$sysinfo = $cpuload = $memory = 0;
$pName = '';
// Data for the monitor
case 'chartgrid':
$ret = json_decode($_REQUEST['requiredData'], true);
$statusVars = array();
$serverVars = array();
$sysinfo = $cpuload = $memory = 0;
$pName = '';
/* Accumulate all required variables and data */
// For each chart
foreach ($ret as $chart_id => $chartNodes) {
// For each data series
foreach ($chartNodes as $node_id => $nodeDataPoints) {
// For each data point in the series (usually just 1)
foreach ($nodeDataPoints as $point_id => $dataPoint) {
$pName = $dataPoint['name'];
/* Accumulate all required variables and data */
// For each chart
foreach ($ret as $chart_id => $chartNodes) {
// For each data series
foreach ($chartNodes as $node_id => $nodeDataPoints) {
// For each data point in the series (usually just 1)
foreach ($nodeDataPoints as $point_id => $dataPoint) {
$pName = $dataPoint['name'];
switch ($dataPoint['type']) {
/* We only collect the status and server variables here to
* read them all in one query, and only afterwards assign them.
* Also do some white list filtering on the names
*/
case 'servervar':
if (!preg_match('/[^a-zA-Z_]+/', $pName))
$serverVars[] = $pName;
break;
case 'statusvar':
if (!preg_match('/[^a-zA-Z_]+/', $pName))
$statusVars[] = $pName;
break;
case 'proc':
$result = PMA_DBI_query('SHOW PROCESSLIST');
$ret[$chart_id][$node_id][$point_id]['value'] = PMA_DBI_num_rows($result);
break;
case 'cpu':
if (!$sysinfo) {
require_once('libraries/sysinfo.lib.php');
$sysinfo = getSysInfo();
}
if (!$cpuload)
$cpuload = $sysinfo->loadavg();
if (PHP_OS == 'Linux') {
$ret[$chart_id][$node_id][$point_id]['idle'] = $cpuload['idle'];
$ret[$chart_id][$node_id][$point_id]['busy'] = $cpuload['busy'];
} else
$ret[$chart_id][$node_id][$point_id]['value'] = $cpuload['loadavg'];
break;
case 'memory':
if (!$sysinfo) {
require_once('libraries/sysinfo.lib.php');
$sysinfo = getSysInfo();
}
if (!$memory)
$memory = $sysinfo->memory();
$ret[$chart_id][$node_id][$point_id]['value'] = $memory[$pName];
break;
switch ($dataPoint['type']) {
/* We only collect the status and server variables here to
* read them all in one query, and only afterwards assign them.
* Also do some white list filtering on the names
*/
case 'servervar':
if (!preg_match('/[^a-zA-Z_]+/', $pName)) {
$serverVars[] = $pName;
}
break;
case 'statusvar':
if (!preg_match('/[^a-zA-Z_]+/', $pName)) {
$statusVars[] = $pName;
}
break;
case 'proc':
$result = PMA_DBI_query('SHOW PROCESSLIST');
$ret[$chart_id][$node_id][$point_id]['value'] = PMA_DBI_num_rows($result);
break;
case 'cpu':
if (!$sysinfo) {
require_once('libraries/sysinfo.lib.php');
$sysinfo = getSysInfo();
}
if (!$cpuload) {
$cpuload = $sysinfo->loadavg();
}
if (PHP_OS == 'Linux') {
$ret[$chart_id][$node_id][$point_id]['idle'] = $cpuload['idle'];
$ret[$chart_id][$node_id][$point_id]['busy'] = $cpuload['busy'];
} else
$ret[$chart_id][$node_id][$point_id]['value'] = $cpuload['loadavg'];
break;
case 'memory':
if (!$sysinfo) {
require_once('libraries/sysinfo.lib.php');
$sysinfo = getSysInfo();
}
if (!$memory) {
$memory = $sysinfo->memory();
}
$ret[$chart_id][$node_id][$point_id]['value'] = $memory[$pName];
break;
} /* switch */
} /* foreach */
} /* foreach */
} /* foreach */
// Retrieve all required status variables
if (count($statusVars)) {
$statusVarValues = PMA_DBI_fetch_result(
"SHOW GLOBAL STATUS
WHERE Variable_name='" . implode("' OR Variable_name='", $statusVars) . "'", 0, 1);
} else {
$statusVarValues = array();
}
// Retrieve all required server variables
if (count($serverVars)) {
$serverVarValues = PMA_DBI_fetch_result(
"SHOW GLOBAL VARIABLES
WHERE Variable_name='" . implode("' OR Variable_name='", $serverVars) . "'", 0, 1);
} else {
$serverVarValues = array();
}
// ...and now assign them
foreach ($ret as $chart_id => $chartNodes) {
foreach ($chartNodes as $node_id => $nodeDataPoints) {
foreach ($nodeDataPoints as $point_id => $dataPoint) {
switch($dataPoint['type']) {
case 'statusvar':
$ret[$chart_id][$node_id][$point_id]['value'] = $statusVarValues[$dataPoint['name']];
break;
case 'servervar':
$ret[$chart_id][$node_id][$point_id]['value'] = $serverVarValues[$dataPoint['name']];
break;
}
}
}
}
// Retrieve all required status variables
if (count($statusVars)) {
$statusVarValues = PMA_DBI_fetch_result(
"SHOW GLOBAL STATUS
WHERE Variable_name='" . implode("' OR Variable_name='", $statusVars) . "'", 0, 1);
} else {
$statusVarValues = array();
}
$ret['x'] = microtime(true) * 1000;
// Retrieve all required server variables
if (count($serverVars)) {
$serverVarValues = PMA_DBI_fetch_result(
"SHOW GLOBAL VARIABLES
WHERE Variable_name='" . implode("' OR Variable_name='", $serverVars) . "'", 0, 1);
} else {
$serverVarValues = array();
}
// ...and now assign them
foreach ($ret as $chart_id => $chartNodes) {
foreach ($chartNodes as $node_id => $nodeDataPoints) {
foreach ($nodeDataPoints as $point_id => $dataPoint) {
switch($dataPoint['type']) {
case 'statusvar':
$ret[$chart_id][$node_id][$point_id]['value'] = $statusVarValues[$dataPoint['name']];
break;
case 'servervar':
$ret[$chart_id][$node_id][$point_id]['value'] = $serverVarValues[$dataPoint['name']];
break;
}
}
}
}
$ret['x'] = microtime(true)*1000;
exit(json_encode($ret));
exit(json_encode($ret));
}
}
if (isset($_REQUEST['log_data'])) {
if(PMA_MYSQL_INT_VERSION < 50106) exit('""');
if (PMA_MYSQL_INT_VERSION < 50106) {
/* FIXME: why this? */
exit('""');
}
$start = intval($_REQUEST['time_start']);
$end = intval($_REQUEST['time_end']);
@ -210,19 +218,23 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
$type = strtolower(substr($row['sql_text'], 0, strpos($row['sql_text'], ' ')));
switch($type) {
case 'insert':
case 'update':
// Cut off big inserts and updates, but append byte count therefor
if(strlen($row['sql_text']) > 220)
$row['sql_text'] = substr($row['sql_text'], 0, 200) . '... [' .
implode(' ', PMA_formatByteDown(strlen($row['sql_text']), 2, 2)) . ']';
break;
default:
break;
case 'insert':
case 'update':
// Cut off big inserts and updates, but append byte count therefor
if (strlen($row['sql_text']) > 220) {
$row['sql_text'] = substr($row['sql_text'], 0, 200)
. '... ['
. implode(' ', PMA_formatByteDown(strlen($row['sql_text']), 2, 2))
. ']';
}
break;
default:
break;
}
if(!isset($return['sum'][$type])) $return['sum'][$type] = 0;
if (!isset($return['sum'][$type])) {
$return['sum'][$type] = 0;
}
$return['sum'][$type] += $row['#'];
$return['rows'][] = $row;
}
@ -235,7 +247,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
exit(json_encode($return));
}
if($_REQUEST['type'] == 'general') {
if ($_REQUEST['type'] == 'general') {
$limitTypes = (isset($_REQUEST['limitTypes']) && $_REQUEST['limitTypes'])
? 'AND argument REGEXP \'^(INSERT|SELECT|UPDATE|DELETE)\' ' : '';
@ -257,39 +269,44 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
preg_match('/^(\w+)\s/', $row['argument'], $match);
$type = strtolower($match[1]);
if(!isset($return['sum'][$type])) $return['sum'][$type] = 0;
if (!isset($return['sum'][$type])) {
$return['sum'][$type] = 0;
}
$return['sum'][$type] += $row['#'];
switch($type) {
case 'insert':
// Group inserts if selected
if($removeVars && preg_match('/^INSERT INTO (`|\'|"|)([^\s\\1]+)\\1/i', $row['argument'], $matches)) {
$insertTables[$matches[2]]++;
if ($insertTables[$matches[2]] > 1) {
$return['rows'][$insertTablesFirst]['#'] = $insertTables[$matches[2]];
case 'insert':
// Group inserts if selected
if ($removeVars && preg_match('/^INSERT INTO (`|\'|"|)([^\s\\1]+)\\1/i', $row['argument'], $matches)) {
$insertTables[$matches[2]]++;
if ($insertTables[$matches[2]] > 1) {
$return['rows'][$insertTablesFirst]['#'] = $insertTables[$matches[2]];
// Add a ... to the end of this query to indicate that there's been other queries
if($return['rows'][$insertTablesFirst]['argument'][strlen($return['rows'][$insertTablesFirst]['argument'])-1] != '.')
$return['rows'][$insertTablesFirst]['argument'] .= '<br/>...';
// Group this value, thus do not add to the result list
continue 2;
} else {
$insertTablesFirst = $i;
$insertTables[$matches[2]] += $row['#'] - 1;
// Add a ... to the end of this query to indicate that there's been other queries
if ($return['rows'][$insertTablesFirst]['argument'][strlen($return['rows'][$insertTablesFirst]['argument'])-1] != '.') {
$return['rows'][$insertTablesFirst]['argument'] .= '<br/>...';
}
// Group this value, thus do not add to the result list
continue 2;
} else {
$insertTablesFirst = $i;
$insertTables[$matches[2]] += $row['#'] - 1;
}
// No break here
}
// No break here
case 'update':
// Cut off big inserts and updates, but append byte count therefor
if(strlen($row['argument']) > 220)
$row['argument'] = substr($row['argument'], 0, 200) . '... [' .
implode(' ', PMA_formatByteDown(strlen($row['argument'])), 2, 2) . ']';
case 'update':
// Cut off big inserts and updates, but append byte count therefor
if (strlen($row['argument']) > 220) {
$row['argument'] = substr($row['argument'], 0, 200)
. '... ['
. implode(' ', PMA_formatByteDown(strlen($row['argument'])), 2, 2)
. ']';
}
break;
break;
default: break;
default: break;
}
$return['rows'][] = $row;
@ -306,12 +323,15 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
}
if (isset($_REQUEST['logging_vars'])) {
if(isset($_REQUEST['varName']) && isset($_REQUEST['varValue'])) {
if (isset($_REQUEST['varName']) && isset($_REQUEST['varValue'])) {
$value = PMA_sqlAddslashes($_REQUEST['varValue']);
if(!is_numeric($value)) $value="'" . $value . "'";
if (!is_numeric($value)) {
$value="'" . $value . "'";
}
if(! preg_match("/[^a-zA-Z0-9_]+/", $_REQUEST['varName']))
if (! preg_match("/[^a-zA-Z0-9_]+/", $_REQUEST['varName'])) {
PMA_DBI_query('SET GLOBAL ' . $_REQUEST['varName'] . ' = ' . $value);
}
}
@ -319,14 +339,16 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
exit(json_encode($loggingVars));
}
if(isset($_REQUEST['query_analyzer'])) {
if (isset($_REQUEST['query_analyzer'])) {
$return = array();
if(strlen($_REQUEST['database']))
if (strlen($_REQUEST['database'])) {
PMA_DBI_select_db($_REQUEST['database']);
}
if ($profiling = PMA_profilingSupported())
if ($profiling = PMA_profilingSupported()) {
PMA_DBI_query('SET PROFILING=1;');
}
// Do not cache query
$query = preg_replace('/^(\s*SELECT)/i', '\\1 SQL_NO_CACHE', $_REQUEST['query']);
@ -344,7 +366,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
PMA_DBI_free_result($result);
if($profiling) {
if ($profiling) {
$return['profiling'] = array();
$result = PMA_DBI_try_query('SELECT seq,state,duration FROM INFORMATION_SCHEMA.PROFILING WHERE QUERY_ID=1 ORDER BY seq');
while ($row = PMA_DBI_fetch_assoc($result)) {
@ -356,7 +378,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
exit(json_encode($return));
}
if(isset($_REQUEST['advisor'])) {
if (isset($_REQUEST['advisor'])) {
include('libraries/Advisor.class.php');
$advisor = new Advisor();
exit(json_encode($advisor->run()));
@ -606,7 +628,9 @@ foreach ($server_status as $name => $value) {
foreach ($allocations as $filter => $section) {
if (strpos($name, $filter) !== false) {
$allocationMap[$name] = $section;
if ($section == 'com' && $value > 0) $used_queries[$name] = $value;
if ($section == 'com' && $value > 0) {
$used_queries[$name] = $value;
}
break; // Only exits inner loop
}
}
@ -623,19 +647,19 @@ if(PMA_DRIZZLE) {
/* Ajax request refresh */
if (isset($_REQUEST['show']) && isset($_REQUEST['ajax_request'])) {
switch($_REQUEST['show']) {
case 'query_statistics':
printQueryStatistics();
exit();
case 'server_traffic':
printServerTraffic();
exit();
case 'variables_table':
// Prints the variables table
printVariablesTable();
exit();
case 'query_statistics':
printQueryStatistics();
exit();
case 'server_traffic':
printServerTraffic();
exit();
case 'variables_table':
// Prints the variables table
printVariablesTable();
exit();
default:
break;
default:
break;
}
}
@ -645,7 +669,7 @@ $server_db_isLocal = strtolower($cfg['Server']['host']) == 'localhost'
PMA_AddJSCode('pma_token = \'' . $_SESSION[' PMA_token '] . "';\n" .
'url_query = \'' . str_replace('&amp;', '&', PMA_generate_common_url($db)) . "';\n" .
'server_time_diff = new Date().getTime() - ' . (microtime(true)*1000) . ";\n" .
'server_time_diff = new Date().getTime() - ' . (microtime(true) * 1000) . ";\n" .
'server_os = \'' . PHP_OS . "';\n" .
'is_superuser = ' . (PMA_isSuperuser() ? 'true' : 'false') . ";\n" .
'server_db_isLocal = ' . ($server_db_isLocal ? 'true' : 'false') . ";\n" .
@ -772,7 +796,9 @@ echo __('Runtime Information');
echo '<span class="status_' . $section_name . '"> ';
$i=0;
foreach ($section_links as $link_name => $link_url) {
if ($i > 0) echo ', ';
if ($i > 0) {
echo ', ';
}
if ('doc' == $link_name) {
echo PMA_showMySQLDocu($link_url, $link_url);
} else {
@ -894,9 +920,11 @@ function printQueryStatistics()
$name = str_replace(array('Com_', '_'), array('', ' '), $name);
// Group together values that make out less than 2% into "Other", but only if we have more than 6 fractions already
if ($value < $query_sum * 0.02 && count($chart_json)>6)
if ($value < $query_sum * 0.02 && count($chart_json)>6) {
$other_sum += $value;
else $chart_json[$name] = $value;
} else {
$chart_json[$name] = $value;
}
?>
<tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
<th class="name"><?php echo htmlspecialchars($name); ?></th>
@ -915,8 +943,9 @@ function printQueryStatistics()
<div id="serverstatusquerieschart">
<span style="display:none;">
<?php
if ($other_sum > 0)
if ($other_sum > 0) {
$chart_json[__('Other')] = $other_sum;
}
echo json_encode($chart_json);
?>
@ -971,8 +1000,7 @@ function printServerTraffic()
}
/* if the server works as master or slave in replication process, display useful information */
if ($server_master_status || $server_slave_status)
{
if ($server_master_status || $server_slave_status) {
?>
<hr class="clearfloat" />
@ -1121,7 +1149,8 @@ function printServerTraffic()
<th><?php echo __('Status'); ?></th>
<th><?php
echo __('SQL query');
if (! PMA_DRIZZLE) { ?>
if (! PMA_DRIZZLE) {
?>
<a href="<?php echo $full_text_link; ?>"
title="<?php echo empty($full) ? __('Show Full Queries') : __('Truncate Shown Queries'); ?>">
<img src="<?php echo $GLOBALS['pmaThemeImage'] . 's_' . (empty($_REQUEST['full']) ? 'full' : 'partial'); ?>text.png"
@ -1488,7 +1517,7 @@ function printMonitor()
<div id="monitorInstructionsDialog" title="<?php echo __('Monitor Instructions'); ?>" style="display:none;">
<?php echo __('The phpMyAdmin Monitor can assist you in optimizing the server configuration and track down time intensive queries. For the latter you will need to set log_output to \'TABLE\' and have either the slow_query_log or general_log enabled. Note however, that the general_log produces a lot of data and increases server load by up to 15%'); ?>
<?php if(PMA_MYSQL_INT_VERSION < 50106) { ?>
<?php if (PMA_MYSQL_INT_VERSION < 50106) { ?>
<p>
<img class="icon ic_s_attention" src="themes/dot.gif" alt="" />
<?php
@ -1630,7 +1659,9 @@ function printMonitor()
$i=0;
foreach ($server_status as $name=>$value) {
if (is_numeric($value)) {
if ($i++ > 0) echo ", ";
if ($i++ > 0) {
echo ", ";
}
echo "'" . $name . "'";
}
}
@ -1648,10 +1679,11 @@ function refreshList($name, $defaultRate=5, $refreshRates=Array(1, 2, 5, 10, 20,
foreach ($refreshRates as $rate) {
$selected = ($rate == $defaultRate)?' selected="selected"':'';
if ($rate<60)
if ($rate<60) {
echo '<option value="' . $rate . '"' . $selected . '>' . sprintf(_ngettext('%d second', '%d seconds', $rate), $rate) . '</option>';
else
} else {
echo '<option value="' . $rate . '"' . $selected . '>' . sprintf(_ngettext('%d minute', '%d minutes', $rate/60), $rate/60) . '</option>';
}
}
?>
</select>

View File

@ -165,8 +165,7 @@ unset($show_create_table);
* Get the list of the fields of the current table
*/
PMA_DBI_select_db($db);
$table_fields = PMA_DBI_fetch_result('SHOW FIELDS FROM ' . PMA_backquote($table) . ';',
null, null, null, PMA_DBI_QUERY_STORE);
$table_fields = PMA_DBI_get_columns($db, $table);
$rows = array();
if (isset($where_clause)) {
// when in edit mode load all selected rows from table

View File

@ -27,7 +27,6 @@ require_once './libraries/db_table_exists.lib.php';
* Get the list of the fields of the current table
*/
PMA_DBI_select_db($db);
$table_def = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table), null, PMA_DBI_QUERY_STORE);
if (isset($where_clause)) {
$result = PMA_DBI_query('SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $where_clause . ';', null, PMA_DBI_QUERY_STORE);
$row = PMA_DBI_fetch_assoc($result);