Merge pull request #96 from gramotei/master

Fixes bug #3575799
This commit is contained in:
Atul Pratap Singh 2012-10-11 13:08:42 -07:00
commit d8dfe7c21c
2 changed files with 14 additions and 3 deletions

View File

@ -42,6 +42,12 @@ $(function() {
* (see $GLOBALS['cfg']['AjaxEnable'])
*/
$("#tbl_search_form.ajax").live('submit', function(event) {
var unaryFunctions = [
'IS NULL',
'IS NOT NULL',
"= ''",
"!= ''"];
// jQuery object to reuse
$search_form = $(this);
event.preventDefault();
@ -64,8 +70,12 @@ $(function() {
}
});
var columnCount = $('select[name="columnsToDisplay[]"] option').length;
// Submit values only for the columns that have a search criteria
// Submit values only for the columns that have unary column operator or a search criteria
for (var a = 0; a < columnCount; a++) {
if ($.inArray(values['criteriaColumnOperators[' + a + ']'], unaryFunctions) >= 0) {
continue;
}
if (values['criteriaValues[' + a + ']'] == '') {
delete values['criteriaValues[' + a + ']'];
delete values['criteriaColumnOperators[' + a + ']'];

View File

@ -656,8 +656,9 @@ EOT;
return $fullWhereClause;
}
// If there are no search criteria set, return
if (! array_filter($_POST['criteriaValues'])) {
// If there are no search criteria set or no unary criteria operators, return
if (! array_filter($_POST['criteriaValues'])
&& ! array_intersect($_POST['criteriaColumnOperators'], $GLOBALS['PMA_Types']->getUnaryOperators())) {
return $fullWhereClause;
}