PgTablespace now inherits from PgServerObject.
This commit is contained in:
parent
0b6c1a8544
commit
aaa05f64ef
4 changed files with 21 additions and 17 deletions
|
|
@ -72,11 +72,11 @@ QString getTablespaceDisplayString(const PgDatabaseCatalog &cat, Oid oid)
|
|||
auto dbname = cat.getDBName();
|
||||
oid = cat.databases()->getByName(dbname)->tablespace;
|
||||
auto ts = cat.tablespaces()->getByKey(oid);
|
||||
return ts->name + " (inherited)";
|
||||
return ts->objectName() + " (inherited)";
|
||||
}
|
||||
else {
|
||||
auto ts = cat.tablespaces()->getByKey(oid);
|
||||
return ts->name;
|
||||
return ts->objectName();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
#include "PgTablespace.h"
|
||||
|
||||
PgTablespace::PgTablespace()
|
||||
{}
|
||||
QString PgTablespace::typeName() const
|
||||
{
|
||||
return "TABLESPACE";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,24 +1,17 @@
|
|||
#ifndef PGTABLESPACE_H
|
||||
#define PGTABLESPACE_H
|
||||
|
||||
#include "PgServerObject.h"
|
||||
#include <QString>
|
||||
#include <libpq-fe.h>
|
||||
#include <vector>
|
||||
|
||||
class PgTablespace {
|
||||
class PgTablespace: public PgServerObject {
|
||||
public:
|
||||
Oid oid = InvalidOid;
|
||||
QString name;
|
||||
Oid owner = InvalidOid;
|
||||
std::vector<QString> acl;
|
||||
std::vector<QString> options;
|
||||
|
||||
PgTablespace();
|
||||
|
||||
bool operator==(Oid _oid) const { return oid == _oid; }
|
||||
//bool operator==(const QString &n) const { return name == n; }
|
||||
bool operator<(Oid _oid) const { return oid < _oid; }
|
||||
bool operator<(const PgTablespace &rhs) const { return oid < rhs.oid; }
|
||||
using PgServerObject::PgServerObject;
|
||||
QString typeName() const override;
|
||||
};
|
||||
|
||||
#endif // PGTABLESPACE_H
|
||||
|
|
|
|||
|
|
@ -17,7 +17,16 @@ FROM pg_tablespace
|
|||
PgTablespace PgTablespaceContainer::loadElem(const Pgsql::Row &row)
|
||||
{
|
||||
Pgsql::Col col(row);
|
||||
PgTablespace v;
|
||||
col >> v.oid >> v.name >> v.owner >> v.acl >> v.options;
|
||||
Oid oid = col.nextValue();
|
||||
QString name = col.nextValue();
|
||||
Oid owner = col.nextValue();
|
||||
PgTablespace v(m_catalog, oid, name);
|
||||
v.setOwnerOid(owner);
|
||||
|
||||
AclList acl_list;
|
||||
col >> acl_list;
|
||||
v.setAcls(std::move(acl_list));
|
||||
|
||||
col >> v.options;
|
||||
return v;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue