1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271
|
//////////////////////////////////////////////////////////////////////////
//
// pgAdmin III - PostgreSQL Tools
//
// Copyright (C) 2002 - 2014, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
// pgTrigger.h PostgreSQL Trigger
//
//////////////////////////////////////////////////////////////////////////
#ifndef PGTRIGGER_H
#define PGTRIGGER_H
#include "pgTable.h"
class pgFunction;
class pgTriggerObject : public pgSchemaObject
{
public:
pgTriggerObject(pgSchema *newSchema, pgaFactory &factory, const wxString &newName = wxEmptyString) : pgSchemaObject(newSchema, factory, newName) {}
wxString GetFormattedDefinition();
wxString GetDefinition() const
{
return definition;
}
void iSetDefinition(const wxString &s)
{
definition = s;
}
protected:
wxString definition;
};
class pgTriggerFactory : public pgSchemaObjFactory
{
public:
pgTriggerFactory();
virtual dlgProperty *CreateDialog(frmMain *frame, pgObject *node, pgObject *parent);
virtual pgObject *CreateObjects(pgCollection *obj, ctlTree *browser, const wxString &restr = wxEmptyString);
virtual pgCollection *CreateCollection(pgObject *obj);
int GetClosedIconId()
{
return closedId;
}
protected:
int closedId;
};
extern pgTriggerFactory triggerFactory;
class pgTrigger : public pgTriggerObject
{
public:
pgTrigger(pgSchema *newSchema, const wxString &newName = wxT(""));
~pgTrigger();
int GetIconId();
wxString GetTranslatedMessage(int kindOfMessage) const;
void ShowTreeDetail(ctlTree *browser, frmMain *form = 0, ctlListView *properties = 0, ctlSQLBox *sqlPane = 0);
bool CanDropCascaded()
{
return !GetSystemObject() && pgSchemaObject::CanDrop();
}
wxString GetFireWhen() const;
wxString GetEvent() const;
wxString GetForEach() const;
wxString GetFunction() const
{
return function;
}
void iSetFunction(const wxString &s)
{
function = s;
}
void iSetArguments(const wxString &s)
{
arguments = s;
}
wxString GetArguments() const
{
return arguments;
}
void iSetWhen(const wxString &s)
{
when = s;
}
wxString GetWhen() const
{
return when;
}
bool GetIsConstraint() const
{
return isconstraint;
}
void SetIsConstraint(const bool b)
{
isconstraint = b;
}
bool GetDeferrable() const
{
return deferrable;
}
void iSetDeferrable(const bool b)
{
deferrable = b;
}
bool GetDeferred() const
{
return deferred;
}
void iSetDeferred(const bool b)
{
deferred = b;
}
wxString GetLanguage() const
{
return language;
}
void iSetLanguage(const wxString &s)
{
language = s;
}
wxString GetSource() const
{
return source;
}
void iSetSource(const wxString &s)
{
source = s;
}
long GetTriggerType() const
{
return triggerType;
}
void iSetTriggerType(const long l)
{
triggerType = l;
}
bool GetEnabled() const
{
return enabled;
}
void SetEnabled(ctlTree *browser, const bool b);
void iSetEnabled(const bool b)
{
enabled = b;
}
void iSetTriggerFunction(pgFunction *fkt)
{
triggerFunction = fkt;
}
wxString GetQuotedFullTable() const
{
return quotedFullTable;
}
void iSetQuotedFullTable(const wxString &s)
{
quotedFullTable = s;
}
OID GetFunctionOid() const
{
return functionOid;
}
void iSetFunctionOid(const OID d)
{
functionOid = d;
}
OID GetRelationOid() const
{
return relationOid;
}
void iSetRelationOid(const OID d)
{
relationOid = d;
}
wxString GetQuotedColumns() const
{
return quotedColumns;
}
wxString GetColumns() const
{
return columns;
}
wxArrayString GetColumnList() const
{
return columnList;
}
long GetColumnCount() const
{
return columnCount;
}
void iSetColumnCount(const long l)
{
columnCount = l;
}
void iSetParentIsTable(const bool b)
{
parentistable = b;
}
bool GetParentIsTable()
{
return parentistable;
}
void SetDirty();
bool DropObject(wxFrame *frame, ctlTree *browser, bool cascaded);
wxString GetSql(ctlTree *browser);
bool CanRestore()
{
return true;
}
pgObject *Refresh(ctlTree *browser, const wxTreeItemId item);
bool HasStats()
{
return false;
}
bool HasDepends()
{
return true;
}
bool HasReferences()
{
return true;
}
bool IsUpToDate();
protected:
void ReadColumnDetails();
private:
wxString function, quotedFullTable, arguments, when, language, source, columns, quotedColumns;
wxArrayString columnList;
long columnCount;
OID functionOid, relationOid;
long triggerType;
bool enabled, parentistable, isconstraint, deferrable, deferred;
pgFunction *triggerFunction;
};
class pgTriggerCollection : public pgSchemaObjCollection
{
public:
pgTriggerCollection(pgaFactory *factory, pgSchema *sch);
wxString GetTranslatedMessage(int kindOfMessage) const;
};
class enabledisableTriggerFactory : public contextActionFactory
{
public:
enabledisableTriggerFactory(menuFactoryList *list, wxMenu *mnu, ctlMenuToolbar *toolbar);
wxWindow *StartDialog(frmMain *form, pgObject *obj);
bool CheckEnable(pgObject *obj);
bool CheckChecked(pgObject *obj);
};
#endif
|