Merge branch 'master' of ssh://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin

This commit is contained in:
Madhura Jayaratne 2011-08-24 10:01:46 +05:30
commit 136921c9cd
3 changed files with 89 additions and 96 deletions

View File

@ -444,7 +444,7 @@ if ($is_show_stats) {
<th class="value tbl_rows"><?php echo $sum_row_count_pre . PMA_formatNumber($sum_entries, 0); ?></th>
<?php
if (!($cfg['PropertiesNumColumns'] > 1)) {
$default_engine = PMA_DBI_get_default_engine();
$default_engine = PMA_DBI_fetch_value('SHOW VARIABLES LIKE \'storage_engine\';', 0, 1);
echo ' <th align="center">' . "\n"
. ' <dfn title="'
. sprintf(__('%s is the default storage engine on this MySQL server.'), $default_engine) . '">' .$default_engine . '</dfn></th>' . "\n";

View File

@ -899,7 +899,7 @@ function PMA_DBI_postConnect($link, $is_controluser = false)
define('PMA_MYSQL_STR_VERSION', PMA_cacheGet('PMA_MYSQL_STR_VERSION', true));
} else {
$mysql_version = PMA_DBI_fetch_value(
'SELECT VERSION()', 0, 0, $link, PMA_DBI_QUERY_STORE);
'SELECT VERSION()', 0, 0, $link);
if ($mysql_version) {
$match = explode('.', $mysql_version);
define('PMA_MYSQL_MAJOR_VERSION', (int)$match[0]);
@ -950,16 +950,15 @@ function PMA_DBI_postConnect($link, $is_controluser = false)
* @param integer|string $field field to fetch the value from,
* starting at 0, with 0 beeing default
* @param resource $link mysql link
* @param mixed $options
* @return mixed value of first field in first row from result
* or false if not found
*/
function PMA_DBI_fetch_value($result, $row_number = 0, $field = 0, $link = null, $options = 0)
function PMA_DBI_fetch_value($result, $row_number = 0, $field = 0, $link = null)
{
$value = false;
if (is_string($result)) {
$result = PMA_DBI_try_query($result, $link, $options | PMA_DBI_QUERY_STORE, false);
$result = PMA_DBI_try_query($result, $link, PMA_DBI_QUERY_STORE, false);
}
// return false if result is empty or false
@ -1174,16 +1173,6 @@ function PMA_DBI_fetch_result($result, $key = null, $value = null,
return $resultrows;
}
/**
* return default table engine for given database
*
* @return string default table engine
*/
function PMA_DBI_get_default_engine()
{
return PMA_DBI_fetch_value('SHOW VARIABLES LIKE \'storage_engine\';', 0, 1);
}
/**
* Get supported SQL compatibility modes
*

View File

@ -118,7 +118,7 @@ if (isset($inputs) && ($inputs[0] != 'pma_null' || $inputs[1] != 'pma_null')) {
<?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
<input type="hidden" name="goto" value="<?php echo $goto; ?>" />
<input type="hidden" name="back" value="tbl_zoom_select.php" />
<input type="hidden" name="flag" id="id_flag" value=<?php echo $flag; ?> />
<input type="hidden" name="flag" id="id_flag" value="<?php echo $flag; ?>" />
<fieldset id="inputSection">
@ -137,15 +137,15 @@ for ($i = 0; $i < 4; $i++) {
}
?>
<tr class="noclick <?php echo $odd_row ? 'odd' : 'even'; $odd_row = ! $odd_row; ?>">
<th><select name="inputs[]" id=<?php echo 'tableid_' . $i?> >
<option value= <?php echo 'pma_null'?>><?php echo __('None'); ?> </option>
<th><select name="inputs[]" id="<?php echo 'tableid_' . $i; ?>" >
<option value="<?php echo 'pma_null'; ?>"><?php echo __('None'); ?> </option>
<?php
for ($j = 0 ; $j < $fields_cnt ; $j++) {
if (isset($inputs[$i]) && $inputs[$i] == htmlspecialchars($fields_list[$j])) {?>
<option value=<?php echo htmlspecialchars($fields_list[$j]);?> Selected> <?php echo htmlspecialchars($fields_list[$j]);?></option>
<option value="<?php echo htmlspecialchars($fields_list[$j]);?>" selected="selected"> <?php echo htmlspecialchars($fields_list[$j]);?></option>
<?php
} else { ?>
<option value=<?php echo htmlspecialchars($fields_list[$j]);?> > <?php echo htmlspecialchars($fields_list[$j]);?></option>
<option value="<?php echo htmlspecialchars($fields_list[$j]);?> "> <?php echo htmlspecialchars($fields_list[$j]);?></option>
<?php
}
} ?>
@ -162,7 +162,7 @@ for ($i = 0; $i < 4; $i++) {
foreach ($GLOBALS['cfg']['EnumOperators'] as $fc) {
if (isset($zoomFunc[$i]) && $zoomFunc[$i] == htmlspecialchars($fc)) {
echo "\n" . ' '
. '<option value="' . htmlspecialchars($fc) . '" Selected>'
. '<option value="' . htmlspecialchars($fc) . '" selected="selected">'
. htmlspecialchars($fc) . '</option>';
} else {
echo "\n" . ' '
@ -174,7 +174,7 @@ for ($i = 0; $i < 4; $i++) {
foreach ($GLOBALS['cfg']['TextOperators'] as $fc) {
if (isset($zoomFunc[$i]) && $zoomFunc[$i] == $fc) {
echo "\n" . ' '
. '<option value="' . htmlspecialchars($fc) . '" Selected>'
. '<option value="' . htmlspecialchars($fc) . '" selected="selected">'
. htmlspecialchars($fc) . '</option>';
} else {
echo "\n" . ' '
@ -186,7 +186,7 @@ for ($i = 0; $i < 4; $i++) {
foreach ($GLOBALS['cfg']['NumOperators'] as $fc) {
if (isset($zoomFunc[$i]) && $zoomFunc[$i] == $fc) {
echo "\n" . ' '
. '<option value="' . htmlspecialchars($fc) . '" Selected>'
. '<option value="' . htmlspecialchars($fc) . '" selected="selected">'
. htmlspecialchars($fc) . '</option>';
} else {
echo "\n" . ' '
@ -200,7 +200,7 @@ for ($i = 0; $i < 4; $i++) {
foreach ($GLOBALS['cfg']['NullOperators'] as $fc) {
if (isset($zoomFunc[$i]) && $zoomFunc[$i] == $fc) {
echo "\n" . ' '
. '<option value="' . htmlspecialchars($fc) . '" Selected>'
. '<option value="' . htmlspecialchars($fc) . '" selected="selected">'
. htmlspecialchars($fc) . '</option>';
} else {
echo "\n" . ' '
@ -248,38 +248,42 @@ for ($i = 0; $i < 4; $i++) {
*/
//Set default datalabel if not selected
if(isset($zoom_submit) && $inputs[0] != 'pma_null' && $inputs[1] != 'pma_null') {
if ($dataLabel == '')
$dataLabel = PMA_getDisplayField($db,$table);
if (isset($zoom_submit) && $inputs[0] != 'pma_null' && $inputs[1] != 'pma_null') {
if ($dataLabel == '') {
$dataLabel = PMA_getDisplayField($db,$table);
}
?>
}
?>
<table class="data">
<tr><td><label for="label"><?php echo __("Data Label"); ?></label>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</td>
<tr><td><label for="dataLabel"><?php echo __("Data Label"); ?></label>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</td>
<td><select name="dataLabel" id='dataLabel' >
<option value = ''> <?php echo __('None'); ?> </option>
<?php
for ($j = 0 ; $j < $fields_cnt ; $j++){
if(isset($dataLabel) && $dataLabel == htmlspecialchars($fields_list[$j])){?>
<option value=<?php echo htmlspecialchars($fields_list[$j]);?> Selected> <?php echo htmlspecialchars($fields_list[$j]);?></option>
<?php
}
else{ ?>
<option value=<?php echo htmlspecialchars($fields_list[$j]);?> > <?php echo htmlspecialchars($fields_list[$j]);?></option>
<?php
}
} ?>
<?php
for ($j = 0; $j < $fields_cnt; $j++) {
if (isset($dataLabel) && $dataLabel == htmlspecialchars($fields_list[$j])) {
?>
<option value="<?php echo htmlspecialchars($fields_list[$j]);?>" selected="selected"> <?php echo htmlspecialchars($fields_list[$j]);?></option>
<?php
} else {
?>
<option value="<?php echo htmlspecialchars($fields_list[$j]);?>" > <?php echo htmlspecialchars($fields_list[$j]);?></option>
<?php
}
}
?>
</select>
</td></tr>
<tr><td><label for="label"><?php echo __("Maximum rows to plot"); ?></label></td>
<tr><td><label for="maxRowPlotLimit"><?php echo __("Maximum rows to plot"); ?></label></td>
<td>
<?php if(isset($maxPlotLimit)) { ?>
<input type="text" name="maxPlotLimit" value="<?php echo $maxPlotLimit; ?>" /></td></tr>
<?php
}
else { ?>
<input type="text" name="maxPlotLimit" value="<?php echo $GLOBALS['cfg']['maxRowPlotLimit']; ?>" /></td></tr>
<?php
} ?>
<?php
echo '<input type="text" name="maxPlotLimit" id="maxRowPlotLimit" value="';
if (! empty($maxPlotLimit)) {
echo $maxPlotLimit;
} else {
echo $GLOBALS['cfg']['maxRowPlotLimit'];
}
echo '" /></td></tr>';
?>
</table>
</fieldset>
@ -293,10 +297,10 @@ for ($i = 0; $i < 4; $i++) {
<?php
/*
* Handle the input criteria and gerate the query result
* Handle the input criteria and generate the query result
* Form for displaying query results
*/
if(isset($zoom_submit) && $inputs[0] != 'pma_null' && $inputs[1] != 'pma_null' && $inputs[0] != $inputs[1]) {
if (isset($zoom_submit) && $inputs[0] != 'pma_null' && $inputs[1] != 'pma_null' && $inputs[0] != $inputs[1]) {
/*
* Query generation part
@ -305,11 +309,11 @@ if(isset($zoom_submit) && $inputs[0] != 'pma_null' && $inputs[1] != 'pma_null' &
$sql_query = 'SELECT *';
//Add the table
$sql_query .= ' FROM ' . PMA_backquote($table);
for($i = 0 ; $i < 4 ; $i++){
if($inputs[$i] == 'pma_null')
continue;
for ($i = 0; $i < 4; $i++) {
if ($inputs[$i] == 'pma_null') {
continue;
}
$tmp = array();
// The where clause
$charsets = array();
@ -318,41 +322,39 @@ if(isset($zoom_submit) && $inputs[0] != 'pma_null' && $inputs[1] != 'pma_null' &
list($charsets[$i]) = explode('_', $collations[$i]);
$unaryFlag = (isset($GLOBALS['cfg']['UnaryOperators'][$func_type]) && $GLOBALS['cfg']['UnaryOperators'][$func_type] == 1) ? true : false;
$whereClause = PMA_tbl_search_getWhereClause($fields[$i],$inputs[$i], $types[$i], $collations[$i], $func_type, $unaryFlag);
if($whereClause)
$w[] = $whereClause;
} // end for
if ($w) {
$sql_query .= ' WHERE ' . implode(' AND ', $w);
if ($whereClause) {
$w[] = $whereClause;
}
$sql_query .= ' LIMIT ' . $maxPlotLimit;
} // end for
if ($w) {
$sql_query .= ' WHERE ' . implode(' AND ', $w);
}
$sql_query .= ' LIMIT ' . $maxPlotLimit;
/*
* Query execution part
*/
$result = PMA_DBI_query( $sql_query . ";" , null, PMA_DBI_QUERY_STORE);
$result = PMA_DBI_query($sql_query . ";" , null, PMA_DBI_QUERY_STORE);
$fields_meta = PMA_DBI_get_fields_meta($result);
while ($row = PMA_DBI_fetch_assoc($result)) {
//Need a row with indexes as 0,1,2 for the PMA_getUniqueCondition hence using a temporary array
$tmpRow = array();
foreach($row as $val)
$tmpRow[] = $val;
$tmpRow = array();
foreach ($row as $val) {
$tmpRow[] = $val;
}
//Get unique conditon on each row (will be needed for row update)
$uniqueCondition = PMA_getUniqueCondition($result, $fields_cnt, $fields_meta, $tmpRow, true);
$uniqueCondition = PMA_getUniqueCondition($result, $fields_cnt, $fields_meta, $tmpRow, true);
//Append it to row array as where_clause
$row['where_clause'] = $uniqueCondition[0];
if($dataLabel == $inputs[0] || $dataLabel == $inputs[1])
//Append it to row array as where_clause
$row['where_clause'] = $uniqueCondition[0];
if ($dataLabel == $inputs[0] || $dataLabel == $inputs[1]) {
$data[] = array($inputs[0] => $row[$inputs[0]], $inputs[1] => $row[$inputs[1]], 'where_clause' => $uniqueCondition[0]);
else if($dataLabel)
} elseif ($dataLabel) {
$data[] = array($inputs[0] => $row[$inputs[0]], $inputs[1] => $row[$inputs[1]], $dataLabel => $row[$dataLabel], 'where_clause' => $uniqueCondition[0]);
else
} else {
$data[] = array($inputs[0] => $row[$inputs[0]], $inputs[1] => $row[$inputs[1]], $dataLabel => '', 'where_clause' => $uniqueCondition[0]);
}
}
?>
<?php
/*
* Form for displaying point data and also the scatter plot
*/
@ -365,18 +367,22 @@ else
<fieldset id="displaySection">
<legend><?php echo __('Browse/Edit the points') ?></legend>
<center>
<?php
//JSON encode the data(query result)
if(isset($zoom_submit) && !empty($data)){ ?>
<?php
//JSON encode the data(query result)
if (isset($zoom_submit) && ! empty($data)) {
?>
<div id='resizer' style="width:600px;height:400px">
<?php if (isset($data)) ?><center> <a href="#" onClick="displayHelp();"><?php echo __('How to use'); ?></a> </center>
<center> <a href="#" onClick="displayHelp();"><?php echo __('How to use'); ?></a> </center>
<div id="querydata" style="display:none">
<?php if(isset($data)) echo json_encode($data); ?>
<?php
echo json_encode($data);
?>
</div>
<div id="querychart" style="float:right"></div>
</div>
<?php
} ?>
}
?>
</center>
<fieldset id='dataDisplay' style="display:none">
<fieldset>
@ -389,20 +395,21 @@ else
</tr>
</thead>
<tbody>
<?php
$odd_row = true;
for ($i = 4; $i < $fields_cnt + 4 ; $i++) {
$tbl_fields_type[$i] = $fields_type[$i - 4];
$fieldpopup = $fields_list[$i - 4];
$foreignData = PMA_getForeignData($foreigners, $fieldpopup, false, '', '');
?>
<?php
$odd_row = true;
for ($i = 4; $i < $fields_cnt + 4; $i++) {
$tbl_fields_type[$i] = $fields_type[$i - 4];
$fieldpopup = $fields_list[$i - 4];
$foreignData = PMA_getForeignData($foreigners, $fieldpopup, false, '', '');
?>
<tr class="noclick <?php echo $odd_row ? 'odd' : 'even'; $odd_row = ! $odd_row; ?>">
<th><?php echo htmlspecialchars($fields_list[$i - 4]); ?></th>
<th><?php echo '<input type="checkbox" class="checkbox_null" name="fields_null[ ' . $i . ' ]" id="fields_null_id_' . $i . '" />'; ?></th>
<th><?php echo PMA_getForeignFields_Values($foreigners, $foreignData, $fieldpopup, $tbl_fields_type, $i, $db, $table, $titles,$GLOBALS['cfg']['ForeignKeyMaxLimit'], '' ); ?> </th>
</tr>
<?php
} ?>
<?php
}
?>
</tbody>
</table>
</fieldset>
@ -415,10 +422,7 @@ else
<input type="hidden" id="queryID" name="sql_query" />
</form>
</fieldset>
<?php
<?php
}
?>
<?php
require './libraries/footer.inc.php';
require './libraries/footer.inc.php';
?>