Skip to content

Commit

Permalink
Support filtering for NULL values
Browse files Browse the repository at this point in the history
  • Loading branch information
MKleusberg committed Feb 2, 2017
1 parent 4794b0d commit 8ceb72d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/sqlitetablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -622,8 +622,19 @@ void SqliteTableModel::updateFilter(int column, const QString& value)
numeric = true;
}
} else if(value.left(1) == "=") {
op = "=";
val = value.mid(1);

// Check if value to compare with is 'NULL'
if(val != "NULL")
{
// It's not, so just compare normally to the value, whatever it is.
op = "=";
} else {
// It is NULL. Override the comparison operator to search for NULL values in this column. Also treat search value (NULL) as number,
// in order to avoid putting quotes around it.
op = "IS";
numeric = true;
}
} else {
// Keep the default LIKE operator

Expand Down

0 comments on commit 8ceb72d

Please sign in to comment.