Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Thilina Buddika 2012-06-16 23:36:32 +05:30
commit efa7422883
3 changed files with 24 additions and 1241 deletions

View File

@ -105,6 +105,16 @@ class PMA_TableSearch
$this->_loadTableInfo($this->_db, $this->_table);
}
/**
* Returns Column names array
*
* @return array column names
*/
public function getColumnNames()
{
return $this->_columnNames;
}
/**
* Gets all the columns of a table along with their types, collations
* and whether null or not.

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,7 @@
*/
require_once './libraries/common.inc.php';
require_once './libraries/mysql_charsets.lib.php';
require_once './libraries/tbl_select.lib.php';
require_once './libraries/TableSearch.class.php';
require_once './libraries/tbl_info.inc.php';
$response = PMA_Response::getInstance();
@ -50,6 +50,8 @@ foreach ($post_params as $one_post_param) {
}
}
$table_search = new PMA_TableSearch($db, $table, "zoom");
/**
* Handle AJAX request for data row on point select
* @var post_params Object containing parameters for the POST request
@ -90,16 +92,10 @@ if (isset($_REQUEST['change_tbl_info']) && $_REQUEST['change_tbl_info'] == true)
$response->addJSON('field_collation', '');
$response->addJSON('field_operators', '');
$response->addJSON('field_value', '');
exit;
}
// Gets the list and number of fields
list($columnNames, $columnTypes, $columnCollations, $columnNullFlags)
= PMA_tbl_getFields($_REQUEST['db'], $_REQUEST['table']);
$foreigners = PMA_getForeigners($db, $table);
$key = array_search($field, $columnNames);
$properties = PMA_tblSearchGetColumnProperties(
$db, $table, $columnNames, $columnTypes, $columnCollations,
$columnNullFlags, $foreigners, $_REQUEST['it'], $key
);
$key = array_search($field, $table_search->getColumnNames());
$properties = $table_search->getColumnProperties($_REQUEST['it'], $key);
$response->addJSON('field_type', $properties['type']);
$response->addJSON('field_collation', $properties['collation']);
$response->addJSON('field_operators', $properties['func']);
@ -107,18 +103,11 @@ if (isset($_REQUEST['change_tbl_info']) && $_REQUEST['change_tbl_info'] == true)
exit;
}
$titles['Browse'] = PMA_getIcon('b_browse.png', __('Browse foreign values'));
/**
* Not selection yet required -> displays the selection form
*/
// Gets some core libraries
require_once './libraries/tbl_common.inc.php';
$url_query .= '&goto=tbl_select.php&back=tbl_select.php';
/**
* Gets tables informations
*/
// Gets tables informations
require_once './libraries/tbl_info.inc.php';
if (! isset($goto)) {
@ -127,24 +116,13 @@ if (! isset($goto)) {
// Defines the url to return to in case of error in the next sql statement
$err_url = $goto . '?' . PMA_generate_common_url($db, $table);
// Gets the list and number of fields
list($columnNames, $columnTypes, $columnCollations, $columnNullFlags)
= PMA_tbl_getFields($db, $table);
// retrieve keys into foreign fields, if any
// check also foreigners even if relwork is FALSE (to get
// foreign keys from innodb)
$foreigners = PMA_getForeigners($db, $table);
//Set default datalabel if not selected
if ( !isset($_POST['zoom_submit']) || $_POST['dataLabel'] == '') {
$dataLabel = PMA_getDisplayField($db, $table);
}
//Display zoom search form
echo PMA_tblSearchGetSelectionForm(
$goto, $db, $table, $columnNames, $columnTypes, $columnCollations,
$columnNullFlags, false, $foreigners, "zoom", $dataLabel
);
// Displays the zoom search form
$response->addHTML($table_search->getSelectionForm($goto, $dataLabel));
/*
* Handle the input criteria and generate the query result
@ -156,7 +134,7 @@ if (isset($zoom_submit)
&& $_POST['criteriaColumnNames'][0] != $_POST['criteriaColumnNames'][1]
) {
//Query generation part
$sql_query = PMA_tblSearchBuildSqlQuery();
$sql_query = $table_search->buildSqlQuery();
$sql_query .= ' LIMIT ' . $maxPlotLimit;
//Query execution part
@ -171,7 +149,8 @@ if (isset($zoom_submit)
}
//Get unique conditon on each row (will be needed for row update)
$uniqueCondition = PMA_getUniqueCondition(
$result, count($columnNames), $fields_meta, $tmpRow, true
$result, count($table_search->getColumnNames()), $fields_meta, $tmpRow,
true
);
//Append it to row array as where_clause
$row['where_clause'] = $uniqueCondition[0];
@ -187,9 +166,6 @@ if (isset($zoom_submit)
unset($tmpData);
//Displays form for point data and scatter plot
echo PMA_tblSearchGetZoomResultsForm(
$goto, $db, $table, $columnNames, $columnTypes, $columnNullFlags,
$foreigners, $data
);
$response->addHTML($table_search->getZoomResultsForm($goto, $data));
}
?>