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

@ -1,13 +1,14 @@
#ifndef PGTRIGGER_H
#define PGTRIGGER_H
#include "PgSchemaObject.h"
#include "Pgsql_Value.h"
#include <QString>
#include <libpq-fe.h>
class PgDatabaseCatalog;
class PgTrigger {
class PgTrigger: public PgSchemaObject {
public:
Oid oid = InvalidOid;
Oid relid;
@ -24,7 +25,14 @@ public:
int16_t nargs;
QString attr;
QString args;
QString qual;
QString whenclause;
QString oldtable; // >= 10.0
QString newtable; // >= 10.0
using PgSchemaObject::PgSchemaObject;
virtual QString objectName() const override;
bool operator==(Oid _oid) const { return oid == _oid; }
bool operator==(const QString &n) const { return name == n; }
@ -39,20 +47,22 @@ public:
static constexpr int TriggerTypeTruncate = (1 << 5);
static constexpr int TriggerTypeInstead = (1 << 6);
QString dropSql(const PgDatabaseCatalog &catalog);
QString createSql(const PgDatabaseCatalog &catalog);
QString dropSql();
QString createSql();
bool isRow() const { return type & TriggerTypeRow; }
bool isBefore() const { return type & TriggerTypeBefore; }
QString typeFireWhen() const;
QString eventAbbr() const;
QString event() const;
QString forEach() const;
QString procedure() const;
//wxString pgTrigger::GetForEach() const
//{
// return (triggerType & TRIGGER_TYPE_ROW) ? wxT("ROW") : wxT("STATEMENT");
//}
QString arguments() const;
private:
mutable QString m_dropSql; // cache
mutable QString m_createSql; // cache