mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-05-24 22:48:23 -05:00
Fix empty filters in project files
Fix loading of project files with empty filter values. If an empty filter value was saved in a project file, it did not show up in the UI but was partially added to the query anyway. This lead to an invalid query with no results. Also fix a possible loophole which at least in theory could lead to an empty filter value being stored in the project file. See issue #2288.
This commit is contained in:
+3
-1
@@ -2320,7 +2320,9 @@ static void loadBrowseDataTableSettings(BrowseDataTableSettings& settings, QXmlS
|
||||
while(xml.readNext() != QXmlStreamReader::EndElement && xml.name() != "filter_values") {
|
||||
if (xml.name() == "column") {
|
||||
size_t index = xml.attributes().value("index").toUInt();
|
||||
settings.filterValues[index] = xml.attributes().value("value").toString();
|
||||
QString value = xml.attributes().value("value").toString();
|
||||
if(!value.isEmpty())
|
||||
settings.filterValues[index] = value;
|
||||
xml.skipCurrentElement();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -525,9 +525,10 @@ void TableBrowser::updateFilter(size_t column, const QString& value)
|
||||
|
||||
// Save the new filter settings
|
||||
BrowseDataTableSettings& settings = m_settings[currentlyBrowsedTableName()];
|
||||
if(value.isEmpty() && settings.filterValues.erase(column) > 0)
|
||||
if(value.isEmpty())
|
||||
{
|
||||
emit projectModified();
|
||||
if(settings.filterValues.erase(column) > 0)
|
||||
emit projectModified();
|
||||
} else {
|
||||
if (settings.filterValues[column] != value) {
|
||||
settings.filterValues[column] = value;
|
||||
|
||||
Reference in New Issue
Block a user