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:
eelke 2018-11-18 19:30:45 +01:00
parent 35813ae926
commit fcb191f2cc
44 changed files with 797 additions and 404 deletions

View file

@ -26,22 +26,23 @@ TypeMappingResult TypeMappings::getTypeForOid(Oid oid) const
if (res != m_typeMap.end()) {
QString dbtypename;
if (m_types) {
PgType type = m_types->getByKey(oid);
dbtypename = type.name;
const PgType* type = m_types->getByKey(oid);
if (type)
dbtypename = type->name;
}
return { res->second, dbtypename };
}
if (m_types) {
PgType type = m_types->getByKey(oid);
const PgType *type = m_types->getByKey(oid);
// Found a valid type? elem is set? then it is array type
if (type.oid != InvalidOid && type.elem != InvalidOid) {
if (type && type->elem != InvalidOid) {
// Lookup what the element type is and wrap the mapping for that in the standard container type
// for the language config. If that isn't right the end user should create a specific mapping for
// that array type.
res = m_typeMap.find(type.elem);
PgType elem_type = m_types->getByKey(type.elem);
res = m_typeMap.find(type->elem);
const PgType *elem_type = m_types->getByKey(type->elem);
QString type_string;
if (res == m_typeMap.end()) {
type_string = m_defaultStringType;
@ -51,11 +52,11 @@ TypeMappingResult TypeMappings::getTypeForOid(Oid oid) const
}
return {
QString(m_defaultContainerType).arg(type_string),
elem_type.name + "[]"
elem_type->name + "[]"
};
}
else {
return { m_defaultStringType, type.name };
return { m_defaultStringType, type->name };
}
}
// We shouldn't get here unless m_types is empty