Use existing function to build SQL query
This commit is contained in:
parent
0223a533de
commit
6a85bdd16f
@ -437,7 +437,9 @@ function PMA_tblSearchBuildSqlQuery()
|
||||
// if all column names were selected to display, we do a 'SELECT *'
|
||||
// (more efficient and this helps prevent a problem in IE
|
||||
// if one of the rows is edited and we come back to the Select results)
|
||||
if (count($_POST['columnsToDisplay']) == count($_POST['criteriaColumnNames'])) {
|
||||
if (count($_POST['columnsToDisplay']) == count($_POST['criteriaColumnNames'])
|
||||
|| isset($_POST['zoom_submit'])
|
||||
) {
|
||||
$sql_query .= '* ';
|
||||
} else {
|
||||
$sql_query .= implode(', ', PMA_backquote($_POST['columnsToDisplay']));
|
||||
@ -448,7 +450,7 @@ function PMA_tblSearchBuildSqlQuery()
|
||||
$sql_query .= $whereClause;
|
||||
|
||||
// if the search results are to be ordered
|
||||
if ($_POST['orderByColumn'] != '--nil--') {
|
||||
if (isset($_POST['orderByColumn']) && $_POST['orderByColumn'] != '--nil--') {
|
||||
$sql_query .= ' ORDER BY ' . PMA_backquote($_POST['orderByColumn'])
|
||||
. ' ' . $_POST['order'];
|
||||
} // end if
|
||||
|
||||
@ -346,33 +346,7 @@ if (isset($zoom_submit)
|
||||
/*
|
||||
* Query generation part
|
||||
*/
|
||||
$w = $data = array();
|
||||
$sql_query = 'SELECT *';
|
||||
|
||||
//Add the table
|
||||
$sql_query .= ' FROM ' . PMA_backquote($table);
|
||||
for ($i = 0; $i < 4; $i++) {
|
||||
if ($criteriaColumnNames[$i] == 'pma_null') {
|
||||
continue;
|
||||
}
|
||||
$tmp = array();
|
||||
// The where clause
|
||||
$charsets = array();
|
||||
$cnt_func = count($criteriaColumnOperators[$i]);
|
||||
$func_type = $criteriaColumnOperators[$i];
|
||||
list($charsets[$i]) = explode('_', $criteriaColumnCollations[$i]);
|
||||
$unaryFlag = $GLOBALS['PMA_Types']->isUnaryOperator($func_type);
|
||||
$whereClause = PMA_tbl_search_getWhereClause(
|
||||
$criteriaValues[$i], $criteriaColumnNames[$i], $criteriaColumnTypes[$i],
|
||||
$criteriaColumnCollations[$i], $func_type, $unaryFlag
|
||||
);
|
||||
if ($whereClause) {
|
||||
$w[] = $whereClause;
|
||||
}
|
||||
} // end for
|
||||
if ($w) {
|
||||
$sql_query .= ' WHERE ' . implode(' AND ', $w);
|
||||
}
|
||||
$sql_query = PMA_tblSearchBuildSqlQuery();
|
||||
$sql_query .= ' LIMIT ' . $maxPlotLimit;
|
||||
|
||||
/*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user