mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
Use correct syntax when format applied to string containing apostrophe
The string has to be correctly quoted so contained apostrophes are doubled. This prevented applying a format to cells containing apostrophes (single quotes) since the SQL code raised a syntax error in SQLite.
This commit is contained in:
@@ -272,7 +272,7 @@ QVariant SqliteTableModel::getMatchingCondFormat(const std::map<size_t, std::vec
|
||||
if (isNumber && !contains(eachCondFormat.sqlCondition(), '\''))
|
||||
sql = "SELECT " + value.toStdString() + " " + eachCondFormat.sqlCondition();
|
||||
else
|
||||
sql = "SELECT '" + value.toStdString() + "' " + eachCondFormat.sqlCondition();
|
||||
sql = "SELECT " + sqlb::escapeString(value.toStdString()) + " " + eachCondFormat.sqlCondition();
|
||||
|
||||
// Empty filter means: apply format to any row.
|
||||
// Query the DB for the condition, waiting in case there is a loading in progress.
|
||||
|
||||
Reference in New Issue
Block a user