Removed the acl field from several Pg* classes as the acl is now stored in the PgServerObject base class they inherit from.

This commit is contained in:
eelke 2018-12-27 12:05:48 +01:00
parent aaa05f64ef
commit 93687df959
12 changed files with 30 additions and 30 deletions

View file

@ -141,7 +141,7 @@ QVariant DatabasesTableModel::getData(const QModelIndex &index) const
v = db.tablespace; v = db.tablespace;
break; break;
case AclCol: case AclCol:
v = db.acl; v = db.aclString();
break; break;
} }
} }

View file

@ -143,7 +143,7 @@ QVariant TablesTableModel::getData(const QModelIndex &index) const
case OwnerCol: return t.ownerName(); case OwnerCol: return t.ownerName();
case TablespaceCol: return getTablespaceDisplayString(*m_catalog, t.tablespace); case TablespaceCol: return getTablespaceDisplayString(*m_catalog, t.tablespace);
case OptionsCol: break; case OptionsCol: break;
case AclCol: return t.acl; case AclCol: return t.aclString();
} }
return QVariant(); return QVariant();

View file

@ -52,7 +52,6 @@ public:
bool ispopulated; bool ispopulated;
int frozenxid; int frozenxid;
int minmxid; int minmxid;
QString acl;
std::vector<QString> options; std::vector<QString> options;
using PgNamespaceObject::PgNamespaceObject; using PgNamespaceObject::PgNamespaceObject;

View file

@ -11,7 +11,7 @@ std::string PgClassContainer::getLoadQuery() const
" relowner, relam, relfilenode, reltablespace, relpages, " " relowner, relam, relfilenode, reltablespace, relpages, "
" reltuples, reltoastrelid, relisshared, relpersistence, " " reltuples, reltoastrelid, relisshared, relpersistence, "
" relkind, relhasoids, relispopulated, relfrozenxid, relminmxid, " " relkind, relhasoids, relispopulated, relfrozenxid, relminmxid, "
" relacl, reloptions \n" " reloptions, relacl \n"
"FROM pg_catalog.pg_class"; "FROM pg_catalog.pg_class";
} }
@ -28,12 +28,12 @@ PgClass PgClassContainer::loadElem(const Pgsql::Row &row)
>> owner >> v.am >> v.filenode >> v.tablespace >> v.pages_est >> owner >> v.am >> v.filenode >> v.tablespace >> v.pages_est
>> v.tuples_est >> v.toastrelid >> v.isshared >> v.persistence >> v.tuples_est >> v.toastrelid >> v.isshared >> v.persistence
>> v.kind >> v.hasoids >> v.ispopulated >> v.frozenxid >> v.minmxid >> v.kind >> v.hasoids >> v.ispopulated >> v.frozenxid >> v.minmxid
>> v.acl >> v.options; >> v.options;
v.setOwnerOid(owner); v.setOwnerOid(owner);
// auto&& ns = m_catalog.namespaces()->getByKey(v.relnamespace);
// if (ns) { AclList acl_list;
// v.relnamespace_name = ns->objectName(); col >> acl_list;
// v.system_namespace = ns->isSystemCatalog(); v.setAcls(std::move(acl_list));
// }
return v; return v;
} }

View file

@ -16,7 +16,6 @@ public:
bool allowConn; bool allowConn;
int connLimit; int connLimit;
Oid tablespace; Oid tablespace;
QString acl;//"ARRAY";"YES"
using PgServerObject::PgServerObject; using PgServerObject::PgServerObject;

View file

@ -15,7 +15,12 @@ PgDatabase PgDatabaseContainer::loadElem(const Pgsql::Row &row)
QString name = col.nextValue(); QString name = col.nextValue();
PgDatabase v(m_catalog, oid, name); PgDatabase v(m_catalog, oid, name);
col >> v.dba >> v.encoding >> v.collate >> v.ctype >> v.isTemplate col >> v.dba >> v.encoding >> v.collate >> v.ctype >> v.isTemplate
>> v.allowConn >> v.connLimit >> v.tablespace >> v.acl; >> v.allowConn >> v.connLimit >> v.tablespace;
AclList acl_list;
col >> acl_list;
v.setAcls(std::move(acl_list));
return v; return v;
} }

View file

@ -17,7 +17,6 @@ public:
Oid plcallfoid; Oid plcallfoid;
Oid inline_; Oid inline_;
Oid validator; Oid validator;
QString acl;
using PgDatabaseObject::PgDatabaseObject; using PgDatabaseObject::PgDatabaseObject;

View file

