Overview of triggers extended with function name and arguments.
Did a lot of refactoring on the catalog to keep things clean.
This commit is contained in:
parent
35813ae926
commit
fcb191f2cc
44 changed files with 797 additions and 404 deletions
|
|
@ -27,9 +27,9 @@ QString getRoleNameFromOid(const PgDatabaseCatalog &cat, Oid oid)
|
|||
QString name;
|
||||
auto auth_ids = cat.authIds();
|
||||
if (auth_ids) {
|
||||
const PgAuthId& auth_id = auth_ids->getByKey(oid);
|
||||
if (auth_id.valid()) {
|
||||
name = auth_id.name;
|
||||
const PgAuthId* auth_id = auth_ids->getByKey(oid);
|
||||
if (auth_id) {
|
||||
name = auth_id->name;
|
||||
}
|
||||
}
|
||||
return name;
|
||||
|
|
@ -46,7 +46,8 @@ QString getNamespaceDisplayString(const PgDatabaseCatalog &cat, Oid oid)
|
|||
QString result;
|
||||
auto nss = cat.namespaces();
|
||||
auto ns = nss->getByKey(oid);
|
||||
result = ns.name; //QString("ns %1").arg(oid);
|
||||
if (ns)
|
||||
result = ns->name; //QString("ns %1").arg(oid);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -55,7 +56,8 @@ QString getClassDisplayString(const PgDatabaseCatalog &cat, Oid oid)
|
|||
QString result;
|
||||
auto l = cat.classes();
|
||||
auto e = l->getByKey(oid);
|
||||
result = e.name;
|
||||
if (e)
|
||||
result = e->name;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
|
@ -75,13 +77,13 @@ QString getTablespaceDisplayString(const PgDatabaseCatalog &cat, Oid oid)
|
|||
// TODO load list and lookup name
|
||||
if (oid == 0) {
|
||||
auto dbname = cat.getDBName();
|
||||
oid = cat.databases()->getByName(dbname).tablespace;
|
||||
oid = cat.databases()->getByName(dbname)->tablespace;
|
||||
auto ts = cat.tablespaces()->getByKey(oid);
|
||||
return ts.name + " (inherited)";
|
||||
return ts->name + " (inherited)";
|
||||
}
|
||||
else {
|
||||
auto ts = cat.tablespaces()->getByKey(oid);
|
||||
return ts.name;
|
||||
return ts->name;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -93,18 +95,18 @@ QString getTypeDisplayString(const PgDatabaseCatalog &cat, Oid oid, int32_t typm
|
|||
|
||||
auto tc = cat.types();
|
||||
auto t = tc->getByKey(oid);
|
||||
if (t.oid == InvalidOid) {
|
||||
if (t == nullptr) {
|
||||
return "(invalid/unknown)";
|
||||
}
|
||||
QString s;
|
||||
if (t.category == TypCategory::Array) {
|
||||
if (t->category == TypCategory::Array) {
|
||||
// auto et = tc->getByKey(t.elem);
|
||||
// s = et.name;
|
||||
s = getTypeDisplayString(cat, t.elem, typmod);
|
||||
s = getTypeDisplayString(cat, t->elem, typmod);
|
||||
s += "[]";
|
||||
}
|
||||
else {
|
||||
s = t.name;
|
||||
s = t->name;
|
||||
switch (oid) {
|
||||
case varchar_oid:
|
||||
case char_oid:
|
||||
|
|
@ -198,7 +200,7 @@ void PgDatabaseCatalog::loadInfo(Pgsql::Connection &conn)
|
|||
m_dbName = conn.getDBName();
|
||||
}
|
||||
|
||||
void load(Pgsql::Connection &conn, IPgContainter &pg_cont)
|
||||
void load(Pgsql::Connection &conn, IPgContainer &pg_cont)
|
||||
{
|
||||
//QThread::msleep(400);
|
||||
std::string q = pg_cont.getLoadQuery();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue