mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
Support for operator filters for strings
This adds support for all operators when applied to string values.
Formerly they were always treated as a Containing (LIKE) operator, but
after the implementation of bbe2e33ea4 the
lack of these operators were more visible and, at least, the omission of
<> seems a bug. But the omission of the others may also be a limitation.
For easing the return to the old behaviour, the Containing filter option
now takes into account the necessity of escaping the value when it starts
by one of the operator characters.
For operators applied to strings the behaviour is documented by Sqlite3
here: https://www.sqlite.org/datatype3.html#collating_sequences
See related issue #1463.
This commit is contained in:
@@ -607,6 +607,11 @@ void ExtendedTableWidget::useAsFilter(const QString& filterOperator, bool binary
|
||||
else
|
||||
value = data.toString();
|
||||
|
||||
// When Containing filter is requested (empty operator) and the value starts with
|
||||
// an operator character, the character is escaped.
|
||||
if (filterOperator.isEmpty())
|
||||
value.replace(QRegExp("^(<|>|=)"), Settings::getValue("databrowser", "filter_escape").toString() + QString("\\1"));
|
||||
|
||||
// If binary operator, the cell data is used as first value and
|
||||
// the second value must be added by the user.
|
||||
if (binary)
|
||||
|
||||
Reference in New Issue
Block a user