Skip to content

Commit

Permalink
Merge pull request #96 from gramotei/master
Browse files Browse the repository at this point in the history
Fixes bug #3575799
  • Loading branch information
atul516 committed Oct 11, 2012
2 parents b7d2138 + b4386b0 commit d8dfe7c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
12 changes: 11 additions & 1 deletion js/tbl_select.js
Expand Up @@ -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();
Expand All @@ -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 + ']'];
Expand Down
5 changes: 3 additions & 2 deletions libraries/TableSearch.class.php
Expand Up @@ -656,8 +656,9 @@ private function _generateWhereClause()
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;
}

Expand Down

0 comments on commit d8dfe7c

Please sign in to comment.