@ -14,9 +14,13 @@ PgLanguage PgLanguageContainer::loadElem(const Pgsql::Row &row)
Pgsql::Col col(row); Pgsql::Col col(row);
Oid lan_oid = col.nextValue(); Oid lan_oid = col.nextValue();
QString name = col.nextValue(); QString name = col.nextValue();
Oid owner = col.nextValue();
PgLanguage v(m_catalog, lan_oid, name); PgLanguage v(m_catalog, lan_oid, name);
col >> v.ispl >> v.pltrusted >> v.plcallfoid >> v.inline_ >> v.validator >> v.acl; Oid owner;
AclList acl_list;
col >> owner >> v.ispl >> v.pltrusted >> v.plcallfoid >> v.inline_ >> v.validator >> acl_list;
v.setOwnerOid(owner); v.setOwnerOid(owner);
v.setAcls(std::move(acl_list));
return v; return v;
} }

View file

@ -9,9 +9,6 @@
/// Object representing a namespace within a database /// Object representing a namespace within a database
class PgNamespace: public PgDatabaseObject { class PgNamespace: public PgDatabaseObject {
public: public:
Oid owner = InvalidOid;
QString acl;
using PgDatabaseObject::PgDatabaseObject; using PgDatabaseObject::PgDatabaseObject;
bool isSystemCatalog() const; bool isSystemCatalog() const;

View file

@ -15,7 +15,12 @@ PgNamespace PgNamespaceContainer::loadElem(const Pgsql::Row &row)
Oid oid = col.nextValue(); Oid oid = col.nextValue();
QString name = col.nextValue(); QString name = col.nextValue();
PgNamespace v(m_catalog, oid, name); PgNamespace v(m_catalog, oid, name);
col >> v.owner >> v.acl; Oid owner;
AclList acl_list;
col >> owner >> acl_list;
v.setOwnerOid(owner);
v.setAcls(std::move(acl_list));
return v; return v;
} }

View file

@ -29,11 +29,7 @@ void operator<<(TypCategory &s, const Pgsql::Value &v);
class PgType: public PgNamespaceObject { class PgType: public PgNamespaceObject {
public: public:
// Oid oid = InvalidOid;
// QString name; // formatted name as per database, arrays
QString typname; //"name";"NO" QString typname; //"name";"NO"
// Oid typnamespace = InvalidOid;//"oid";"NO"
// Oid owner = InvalidOid;//"oid";"NO"
short len = -1;//"smallint";"NO" short len = -1;//"smallint";"NO"
bool byval = false;//"boolean";"NO" bool byval = false;//"boolean";"NO"
QString type;//""char"";"NO" QString type;//""char"";"NO"
@ -60,16 +56,10 @@ public:
Oid collation = InvalidOid;//"oid";"NO" Oid collation = InvalidOid;//"oid";"NO"
QString defaultbin;//"pg_node_tree";"YES" QString defaultbin;//"pg_node_tree";"YES"
QString typdefault;//"text";"YES" QString typdefault;//"text";"YES"
QString acl;//"ARRAY";"YES"
using PgNamespaceObject::PgNamespaceObject; using PgNamespaceObject::PgNamespaceObject;
QString typeName() const override; 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 PgType &rhs) const { return oid < rhs.oid; }
}; };
#endif // PGTYPE_H #endif // PGTYPE_H

View file

@ -22,10 +22,12 @@ PgType PgTypeContainer::loadElem(const Pgsql::Row &row)
Oid ns_oid = col.nextValue(); Oid ns_oid = col.nextValue();
Oid owner = col.nextValue(); Oid owner = col.nextValue();
PgType v(m_catalog, type_oid, name, ns_oid); PgType v(m_catalog, type_oid, name, ns_oid);
AclList acl_list;
col >> v.typname >> v.len >> v.byval >> v.type >> v.category col >> v.typname >> v.len >> v.byval >> v.type >> v.category
>> v.ispreferred >> v.isdefined >> v.delim >> v.relid >> v.elem >> v.array >> v.input >> v.output >> v.ispreferred >> v.isdefined >> v.delim >> v.relid >> v.elem >> v.array >> v.input >> v.output
>> v.receive >> v.send >> v.modin >> v.modout >> v.analyze >> v.align >> v.storage >> v.notnull >> v.receive >> v.send >> v.modin >> v.modout >> v.analyze >> v.align >> v.storage >> v.notnull
>> v.basetype >> v.typmod >> v.ndims >> v.collation >> v.defaultbin >> v.typdefault >> v.acl; >> v.basetype >> v.typmod >> v.ndims >> v.collation >> v.defaultbin >> v.typdefault >> acl_list;
v.setOwnerOid(owner); v.setOwnerOid(owner);
v.setAcls(std::move(acl_list));
return v; return v;
} }