Added list of databases and roles.

Roles works for atleast 9.3 and up.

Reorganizing code for communicating with database.
This commit is contained in:
eelke 2017-02-18 12:05:48 +01:00
parent 8c077b3d5f
commit 2d962334da
28 changed files with 881 additions and 428 deletions

View file

@ -11,13 +11,13 @@ QueryResultModel::QueryResultModel(QObject *parent, std::shared_ptr<Pgsql::Resul
int QueryResultModel::rowCount(const QModelIndex &) const
{
int r = result->getRows();
int r = result->rows();
return r;
}
int QueryResultModel::columnCount(const QModelIndex &) const
{
int r = result->getCols();
int r = result->cols();
return r;
}
@ -34,7 +34,7 @@ QVariant QueryResultModel::data(const QModelIndex &index, int role) const
}
else {
Oid o = result->type(col);
QString s(result->getVal(col, rij));
QString s(result->val(col, rij));
switch (o) {
case oid_bool:
s = (s == "t") ? "TRUE" : "FALSE";
@ -88,7 +88,7 @@ QVariant QueryResultModel::data(const QModelIndex &index, int role) const
r = QBrush(Qt::darkGreen);
break;
case oid_bool:
if (strcmp(result->getVal(col, rij), "t") == 0) {
if (strcmp(result->val(col, rij), "t") == 0) {
r = QBrush(Qt::darkGreen);
}
else {