pg_trigger
This commit is contained in:
parent
ae86fef2b4
commit
7c7e72ae14
5 changed files with 90 additions and 2 deletions
6
pglablib/PgTrigger.cpp
Normal file
6
pglablib/PgTrigger.cpp
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#include "PgTrigger.h"
|
||||
|
||||
PgTrigger::PgTrigger()
|
||||
{
|
||||
|
||||
}
|
||||
28
pglablib/PgTrigger.h
Normal file
28
pglablib/PgTrigger.h
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef PGTRIGGER_H
|
||||
#define PGTRIGGER_H
|
||||
|
||||
#include "Pgsql_Value.h"
|
||||
#include <QString>
|
||||
#include <libpq-fe.h>
|
||||
|
||||
class PgTrigger {
|
||||
public:
|
||||
Oid tgrelid;
|
||||
QString tgname;
|
||||
Oid tgfoid;
|
||||
int16_t tgtype;
|
||||
char tgenabled;
|
||||
bool tgisinternal;
|
||||
Oid tgconstrrelid;
|
||||
Oid tgconstrindid;
|
||||
Oid tgconstraint;
|
||||
bool tgdeferrable;
|
||||
bool tginitdeferred;
|
||||
int16_t tgnargs;
|
||||
QString tgattr;
|
||||
QString tgargs;
|
||||
QString tgqual;
|
||||
|
||||
};
|
||||
|
||||
#endif // PGTRIGGER_H
|
||||
21
pglablib/PgTriggerContainer.cpp
Normal file
21
pglablib/PgTriggerContainer.cpp
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#include "PgTriggerContainer.h"
|
||||
#include "Pgsql_Connection.h"
|
||||
#include "Pgsql_Col.h"
|
||||
|
||||
|
||||
std::string PgTriggerContainer::getLoadQuery() const
|
||||
{
|
||||
return R"(SELECT *
|
||||
FROM pg_trigger
|
||||
WHERE NOT tgisinternal)";
|
||||
}
|
||||
|
||||
PgTrigger PgTriggerContainer::loadElem(const Pgsql::Row &row)
|
||||
{
|
||||
Pgsql::Col col(row);
|
||||
PgTrigger v;
|
||||
col >> v.tgrelid >> v.tgname >> v.tgfoid >> v.tgtype >> v.tgenabled >> v.tgisinternal >> v.tgconstrrelid
|
||||
>> v.tgconstrindid >> v.tgconstraint >> v.tgdeferrable >> v.tginitdeferred >> v.tgnargs >> v.tgattr
|
||||
>> v.tgargs >> v.tgqual;
|
||||
return v;
|
||||
}
|
||||
25
pglablib/PgTriggerContainer.h
Normal file
25
pglablib/PgTriggerContainer.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef PGTRIGGERCONTAINER_H
|
||||
#define PGTRIGGERCONTAINER_H
|
||||
|
||||
#include "PgContainer.h"
|
||||
#include "PgTrigger.h"
|
||||
|
||||
namespace Pgsql {
|
||||
|
||||
class Result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
class PgTriggerContainer: public PgContainer<PgTrigger> {
|
||||
public:
|
||||
using PgContainer<PgTrigger>::PgContainer;
|
||||
|
||||
virtual std::string getLoadQuery() const override;
|
||||
protected:
|
||||
PgTrigger loadElem(const Pgsql::Row &row) override;
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
#endif // PGTRIGGERCONTAINER_H
|
||||
|
|
@ -61,7 +61,11 @@ codebuilder/DefaultConfigs.cpp \
|
|||
codebuilder/TypeMappings.cpp \
|
||||
codebuilder/IndentationConfig.cpp \
|
||||
codebuilder/StructureTemplate.cpp \
|
||||
FormatToStream.cpp
|
||||
FormatToStream.cpp \
|
||||
codebuilder/StringLiteralRules.cpp \
|
||||
codebuilder/StringEscapeRule.cpp \
|
||||
PgTrigger.cpp \
|
||||
PgTriggerContainer.cpp
|
||||
|
||||
HEADERS += \
|
||||
Pglablib.h \
|
||||
|
|
@ -105,7 +109,11 @@ codebuilder/TypeMappings.h \
|
|||
codebuilder/IndentationConfig.h \
|
||||
codebuilder/StructureTemplate.h \
|
||||
FormatToStream.h \
|
||||
codebuilder/ResultLoopTemplate.h
|
||||
codebuilder/ResultLoopTemplate.h \
|
||||
codebuilder/StringEscapeRule.h \
|
||||
codebuilder/StringLiteralRules.h \
|
||||
PgTrigger.h \
|
||||
PgTriggerContainer.h
|
||||
|
||||
unix {
|
||||
target.path = /usr/lib
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue