Added ability to test the connection in the dialog where the connection details are entered.

This commit is contained in:
eelke 2021-07-04 16:45:50 +02:00
parent 45795333f2
commit c00a0452d1
7 changed files with 201 additions and 43 deletions

View file

@ -51,25 +51,25 @@ public:
/** This version of send uses the signal onQueryResult and onQueryError to report back
* the completion of the query.
*/
bool send(const std::string &command, Pgsql::Params params = Pgsql::Params())
{
return send(command, params, [this] (Expected<std::shared_ptr<Pgsql::Result>> res, qint64) {
if (res.valid()) {
emit onQueryResult(res.get());
}
else {
emit onQueryError();
}
});
}
// bool send(const std::string &command, Pgsql::Params params = Pgsql::Params())
// {
// return send(command, params, [this] (Expected<std::shared_ptr<Pgsql::Result>> res, qint64) {
// if (res.valid()) {
// emit onQueryResult(res.get());
// }
// else {
// emit onQueryError();
// }
// });
// }
bool cancel();
signals:
void onStateChanged(ASyncDBConnection::State state);
void onNotice(Pgsql::ErrorDetails notice);
void onQueryResult(std::shared_ptr<Pgsql::Result> result);
void onQueryError();
// void onQueryResult(std::shared_ptr<Pgsql::Result> result);
// void onQueryError();
private:
Pgsql::Connection m_connection;