Move query in results panel of Execute SQL to the bottom

This gives precedence to the results of the query. It also removes the
comment characters that only made sense in the SQL User log. The text is
splitted so the texts are only translated once. The output of a multi-query
execution is also improved, because the results and line are constant
while the query part is quickly changing.

After the execution of a multi-query text, the final text is not separated
by a blank line so the result message is visible in the second.

For users wanting more space in the editor and query table, the results
panel is now collapsible, since the SQL Log can be used instead.

See issues #1709 and #1670.
This commit is contained in:
mgrojo
2019-02-23 21:21:25 +01:00
parent dfb7974d27
commit e436cb2516
3 changed files with 7 additions and 4 deletions

View File

@@ -1470,9 +1470,10 @@ void MainWindow::executeQuery()
// Log the query and the result message.
// The query takes the last placeholder as it may itself contain the sequence '%' + number.
QString query = editor->text(from_position, to_position);
QString log_message = tr("-- At line %1:\n%3\n-- Result: %2").arg(execute_from_line+1).arg(status_message).arg(query.trimmed());
QString log_message = QString("-- " + tr("At line %1:") + "\n%3\n-- " + tr("Result: %2")).arg(execute_from_line+1).arg(status_message).arg(query.trimmed());
db.logSQL(log_message, kLogMsg_User);
log_message = QString(tr("Result: %2") + "\n" + tr("At line %1:") + "\n%3").arg(execute_from_line+1).arg(status_message).arg(query.trimmed());
// Update the execution area
sqlWidget->finishExecution(log_message, ok);
};
@@ -1550,9 +1551,9 @@ void MainWindow::executeQuery()
// Show Done message
if(sqlWidget->inErrorState())
sqlWidget->getStatusEdit()->setPlainText(tr("Execution finished with errors.") + "\n\n" + sqlWidget->getStatusEdit()->toPlainText());
sqlWidget->getStatusEdit()->setPlainText(tr("Execution finished with errors.") + "\n" + sqlWidget->getStatusEdit()->toPlainText());
else
sqlWidget->getStatusEdit()->setPlainText(tr("Execution finished without errors.") + "\n\n" + sqlWidget->getStatusEdit()->toPlainText());
sqlWidget->getStatusEdit()->setPlainText(tr("Execution finished without errors.") + "\n" + sqlWidget->getStatusEdit()->toPlainText());
});
// Add an hourglass icon to the current tab to indicate that there's a running execution in there.

View File

@@ -37,6 +37,8 @@ SqlExecutionArea::SqlExecutionArea(DBBrowserDB& _db, QWidget* parent) :
connect(ui->findLineEdit, SIGNAL(returnPressed()), this, SLOT(findNext()));
connect(ui->hideFindButton, SIGNAL(clicked()), this, SLOT(hideFindFrame()));
// Set collapsible the editErrors panel
ui->splitter_2->setCollapsible(1, true);
// Load settings
reloadSettings();
}

View File

@@ -229,7 +229,7 @@
<bool>false</bool>
</property>
<property name="toolTip">
<string>Results of the last executed statements</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Results of the last executed statements.&lt;/p&gt;&lt;p&gt;You may want to collapse this panel and use the &lt;span style=&quot; font-style:italic;&quot;&gt;SQL Log&lt;/span&gt; dock with &lt;span style=&quot; font-style:italic;&quot;&gt;User&lt;/span&gt; selection instead.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="whatsThis">
<string>This field shows the results and status codes of the last executed statements.</string>