#ifndef PGTRIGGER_H #define PGTRIGGER_H #include "Pgsql_Value.h" #include #include class PgDatabaseCatalog; class PgTrigger { public: Oid oid = InvalidOid; Oid relid; QString name; Oid foid; int16_t type; char enabled; bool isinternal; Oid constrrelid; Oid constrindid; Oid constraint; bool deferrable; bool initdeferred; int16_t nargs; QString attr; QString args; QString qual; 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 PgTrigger &rhs) const { return oid < rhs.oid; } static constexpr int TriggerTypeRow = (1 << 0); static constexpr int TriggerTypeBefore = (1 << 1); static constexpr int TriggerTypeInsert = (1 << 2); static constexpr int TriggerTypeDelete = (1 << 3); static constexpr int TriggerTypeUpdate = (1 << 4); static constexpr int TriggerTypeTruncate = (1 << 5); static constexpr int TriggerTypeInstead = (1 << 6); QString dropSql(const PgDatabaseCatalog &catalog); QString createSql(const PgDatabaseCatalog &catalog); bool isRow() const { return type & TriggerTypeRow; } bool isBefore() const { return type & TriggerTypeBefore; } QString typeFireWhen() const; QString eventAbbr() const; QString event() const; QString forEach() const; //wxString pgTrigger::GetForEach() const //{ // return (triggerType & TRIGGER_TYPE_ROW) ? wxT("ROW") : wxT("STATEMENT"); //} private: mutable QString m_dropSql; // cache mutable QString m_createSql; // cache }; #endif // PGTRIGGER_H