Mogelijkheid om query to kopieren als raw c++ string.
This commit is contained in:
parent
a9534d543e
commit
33cf39b799
10 changed files with 70 additions and 18 deletions
|
|
@ -200,7 +200,7 @@ void QueryTab::execute()
|
|||
clearResult();
|
||||
ui->messagesEdit->clear();
|
||||
|
||||
std::string cmd = getCommand();
|
||||
std::string cmd = getCommandUtf8();
|
||||
m_stopwatch.start();
|
||||
|
||||
if (m_queryParamListController->empty())
|
||||
|
|
@ -232,7 +232,7 @@ void QueryTab::explain(bool analyze)
|
|||
analyze_str = "ANALYZE, ";
|
||||
}
|
||||
m_stopwatch.start();
|
||||
std::string cmd = "EXPLAIN (" + analyze_str + "VERBOSE, BUFFERS, FORMAT JSON) " + getCommand();
|
||||
std::string cmd = "EXPLAIN (" + analyze_str + "VERBOSE, BUFFERS, FORMAT JSON) " + getCommandUtf8();
|
||||
m_dbConnection.send(cmd,
|
||||
[this](Expected<std::shared_ptr<Pgsql::Result>> exp_res, qint64 )
|
||||
{
|
||||
|
|
@ -449,7 +449,7 @@ void QueryTab::explain_ready(ExplainRoot::SPtr explain)
|
|||
}
|
||||
}
|
||||
|
||||
std::string QueryTab::getCommand() const
|
||||
QString QueryTab::getCommand() const
|
||||
{
|
||||
QString command;
|
||||
QTextCursor cursor = ui->queryEdit->textCursor();
|
||||
|
|
@ -459,7 +459,12 @@ std::string QueryTab::getCommand() const
|
|||
else {
|
||||
command = ui->queryEdit->toPlainText();
|
||||
}
|
||||
return command.toUtf8().data();
|
||||
return command;
|
||||
}
|
||||
|
||||
std::string QueryTab::getCommandUtf8() const
|
||||
{
|
||||
return getCommand().toUtf8().data();
|
||||
}
|
||||
|
||||
QTabWidget *QueryTab::getTabWidget()
|
||||
|
|
@ -571,18 +576,27 @@ void QueryTab::clearResult()
|
|||
|
||||
void QueryTab::copyQueryAsCString()
|
||||
{
|
||||
QString command;
|
||||
QTextCursor cursor = ui->queryEdit->textCursor();
|
||||
if (cursor.hasSelection()) {
|
||||
command = cursor.selection().toPlainText();
|
||||
}
|
||||
else {
|
||||
command = ui->queryEdit->toPlainText();
|
||||
}
|
||||
// QString command;
|
||||
// QTextCursor cursor = ui->queryEdit->textCursor();
|
||||
// if (cursor.hasSelection()) {
|
||||
// command = cursor.selection().toPlainText();
|
||||
// }
|
||||
// else {
|
||||
// command = ui->queryEdit->toPlainText();
|
||||
// }
|
||||
QString command = getCommand();
|
||||
QString cs = ConvertToMultiLineCString(command);
|
||||
QApplication::clipboard()->setText(cs);
|
||||
}
|
||||
|
||||
void QueryTab::copyQueryAsRawCppString()
|
||||
{
|
||||
//auto sql = getAllOrSelectedSql();
|
||||
QString command = getCommand();
|
||||
QString cs = ConvertToMultiLineRawCppString(command);
|
||||
QApplication::clipboard()->setText(cs);
|
||||
}
|
||||
|
||||
void QueryTab::exportData(const QString &file_name)
|
||||
{
|
||||
auto widget = ui->tabWidget->currentWidget();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue