Slightly more complex then you may expect because the tablespace specified by the tables tends to be oid 0 which means the default tablespace is used. However this does not mean pg_default, it means the tablespace as defined as standard in the database definition. So we need to know what the current dbname is retrieve it's details from the catalog and retrieve that tablespace to know what to show for an oid of 0.
24 lines
558 B
C++
24 lines
558 B
C++
#ifndef PGTABLESPACE_H
|
|
#define PGTABLESPACE_H
|
|
|
|
#include <QString>
|
|
#include <libpq-fe.h>
|
|
#include <vector>
|
|
|
|
class PgTablespace {
|
|
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; }
|
|
};
|
|
|
|
#endif // PGTABLESPACE_H
|