SqliteTableModel: Fix bug in last commit to support multiline strings

Fix a bug in the last commit to correctly remove comments on multi-line
queries.
This commit is contained in:
Martin Kleusberg
2013-09-06 14:30:50 +02:00
parent 169eccbebb
commit bc2511434e
2 changed files with 2 additions and 2 deletions

View File

@@ -736,7 +736,7 @@ void DBBrowserDB::logSQL(QString statement, int msgtype)
// Replace binary log messages by a placeholder text instead of printing gibberish
for(int i=0;i<statement.size();i++)
{
if(statement.at(i) < 32)
if(statement.at(i) < 32 && statement.at(i) != '\n')
{
statement.truncate(32);
statement.append(QObject::tr("... <string can not be logged, contains binary data> ..."));

View File

@@ -62,7 +62,7 @@ QString removeComments(QString s)
stringChars.push_back(s.at(i));
} else if(stringChars.empty() && s.at(i) == '-' && lastChar == '-') {
if(s.contains('\n'))
return removeComments(s.remove(i-1, s.indexOf('\n', i)-i));
return removeComments(s.remove(i-1, s.indexOf('\n', i)-i+2));
else
return s.left(i-1);
}