Query, Explain and Cancel are going throught the asyncdbconnection now.

Todo: Notice processing and error reporting.
This commit is contained in:
Eelke Klein 2017-01-08 09:58:34 +01:00
parent fce51a7b7e
commit a36bf5f7f4
11 changed files with 335 additions and 217 deletions

View file

@ -1,6 +1,6 @@
#include "queryresultmodel.h"
QueryResultModel::QueryResultModel(QObject *parent, Pgsql::Result &&r)
QueryResultModel::QueryResultModel(QObject *parent, std::shared_ptr<Pgsql::Result> r)
: QAbstractTableModel(parent)
, result(std::move(r))
{}
@ -8,13 +8,13 @@ QueryResultModel::QueryResultModel(QObject *parent, Pgsql::Result &&r)
int QueryResultModel::rowCount(const QModelIndex &) const
{
int r = result.getRows();
int r = result->getRows();
return r;
}
int QueryResultModel::columnCount(const QModelIndex &) const
{
int r = result.getCols();
int r = result->getCols();
return r;
}
@ -25,7 +25,7 @@ QVariant QueryResultModel::data(const QModelIndex &index, int role) const
int col = index.column();
if (role == Qt::DisplayRole) {
r = QString(result.getVal(col, rij));
r = QString(result->getVal(col, rij));
}
else if (role == Qt::TextAlignmentRole) {
if (col == 0) {
@ -43,7 +43,7 @@ QVariant QueryResultModel::headerData(int section, Qt::Orientation orientation,
QVariant r;
if (role == Qt::DisplayRole) {
if (orientation == Qt::Horizontal) {
r = QString(result.getColName(section));
r = QString(result->getColName(section));
}
else {
r = QString::number(section + 1);