Skip to content

Commit f804f89

Browse files
committed
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.
1 parent 78ece66 commit f804f89

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/sqlitedb.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ void DBBrowserDB::logSQL(QString statement, int msgtype)
725725
// Replace binary log messages by a placeholder text instead of printing gibberish
726726
for(int i=0;i<statement.size();i++)
727727
{
728-
if(statement.at(i) < 32)
728+
if(statement.at(i) < 32 && statement.at(i) != '\n')
729729
{
730730
statement.truncate(32);
731731
statement.append(QObject::tr("... <string can not be logged, contains binary data> ..."));

src/sqlitetablemodel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ QString removeComments(QString s)
6262
stringChars.push_back(s.at(i));
6363
} else if(stringChars.empty() && s.at(i) == '-' && lastChar == '-') {
6464
if(s.contains('\n'))
65-
return removeComments(s.remove(i-1, s.indexOf('\n', i)-i));
65+
return removeComments(s.remove(i-1, s.indexOf('\n', i)-i+2));
6666
else
6767
return s.left(i-1);
6868
}

0 commit comments

Comments
 (0)