2017-02-01 18:01:02 +01:00
|
|
|
|
#ifndef PGCLASS_H
|
|
|
|
|
|
#define PGCLASS_H
|
|
|
|
|
|
|
2017-12-10 10:35:46 +01:00
|
|
|
|
#include "Pgsql_Value.h"
|
2018-11-25 19:45:06 +01:00
|
|
|
|
#include "PgNamespaceObject.h"
|
|
|
|
|
|
#include "PgOwnedObject.h"
|
2017-02-01 18:01:02 +01:00
|
|
|
|
#include <QString>
|
2017-08-23 13:27:23 +02:00
|
|
|
|
#include <libpq-fe.h>
|
2017-02-01 18:01:02 +01:00
|
|
|
|
|
2017-12-10 10:35:46 +01:00
|
|
|
|
enum class RelPersistence {
|
|
|
|
|
|
Permanent, // p
|
|
|
|
|
|
Unlogged, // u
|
|
|
|
|
|
Temporary // t
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void operator<<(RelPersistence &s, const Pgsql::Value &v);
|
|
|
|
|
|
|
|
|
|
|
|
enum class RelKind {
|
|
|
|
|
|
Table, // r
|
|
|
|
|
|
Index, // i
|
|
|
|
|
|
Sequence, // S
|
|
|
|
|
|
View, // v
|
|
|
|
|
|
MaterializedView, // m
|
|
|
|
|
|
Composite, // c
|
|
|
|
|
|
Toast, // t
|
|
|
|
|
|
ForeignTable // f
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void operator<<(RelKind &s, const Pgsql::Value &v);
|
|
|
|
|
|
|
2018-01-08 20:45:52 +01:00
|
|
|
|
|
2018-11-25 19:45:06 +01:00
|
|
|
|
class PgClass: public PgNamespaceObject, public PgOwnedObject {
|
2017-02-01 18:01:02 +01:00
|
|
|
|
public:
|
|
|
|
|
|
|
2018-11-25 19:45:06 +01:00
|
|
|
|
// Oid oid = InvalidOid;
|
|
|
|
|
|
// QString name;
|
|
|
|
|
|
// Oid relnamespace = InvalidOid;
|
|
|
|
|
|
// QString relnamespace_name; // Transient, cached value from relnamespace
|
|
|
|
|
|
// bool system_namespace = false; // Transient, cached value from relnamespace
|
2017-12-10 10:35:46 +01:00
|
|
|
|
Oid type = InvalidOid;
|
|
|
|
|
|
Oid oftype = InvalidOid;
|
2018-11-25 19:45:06 +01:00
|
|
|
|
//Oid owner = InvalidOid;
|
2017-12-10 10:35:46 +01:00
|
|
|
|
Oid am = InvalidOid;
|
|
|
|
|
|
Oid filenode = InvalidOid;
|
|
|
|
|
|
Oid tablespace = InvalidOid;
|
2017-12-25 10:31:58 +01:00
|
|
|
|
int32_t pages_est = 0;
|
2017-12-10 10:35:46 +01:00
|
|
|
|
float tuples_est = 0.0f;
|
|
|
|
|
|
Oid toastrelid = InvalidOid;
|
|
|
|
|
|
bool isshared = false;
|
|
|
|
|
|
RelPersistence persistence;
|
|
|
|
|
|
RelKind kind;
|
|
|
|
|
|
bool hasoids = false;
|
|
|
|
|
|
bool ispopulated;
|
|
|
|
|
|
int frozenxid;
|
|
|
|
|
|
int minmxid;
|
2018-11-25 09:06:01 +01:00
|
|
|
|
QString acl;
|
2018-09-02 10:30:30 +00:00
|
|
|
|
std::vector<QString> options;
|
2017-12-10 10:35:46 +01:00
|
|
|
|
|
2018-11-25 19:45:06 +01:00
|
|
|
|
using PgNamespaceObject::PgNamespaceObject;
|
|
|
|
|
|
|
|
|
|
|
|
// virtual QString objectName() const override;
|
|
|
|
|
|
|
|
|
|
|
|
// bool operator==(Oid _oid) const { return oid == _oid; }
|
|
|
|
|
|
// bool operator==(const QString &n) const { return objectName() == n; }
|
|
|
|
|
|
// bool operator<(Oid _oid) const { return oid < _oid; }
|
|
|
|
|
|
// bool operator<(const PgClass &rhs) const { return oid < rhs.oid; }
|
2017-02-01 18:01:02 +01:00
|
|
|
|
|
2018-11-30 18:41:38 +01:00
|
|
|
|
QString createSql() const;
|
2018-12-24 11:31:56 +01:00
|
|
|
|
QString typeName() const override;
|
2018-11-30 18:41:38 +01:00
|
|
|
|
|
2018-01-08 20:45:52 +01:00
|
|
|
|
private:
|
2018-11-30 18:41:38 +01:00
|
|
|
|
mutable QString createSqlCache;
|
|
|
|
|
|
|
|
|
|
|
|
QString createTableSql() const;
|
2017-02-01 18:01:02 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // PGCLASS_H
|