#ifndef PGPROC_H #define PGPROC_H #include "PgNamespaceObject.h" #include "PgOwnedObject.h" #include #include #include "Pgsql_Value.h" #include class Arg { public: enum Mode { In, Out, InOut, Variadic, Table }; Oid type; Mode mode; QString name; QString def; Arg(Oid t, Mode m, QString n, QString d) : type(t), mode(m), name(n), def(d) {} }; class PgProc: public PgNamespaceObject, public PgOwnedObject { public: using PgNamespaceObject::PgNamespaceObject; // Oid oid = InvalidOid; // oid // QString name; // name // Oid pronamespace = InvalidOid; // oid, namespace // Oid owner = InvalidOid; // oid Oid lang = InvalidOid; // oid float cost = 0.f; // float4 float rows = 0.f; // float4 Oid variadic = InvalidOid; // oid QString transform; // regproc bool isagg = false; // bool bool iswindow = false; // bool bool secdef = false; // bool bool leakproof = false; // bool bool isstrict = false; // bool bool retset = false; // bool char provolatile = '\0'; // char char parallel = '\0'; // char, version >= 9.6 int16_t nargs = 0; // int2 int16_t nargdefaults; // = 0; // int2 Oid rettype = InvalidOid; // oid std::vector trftypes; // oid[], version >= 9.5 QString src; // text QString bin; // text std::vector config; // text[] QString acl; // aclitem[] /// Converts the collection of arrays about the arguments to a single list of arguments /// making it much easier to work with them correctly void setArgs( std::vector argtypes, std::vector allargtypes, std::vector argmodes, std::vector argnames, std::optional argdefaults ); const std::vector& args() const; // 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 PgProc &rhs) const { return oid < rhs.oid; } QString createSql() const; QString argListWithNames(bool multiline = false) const; QString argSigList(const bool forScript = false) const; // bool isTrigger() const // { // return typname == wxT("\"trigger\"") || typname == wxT("trigger") || typname == wxT("event_trigger") || typname == wxT("\"event_trigger\"")) // } private: mutable QString createSqlCache; std::vector m_args; }; #endif // PGPROC_H