Fix executing selected SQL text when there are multi-byte characters

Fix executing the selected SQL statement(s) when there are multi-byte
characters before the selection. Because QScintilla gives us the start
position of the selection in bytes and we used the value for counting
characters, the executed part of the text was off by a few characters.

See issue #2311.
This commit is contained in:
Martin Kleusberg
2020-07-05 15:22:50 +02:00
parent 0562f16dfa
commit d089a60bf7
+1 -1
View File
@@ -1115,7 +1115,7 @@ void MainWindow::executeQuery()
// no chance to execute any further.
QString sql = sqlWidget->getSql();
if(mode == Selection)
sql = sql.left(execute_to_position);
sql = sql.toUtf8().left(execute_to_position); // We have to convert to a QByteArray here because QScintilla gives us the position in bytes, not in characters.
// Prepare the SQL worker to run the query. We set the context of each signal-slot connection to the current SQL execution area.
// This means that if the tab is closed all these signals are automatically disconnected so the lambdas won't be called for a not