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();
|
auto dbname = cat.getDBName();
|
||||||
oid = cat.databases()->getByName(dbname)->tablespace;
|
oid = cat.databases()->getByName(dbname)->tablespace;
|
||||||
auto ts = cat.tablespaces()->getByKey(oid);
|
auto ts = cat.tablespaces()->getByKey(oid);
|
||||||
return ts->name + " (inherited)";
|
return ts->objectName() + " (inherited)";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
auto ts = cat.tablespaces()->getByKey(oid);
|
auto ts = cat.tablespaces()->getByKey(oid);
|
||||||
return ts->name;
|
return ts->objectName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
#include "PgTablespace.h"
|
#include "PgTablespace.h"
|
||||||
|
|
||||||
PgTablespace::PgTablespace()
|
QString PgTablespace::typeName() const
|
||||||
{}
|
{
|
||||||
|
return "TABLESPACE";
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,17 @@
|
||||||
#ifndef PGTABLESPACE_H
|
#ifndef PGTABLESPACE_H
|
||||||
#define PGTABLESPACE_H
|
#define PGTABLESPACE_H
|
||||||
|
|
||||||
|
#include "PgServerObject.h"
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <libpq-fe.h>
|
#include <libpq-fe.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class PgTablespace {
|
class PgTablespace: public PgServerObject {
|
||||||
public:
|
public:
|
||||||
Oid oid = InvalidOid;
|
|
||||||
QString name;
|
|
||||||
Oid owner = InvalidOid;
|
|
||||||
std::vector<QString> acl;
|
|
||||||
std::vector<QString> options;
|
std::vector<QString> options;
|
||||||
|
|
||||||
PgTablespace();
|
using PgServerObject::PgServerObject;
|
||||||
|
QString typeName() const override;
|
||||||
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; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PGTABLESPACE_H
|
#endif // PGTABLESPACE_H
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,16 @@ FROM pg_tablespace
|
||||||
PgTablespace PgTablespaceContainer::loadElem(const Pgsql::Row &row)
|
PgTablespace PgTablespaceContainer::loadElem(const Pgsql::Row &row)
|
||||||
{
|
{
|
||||||
Pgsql::Col col(row);
|
Pgsql::Col col(row);
|
||||||
PgTablespace v;
|
Oid oid = col.nextValue();
|
||||||
col >> v.oid >> v.name >> v.owner >> v.acl >> v.options;
|
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;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue