mirror of
https://github.com/levinsv/pgadmin3.git
synced 2026-05-16 14:15:50 -06:00
support PG11
Поддержка PostgreSQL 11 только для Windows
This commit is contained in:
commit
4af765213c
1765 changed files with 407959 additions and 0 deletions
2
include/.gitignore
vendored
Normal file
2
include/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# Global excludes across all subdirectories
|
||||
svnversion.h
|
||||
61
include/agent/dlgJob.h
Normal file
61
include/agent/dlgJob.h
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// dlgJob.h - Job property
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef __DLG_JOBPROP
|
||||
#define __DLG_JOBPROP
|
||||
|
||||
#include "dlg/dlgProperty.h"
|
||||
|
||||
class pgaJob;
|
||||
|
||||
class dlgJob : public dlgAgentProperty
|
||||
{
|
||||
public:
|
||||
dlgJob(pgaFactory *factory, frmMain *frame, pgaJob *j);
|
||||
|
||||
void CheckChange();
|
||||
int Go(bool modal);
|
||||
|
||||
wxString GetUpdateSql();
|
||||
wxString GetInsertSql();
|
||||
pgObject *CreateObject(pgCollection *collection);
|
||||
pgObject *GetObject();
|
||||
|
||||
wxString GetHelpPage(bool forCreate) const
|
||||
{
|
||||
return wxT("pgagent-jobs");
|
||||
}
|
||||
|
||||
private:
|
||||
pgaJob *job;
|
||||
|
||||
wxArrayString previousSteps, previousSchedules;
|
||||
|
||||
#ifdef __WXMAC__
|
||||
void OnChangeSize(wxSizeEvent &ev);
|
||||
#endif
|
||||
|
||||
void OnSelChangeStep(wxListEvent &ev);
|
||||
void OnChangeStep(wxCommandEvent &ev);
|
||||
void OnAddStep(wxCommandEvent &ev);
|
||||
void OnRemoveStep(wxCommandEvent &ev);
|
||||
|
||||
void OnSelChangeSchedule(wxListEvent &ev);
|
||||
void OnChangeSchedule(wxCommandEvent &ev);
|
||||
void OnAddSchedule(wxCommandEvent &ev);
|
||||
void OnRemoveSchedule(wxCommandEvent &ev);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
92
include/agent/dlgSchedule.h
Normal file
92
include/agent/dlgSchedule.h
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// dlgSchedule.h - Job property
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef __DLG_SCHEDULEPROP
|
||||
#define __DLG_SCHEDULEPROP
|
||||
|
||||
#include "dlg/dlgProperty.h"
|
||||
#include "ctl/timespin.h"
|
||||
#include "ctl/calbox.h"
|
||||
|
||||
class pgaSchedule;
|
||||
class pgaJob;
|
||||
|
||||
class dlgSchedule : public dlgAgentProperty
|
||||
{
|
||||
public:
|
||||
dlgSchedule(pgaFactory *factory, frmMain *frame, pgaSchedule *s, pgaJob *j);
|
||||
|
||||
void CheckChange();
|
||||
int Go(bool modal);
|
||||
|
||||
wxString GetComment();
|
||||
wxString GetUpdateSql();
|
||||
wxString GetInsertSql();
|
||||
pgObject *CreateObject(pgCollection *collection);
|
||||
pgObject *GetObject();
|
||||
void SetJobId(long id)
|
||||
{
|
||||
jobId = id;
|
||||
}
|
||||
|
||||
wxString GetHelpPage(bool forCreate) const
|
||||
{
|
||||
return wxT("pgagent-schedules");
|
||||
}
|
||||
|
||||
private:
|
||||
long jobId;
|
||||
pgaSchedule *schedule;
|
||||
pgaJob *job;
|
||||
|
||||
wxArrayString deleteExceptions;
|
||||
|
||||
#ifdef __WXMAC__
|
||||
void OnChangeSize(wxSizeEvent &ev);
|
||||
#endif
|
||||
|
||||
void OnChangeCom(wxCommandEvent &ev);
|
||||
void OnChangeCal(wxCalendarEvent &ev);
|
||||
void OnSelChangeException(wxListEvent &ev);
|
||||
void OnAddException(wxCommandEvent &ev);
|
||||
void OnChangeException(wxCommandEvent &ev);
|
||||
void OnRemoveException(wxCommandEvent &ev);
|
||||
const wxString ChkListBox2PgArray(wxCheckListBox *lb);
|
||||
const wxString ChkListBox2StrArray(wxCheckListBox *lb);
|
||||
void OnSelectAll(wxCommandEvent &ev, int origin);
|
||||
void OnSelectAllWeekdays(wxCommandEvent &ev)
|
||||
{
|
||||
OnSelectAll(ev, 1);
|
||||
};
|
||||
void OnSelectAllMonthdays(wxCommandEvent &ev)
|
||||
{
|
||||
OnSelectAll(ev, 2);
|
||||
};
|
||||
void OnSelectAllMonths(wxCommandEvent &ev)
|
||||
{
|
||||
OnSelectAll(ev, 3);
|
||||
};
|
||||
void OnSelectAllHours(wxCommandEvent &ev)
|
||||
{
|
||||
OnSelectAll(ev, 4);
|
||||
};
|
||||
void OnSelectAllMinutes(wxCommandEvent &ev)
|
||||
{
|
||||
OnSelectAll(ev, 5);
|
||||
};
|
||||
void InitSelectAll();
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
67
include/agent/dlgStep.h
Normal file
67
include/agent/dlgStep.h
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// dlgStep.h - Job property
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef __DLG_STEPPROP
|
||||
#define __DLG_STEPPROP
|
||||
|
||||
#include "dlg/dlgProperty.h"
|
||||
|
||||
class pgaStep;
|
||||
class pgaJob;
|
||||
|
||||
class dlgStep : public dlgAgentProperty
|
||||
{
|
||||
public:
|
||||
dlgStep(pgaFactory *factory, frmMain *frame, pgaStep *s, pgaJob *j);
|
||||
|
||||
void CheckChange();
|
||||
int Go(bool modal);
|
||||
|
||||
wxString GetUpdateSql();
|
||||
wxString GetInsertSql();
|
||||
wxString GetComment();
|
||||
pgObject *CreateObject(pgCollection *collection);
|
||||
pgObject *GetObject();
|
||||
|
||||
void SetObject(pgObject *obj)
|
||||
{
|
||||
step = (pgaStep *)obj;
|
||||
}
|
||||
|
||||
void SetJobId(long id)
|
||||
{
|
||||
jobId = id;
|
||||
}
|
||||
|
||||
wxString GetHelpPage(bool forCreate) const
|
||||
{
|
||||
return wxT("pgagent-steps");
|
||||
}
|
||||
|
||||
private:
|
||||
void OnSelRemoteConn(wxCommandEvent &ev);
|
||||
void OnSelLocalConn(wxCommandEvent &ev);
|
||||
void OnSelectDatabase(wxCommandEvent &ev);
|
||||
|
||||
virtual bool IsUpToDate();
|
||||
|
||||
long jobId;
|
||||
ctlSQLBox *sqlBox;
|
||||
pgaStep *step;
|
||||
pgaJob *job;
|
||||
bool hasConnStrSupport;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
22
include/agent/module.mk
Normal file
22
include/agent/module.mk
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#######################################################################
|
||||
#
|
||||
# pgAdmin III - PostgreSQL Tools
|
||||
#
|
||||
# Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
# This software is released under the PostgreSQL Licence
|
||||
#
|
||||
# module.mk - pgadmin/include/agent Makefile fragment
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
pgadmin3_SOURCES += \
|
||||
include/agent/dlgJob.h \
|
||||
include/agent/dlgSchedule.h \
|
||||
include/agent/dlgStep.h \
|
||||
include/agent/pgaJob.h \
|
||||
include/agent/pgaSchedule.h \
|
||||
include/agent/pgaStep.h
|
||||
|
||||
EXTRA_DIST += \
|
||||
include/agent/module.mk
|
||||
|
||||
226
include/agent/pgaJob.h
Normal file
226
include/agent/pgaJob.h
Normal file
|
|
@ -0,0 +1,226 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// pgaJob.h - PostgreSQL Agent Job
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef PGAJOB_H
|
||||
#define PGAJOB_H
|
||||
|
||||
#include "schema/pgServer.h"
|
||||
|
||||
|
||||
class pgaJobFactory : public pgServerObjFactory
|
||||
{
|
||||
public:
|
||||
pgaJobFactory();
|
||||
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 GetDisabledId()
|
||||
{
|
||||
return disabledId;
|
||||
}
|
||||
|
||||
protected:
|
||||
int disabledId;
|
||||
};
|
||||
extern pgaJobFactory jobFactory;
|
||||
|
||||
class pgaJob : public pgServerObject
|
||||
{
|
||||
public:
|
||||
pgaJob(const wxString &newName = wxT(""));
|
||||
|
||||
int GetIconId();
|
||||
void ShowTreeDetail(ctlTree *browser, frmMain *form = 0, ctlListView *properties = 0, ctlSQLBox *sqlPane = 0);
|
||||
void ShowStatistics(frmMain *form, ctlListView *statistics);
|
||||
pgObject *Refresh(ctlTree *browser, const wxTreeItemId item);
|
||||
bool DropObject(wxFrame *frame, ctlTree *browser, bool cascaded);
|
||||
|
||||
wxString GetTranslatedMessage(int kindOfMessage) const;
|
||||
wxString GetJobclass() const
|
||||
{
|
||||
return jobclass;
|
||||
}
|
||||
void iSetJobclass(const wxString &s)
|
||||
{
|
||||
jobclass = s;
|
||||
}
|
||||
bool GetEnabled() const
|
||||
{
|
||||
return enabled;
|
||||
}
|
||||
void iSetEnabled(const bool b)
|
||||
{
|
||||
enabled = b;
|
||||
}
|
||||
wxDateTime GetCreated() const
|
||||
{
|
||||
return created;
|
||||
}
|
||||
void iSetCreated(const wxDateTime &d)
|
||||
{
|
||||
created = d;
|
||||
}
|
||||
wxDateTime GetChanged() const
|
||||
{
|
||||
return changed;
|
||||
}
|
||||
void iSetChanged(const wxDateTime &d)
|
||||
{
|
||||
changed = d;
|
||||
}
|
||||
wxDateTime GetNextrun() const
|
||||
{
|
||||
return nextrun;
|
||||
}
|
||||
void iSetNextrun(const wxDateTime &d)
|
||||
{
|
||||
nextrun = d;
|
||||
}
|
||||
wxDateTime GetLastrun() const
|
||||
{
|
||||
return lastrun;
|
||||
}
|
||||
void iSetLastrun(const wxDateTime &d)
|
||||
{
|
||||
lastrun = d;
|
||||
}
|
||||
wxString GetLastresult() const
|
||||
{
|
||||
return lastresult;
|
||||
}
|
||||
void iSetLastresult(const wxString &s)
|
||||
{
|
||||
lastresult = s;
|
||||
}
|
||||
wxString GetCurrentAgent() const
|
||||
{
|
||||
return currentAgent;
|
||||
}
|
||||
void iSetCurrentAgent(const wxString &s)
|
||||
{
|
||||
currentAgent = s;
|
||||
}
|
||||
wxString GetHostAgent() const
|
||||
{
|
||||
return hostAgent;
|
||||
}
|
||||
void iSetHostAgent(const wxString &s)
|
||||
{
|
||||
hostAgent = s;
|
||||
}
|
||||
long GetRecId() const
|
||||
{
|
||||
return recId;
|
||||
}
|
||||
void iSetRecId(const long l)
|
||||
{
|
||||
recId = l;
|
||||
}
|
||||
bool RunNow();
|
||||
|
||||
wxMenu *GetNewMenu();
|
||||
bool CanCreate()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool CanView()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool CanEdit()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool CanDrop()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool WantDummyChild()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
wxString GetHelpPage(bool forCreate) const
|
||||
{
|
||||
return wxT("pgagent-jobs");
|
||||
}
|
||||
|
||||
private:
|
||||
bool enabled;
|
||||
wxDateTime created, changed, nextrun, lastrun;
|
||||
wxString lastresult, jobclass, currentAgent, hostAgent;
|
||||
long recId;
|
||||
};
|
||||
|
||||
|
||||
class pgaJobObject : public pgServerObject
|
||||
{
|
||||
public:
|
||||
pgaJobObject(pgaJob *job, pgaFactory &factory, const wxString &newName);
|
||||
virtual pgaJob *GetJob()
|
||||
{
|
||||
return job;
|
||||
}
|
||||
|
||||
bool CanCreate()
|
||||
{
|
||||
return job->CanCreate();
|
||||
}
|
||||
bool CanView()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool CanEdit()
|
||||
{
|
||||
return job->CanEdit();
|
||||
}
|
||||
bool CanDrop()
|
||||
{
|
||||
return job->CanDrop();
|
||||
}
|
||||
|
||||
protected:
|
||||
pgaJob *job;
|
||||
};
|
||||
|
||||
|
||||
class pgaJobCollection : public pgServerObjCollection
|
||||
{
|
||||
public:
|
||||
pgaJobCollection(pgaFactory *factory, pgServer *sv);
|
||||
wxString GetTranslatedMessage(int kindOfMessage) const;
|
||||
};
|
||||
|
||||
|
||||
class pgaJobObjCollection : public pgServerObjCollection
|
||||
{
|
||||
public:
|
||||
pgaJobObjCollection(pgaFactory *factory, pgaJob *job);
|
||||
bool CanCreate();
|
||||
};
|
||||
|
||||
class pgaJobObjFactory : public pgServerObjFactory
|
||||
{
|
||||
public:
|
||||
pgaJobObjFactory(const wxChar *tn, const wxChar *ns, const wxChar *nls, wxImage *img, wxImage *imgSm = 0)
|
||||
: pgServerObjFactory(tn, ns, nls, img, imgSm) {}
|
||||
virtual pgCollection *CreateCollection(pgObject *obj);
|
||||
};
|
||||
|
||||
class runNowFactory : public contextActionFactory
|
||||
{
|
||||
public:
|
||||
runNowFactory(menuFactoryList *list, wxMenu *mnu, ctlMenuToolbar *toolbar);
|
||||
wxWindow *StartDialog(frmMain *form, pgObject *obj);
|
||||
bool CheckEnable(pgObject *obj);
|
||||
};
|
||||
|
||||
#endif
|
||||
151
include/agent/pgaSchedule.h
Normal file
151
include/agent/pgaSchedule.h
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// pgaSchedule.h - PostgreSQL Agent Job Schedule
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef PGASCHEDULE_H
|
||||
#define PGASCHEDULE_H
|
||||
|
||||
#include "agent/pgaJob.h"
|
||||
|
||||
|
||||
class pgaScheduleFactory : public pgaJobObjFactory
|
||||
{
|
||||
public:
|
||||
pgaScheduleFactory();
|
||||
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);
|
||||
};
|
||||
extern pgaScheduleFactory scheduleFactory;
|
||||
|
||||
|
||||
class pgaSchedule : public pgaJobObject
|
||||
{
|
||||
public:
|
||||
pgaSchedule(pgCollection *collection, const wxString &newName = wxT(""));
|
||||
|
||||
wxString GetTranslatedMessage(int kindOfMessage) const;
|
||||
void ShowTreeDetail(ctlTree *browser, frmMain *form = 0, ctlListView *properties = 0, ctlSQLBox *sqlPane = 0);
|
||||
pgObject *Refresh(ctlTree *browser, const wxTreeItemId item);
|
||||
bool DropObject(wxFrame *frame, ctlTree *browser, bool cascaded);
|
||||
|
||||
bool GetEnabled() const
|
||||
{
|
||||
return enabled;
|
||||
}
|
||||
void iSetEnabled(const bool b)
|
||||
{
|
||||
enabled = b;
|
||||
}
|
||||
wxDateTime GetStart() const
|
||||
{
|
||||
return start;
|
||||
}
|
||||
void iSetStart(const wxDateTime &d)
|
||||
{
|
||||
start = d;
|
||||
}
|
||||
wxDateTime GetEnd() const
|
||||
{
|
||||
return end;
|
||||
}
|
||||
void iSetEnd(const wxDateTime &d)
|
||||
{
|
||||
end = d;
|
||||
}
|
||||
long GetRecId() const
|
||||
{
|
||||
return recId;
|
||||
}
|
||||
void iSetRecId(const long l)
|
||||
{
|
||||
recId = l;
|
||||
}
|
||||
|
||||
wxString GetMinutes() const
|
||||
{
|
||||
return minutes;
|
||||
}
|
||||
wxString GetMinutesString();
|
||||
void iSetMinutes(const wxString &s)
|
||||
{
|
||||
minutes = s;
|
||||
}
|
||||
|
||||
wxString GetHours() const
|
||||
{
|
||||
return hours;
|
||||
}
|
||||
wxString GetHoursString();
|
||||
void iSetHours(const wxString &s)
|
||||
{
|
||||
hours = s;
|
||||
}
|
||||
|
||||
wxString GetWeekdays() const
|
||||
{
|
||||
return weekdays;
|
||||
}
|
||||
wxString GetWeekdaysString();
|
||||
void iSetWeekdays(const wxString &s)
|
||||
{
|
||||
weekdays = s;
|
||||
}
|
||||
|
||||
wxString GetMonthdays() const
|
||||
{
|
||||
return monthdays;
|
||||
}
|
||||
wxString GetMonthdaysString();
|
||||
void iSetMonthdays(const wxString &s)
|
||||
{
|
||||
monthdays = s;
|
||||
}
|
||||
|
||||
wxString GetMonths() const
|
||||
{
|
||||
return months;
|
||||
}
|
||||
wxString GetMonthsString();
|
||||
void iSetMonths(const wxString &s)
|
||||
{
|
||||
months = s;
|
||||
}
|
||||
|
||||
wxString GetExceptions() const
|
||||
{
|
||||
return exceptions;
|
||||
}
|
||||
wxString GetExceptionsString();
|
||||
void iSetExceptions(const wxString &s)
|
||||
{
|
||||
exceptions = s;
|
||||
}
|
||||
|
||||
wxString GetHelpPage(bool forCreate) const
|
||||
{
|
||||
return wxT("pgagent-schedules");
|
||||
}
|
||||
|
||||
private:
|
||||
bool enabled;
|
||||
wxDateTime start, end;
|
||||
long recId;
|
||||
wxString minutes, hours, weekdays, monthdays, months, exceptions;
|
||||
};
|
||||
|
||||
class pgaScheduleCollection : public pgaJobObjCollection
|
||||
{
|
||||
public:
|
||||
pgaScheduleCollection(pgaFactory *factory, pgaJob *job);
|
||||
wxString GetTranslatedMessage(int kindOfMessage) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
140
include/agent/pgaStep.h
Normal file
140
include/agent/pgaStep.h
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// pgaStep.h - PostgreSQL Agent Job Step
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef PGASTEP_H
|
||||
#define PGASTEP_H
|
||||
|
||||
#include "agent/pgaJob.h"
|
||||
|
||||
|
||||
|
||||
class pgaStepFactory : public pgaJobObjFactory
|
||||
{
|
||||
public:
|
||||
pgaStepFactory();
|
||||
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);
|
||||
};
|
||||
extern pgaStepFactory stepFactory;
|
||||
|
||||
|
||||
class pgaStep : public pgaJobObject
|
||||
{
|
||||
public:
|
||||
pgaStep(pgCollection *collection, const wxString &newName = wxT(""));
|
||||
|
||||
wxString GetTranslatedMessage(int kindOfMessage) const;
|
||||
void ShowTreeDetail(ctlTree *browser, frmMain *form = 0, ctlListView *properties = 0, ctlSQLBox *sqlPane = 0);
|
||||
void ShowStatistics(frmMain *form, ctlListView *statistics);
|
||||
pgObject *Refresh(ctlTree *browser, const wxTreeItemId item);
|
||||
bool DropObject(wxFrame *frame, ctlTree *browser, bool cascaded);
|
||||
|
||||
bool GetEnabled() const
|
||||
{
|
||||
return enabled;
|
||||
}
|
||||
void iSetEnabled(const bool b)
|
||||
{
|
||||
enabled = b;
|
||||
}
|
||||
wxChar GetKindChar() const
|
||||
{
|
||||
return kindChar;
|
||||
}
|
||||
void iSetKindChar(const wxChar c)
|
||||
{
|
||||
kindChar = c;
|
||||
}
|
||||
wxString GetKind() const
|
||||
{
|
||||
return kind;
|
||||
}
|
||||
void iSetKind(const wxString &s)
|
||||
{
|
||||
kind = s;
|
||||
}
|
||||
wxString GetCode() const
|
||||
{
|
||||
return code;
|
||||
}
|
||||
void iSetCode(const wxString &s)
|
||||
{
|
||||
code = s;
|
||||
}
|
||||
wxString GetDbname() const
|
||||
{
|
||||
return dbname;
|
||||
}
|
||||
void iSetDbname(const wxString &s)
|
||||
{
|
||||
dbname = s;
|
||||
}
|
||||
wxString GetConnStr() const
|
||||
{
|
||||
return connstr;
|
||||
}
|
||||
void iSetConnStr(const wxString &s)
|
||||
{
|
||||
connstr = s;
|
||||
}
|
||||
wxString GetOnError() const
|
||||
{
|
||||
return onError;
|
||||
}
|
||||
void iSetOnError(const wxString &s)
|
||||
{
|
||||
onError = s;
|
||||
}
|
||||
wxChar GetOnErrorChar() const
|
||||
{
|
||||
return onErrorChar;
|
||||
}
|
||||
void iSetOnErrorChar(const wxChar c)
|
||||
{
|
||||
onErrorChar = c;
|
||||
}
|
||||
long GetRecId() const
|
||||
{
|
||||
return recId;
|
||||
}
|
||||
void iSetRecId(const long l)
|
||||
{
|
||||
recId = l;
|
||||
}
|
||||
|
||||
bool HasConnectionString() const
|
||||
{
|
||||
return !connstr.IsEmpty();
|
||||
}
|
||||
|
||||
bool IsUpToDate();
|
||||
|
||||
wxString GetHelpPage(bool forCreate) const
|
||||
{
|
||||
return wxT("pgagent-steps");
|
||||
}
|
||||
|
||||
private:
|
||||
bool enabled;
|
||||
wxString kind, code, dbname, connstr, onError;
|
||||
wxChar kindChar, onErrorChar;
|
||||
long recId;
|
||||
};
|
||||
|
||||
class pgaStepCollection : public pgaJobObjCollection
|
||||
{
|
||||
public:
|
||||
pgaStepCollection(pgaFactory *factory, pgaJob *job);
|
||||
wxString GetTranslatedMessage(int kindOfMessage) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
19
include/copyright.h
Normal file
19
include/copyright.h
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// copyright.h - pgAdmin copyright messages
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef COPYRIGHT_H
|
||||
#define COPYRIGHT_H
|
||||
|
||||
#define COPYRIGHT wxT("Copyright 2002 - 2016, The pgAdmin Development Team")
|
||||
#define COPYRIGHT_WIN32 "\251 2002 - 2016, The pgAdmin Development Team"
|
||||
#define LICENSE _("This software is released under the PostgreSQL Licence.")
|
||||
|
||||
#endif
|
||||
136
include/ctl/calbox.h
Normal file
136
include/ctl/calbox.h
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// calbox.h - Date-picker control box
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_CALBOX_H_
|
||||
#define _WX_CALBOX_H_
|
||||
|
||||
#include "wx/calctrl.h"
|
||||
|
||||
#if defined(wxUSE_DATEPICKCTRL) && wxUSE_DATEPICKCTRL
|
||||
#include "wx/datectrl.h"
|
||||
#if wxUSE_DATEPICKCTRL_GENERIC
|
||||
#include "wx/generic/datectrl.h"
|
||||
#endif // wxUSE_DATEPICKCTRL_GENERIC
|
||||
typedef wxDatePickerCtrl wxCalendarBox;
|
||||
#else
|
||||
|
||||
// pgCompatCalendarCtrl is a typedef for either wxGenericCalendarCtrl or wxCalendarCtrl
|
||||
#if wxCHECK_VERSION(2, 9, 0)
|
||||
#include "wx/generic/calctrlg.h"
|
||||
typedef wxGenericCalendarCtrl pgCompatCalendarCtrl;
|
||||
#else
|
||||
typedef wxCalendarCtrl pgCompatCalendarCtrl;
|
||||
#endif
|
||||
|
||||
class wxCalendarBox : public wxControl
|
||||
{
|
||||
public:
|
||||
wxCalendarBox()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
wxCalendarBox(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxDateTime &date = wxDefaultDateTime,
|
||||
const wxPoint &pos = wxDefaultPosition,
|
||||
const wxSize &size = wxDefaultSize,
|
||||
long style = wxCAL_SHOW_HOLIDAYS | wxWANTS_CHARS, const wxString &name = wxCalendarNameStr);
|
||||
|
||||
bool Destroy();
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxDateTime &date,
|
||||
const wxPoint &pos,
|
||||
const wxSize &size,
|
||||
long style,
|
||||
const wxString &name);
|
||||
|
||||
bool SetValue(const wxDateTime &date);
|
||||
wxDateTime GetValue();
|
||||
|
||||
bool SetLowerDateLimit(const wxDateTime &date = wxDefaultDateTime)
|
||||
{
|
||||
return m_cal->SetLowerDateLimit(date);
|
||||
}
|
||||
const wxDateTime &GetLowerDateLimit() const
|
||||
{
|
||||
return m_cal->GetLowerDateLimit();
|
||||
}
|
||||
bool SetUpperDateLimit(const wxDateTime &date = wxDefaultDateTime)
|
||||
{
|
||||
return m_cal->SetUpperDateLimit(date);
|
||||
}
|
||||
const wxDateTime &GetUpperDateLimit() const
|
||||
{
|
||||
return m_cal->GetUpperDateLimit();
|
||||
}
|
||||
|
||||
bool SetDateRange(const wxDateTime &lowerdate = wxDefaultDateTime, const wxDateTime &upperdate = wxDefaultDateTime)
|
||||
{
|
||||
return m_cal->SetDateRange(lowerdate, upperdate);
|
||||
}
|
||||
|
||||
wxCalendarDateAttr *GetAttr(size_t day) const
|
||||
{
|
||||
return m_cal->GetAttr(day);
|
||||
}
|
||||
void SetAttr(size_t day, wxCalendarDateAttr *attr)
|
||||
{
|
||||
m_cal->SetAttr(day, attr);
|
||||
}
|
||||
void SetHoliday(size_t day)
|
||||
{
|
||||
m_cal->SetHoliday(day);
|
||||
}
|
||||
void ResetAttr(size_t day)
|
||||
{
|
||||
m_cal->ResetAttr(day);
|
||||
}
|
||||
bool SetFormat(const wxChar *fmt);
|
||||
|
||||
virtual bool Enable(bool enable = true);
|
||||
virtual bool Show(bool show = true);
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
|
||||
private:
|
||||
wxDialog *m_dlg;
|
||||
wxTextCtrl *m_txt;
|
||||
pgCompatCalendarCtrl *m_cal;
|
||||
wxButton *m_btn;
|
||||
wxString m_format;
|
||||
|
||||
bool m_dropped, m_ignoreDrop;
|
||||
|
||||
void Init();
|
||||
void DropDown(bool down = true);
|
||||
|
||||
wxSize DoGetBestSize() const;
|
||||
void OnSize(wxSizeEvent &event);
|
||||
|
||||
void OnText(wxCommandEvent &ev);
|
||||
void OnEditKey(wxKeyEvent &event);
|
||||
void OnCalKey(wxKeyEvent &event);
|
||||
void OnClick(wxCommandEvent &ev);
|
||||
void OnSelChange(wxCalendarEvent &ev);
|
||||
void OnSetFocus(wxFocusEvent &ev);
|
||||
void OnKillFocus(wxFocusEvent &ev);
|
||||
void OnChildSetFocus(wxChildFocusEvent &ev);
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxCalendarBox)
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_NO_COPY_CLASS(wxCalendarBox)
|
||||
};
|
||||
|
||||
#endif // wxUSE_DATEPICKCTRL
|
||||
|
||||
#endif // _WX_CALBOX_H_
|
||||
|
||||
36
include/ctl/ctlAuiNotebook.h
Normal file
36
include/ctl/ctlAuiNotebook.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ctlAuiNotebook.cpp - Custom AUI Notebook class
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// The primary purpose of this class is to pass child focus events from
|
||||
// the notebook to the parent window. This is the only way we can grab
|
||||
// focus events from the page controls.
|
||||
|
||||
#ifndef CTLAUINOTEBOOK_H
|
||||
#define CTLAUINOTEBOOK_H
|
||||
|
||||
// wxWindows headers
|
||||
#include <wx/wx.h>
|
||||
#include <wx/aui/auibook.h>
|
||||
|
||||
class ctlAuiNotebook : public wxAuiNotebook
|
||||
{
|
||||
public:
|
||||
ctlAuiNotebook(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxAUI_NB_DEFAULT_STYLE) :
|
||||
wxAuiNotebook(parent, id, pos, size, style) { }
|
||||
|
||||
protected:
|
||||
void OnChildFocus(wxChildFocusEvent &evt);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
36
include/ctl/ctlCheckTreeView.h
Normal file
36
include/ctl/ctlCheckTreeView.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ctlCheckTreeView.cpp - TreeView with Checkboxes
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _CTLCHECKTREEVIEW_H
|
||||
#define _CTLCHECKTREEVIEW_H
|
||||
|
||||
|
||||
// wxWindows headers
|
||||
#include <wx/wx.h>
|
||||
#include <wx/wizard.h>
|
||||
#include <wx/imaglist.h>
|
||||
#include <wx/treectrl.h>
|
||||
|
||||
class ctlCheckTreeView : public wxTreeCtrl
|
||||
{
|
||||
public:
|
||||
ctlCheckTreeView(wxWindow *parent, wxWindowID id, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxTR_HAS_BUTTONS);
|
||||
bool IsChecked(const wxTreeItemId &node);
|
||||
|
||||
private:
|
||||
void OnLeftClick(wxMouseEvent &evt);
|
||||
void SetParentAndChildImage(wxTreeItemId node, int newimage);
|
||||
void SetParentImage(wxTreeItemId node, int newimage);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif
|
||||
48
include/ctl/ctlColourPicker.h
Normal file
48
include/ctl/ctlColourPicker.h
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the BSD Licence
|
||||
//
|
||||
// ctlColourPicker.cpp - TreeView with Checkboxes
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef _CTLCOLOURPICKER_H
|
||||
#define _CTLCOLOURPICKER_H
|
||||
|
||||
// wxWindows headers
|
||||
#include <wx/wx.h>
|
||||
#include "utils/misc.h"
|
||||
|
||||
|
||||
|
||||
class ctlColourPicker : public wxBitmapButton
|
||||
{
|
||||
public:
|
||||
ctlColourPicker(wxWindow *parent, wxWindowID id, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize)
|
||||
{
|
||||
Create(parent, id, pos, size);
|
||||
}
|
||||
|
||||
void DoProcessLeftClick(wxMouseEvent &event);
|
||||
|
||||
wxColour GetColour();
|
||||
wxString GetColourString();
|
||||
|
||||
void SetColour(const wxColour &colour);
|
||||
void SetColour(const wxString &colour);
|
||||
|
||||
void SetTitle(const wxString &title);
|
||||
void UpdateColour();
|
||||
|
||||
private:
|
||||
wxString m_title;
|
||||
wxColour m_colour_clr;
|
||||
|
||||
void Create(wxWindow *parent, wxWindowID id, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize);
|
||||
};
|
||||
|
||||
#endif
|
||||
61
include/ctl/ctlComboBox.h
Normal file
61
include/ctl/ctlComboBox.h
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ctlComboBox.h - enhanced combobox control
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef __COMBOBOX_H
|
||||
#define __COMBOBOX_H
|
||||
|
||||
// wxWindows headers
|
||||
#include <wx/wx.h>
|
||||
#include "utils/misc.h"
|
||||
|
||||
|
||||
|
||||
class pgConn;
|
||||
class ctlComboBoxFix : public wxComboBox
|
||||
{
|
||||
public:
|
||||
ctlComboBoxFix(wxWindow *wnd, int id, wxPoint pos, wxSize siz, long attr);
|
||||
|
||||
int FillLongKey(pgConn *conn, const wxChar *qry);
|
||||
int FillOidKey(pgConn *conn, const wxChar *qry);
|
||||
int FillStringKey(pgConn *conn, const wxChar *qry);
|
||||
long GetLongKey(int sel = -1);
|
||||
OID GetOIDKey(int sel = -1);
|
||||
wxString GetStringKey(int sel = -1);
|
||||
bool SetKey(long val);
|
||||
bool SetKey(OID val);
|
||||
bool SetKey(const wxString &val);
|
||||
|
||||
int Append(const wxString &item)
|
||||
{
|
||||
return wxComboBox::Append(item);
|
||||
}
|
||||
int Append(const wxString &item, void *data)
|
||||
{
|
||||
return wxComboBox::Append(item, data);
|
||||
}
|
||||
int Append(const wxString &item, const wxString &str);
|
||||
int Append(const wxString &item, long l);
|
||||
int Append(const wxString &item, OID oid);
|
||||
};
|
||||
|
||||
class ctlComboBox : public ctlComboBoxFix
|
||||
{
|
||||
public:
|
||||
ctlComboBox(wxWindow *wnd, int id, wxPoint pos, wxSize siz, long attr = 0);
|
||||
int GuessSelection(wxCommandEvent &ev);
|
||||
int GetGuessedSelection() const;
|
||||
wxString GetGuessedStringSelection() const;
|
||||
int GetSelection() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
131
include/ctl/ctlDefaultSecurityPanel.h
Normal file
131
include/ctl/ctlDefaultSecurityPanel.h
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ctlDefaultSecurityPanel.h - Panel with default security information
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef CTL_DEFDEFSECPANEL_H
|
||||
#define CTL_DEFDEFSECPANEL_H
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/dynarray.h>
|
||||
#include <wx/notebook.h>
|
||||
|
||||
enum
|
||||
{
|
||||
CTL_DEFPROPSQL = 500,
|
||||
CTL_DEFMSG,
|
||||
CTL_DEFLBPRIV,
|
||||
CTL_DEFSTATICGROUP,
|
||||
CTL_DEFCBGROUP,
|
||||
CTL_DEFADDPRIV,
|
||||
CTL_DEFDELPRIV,
|
||||
CTL_DEFALLPRIV,
|
||||
CTL_DEFALLPRIVGRANT,
|
||||
CTL_DEFPRIVCB // base for all privilege checkboxes, must be last
|
||||
};
|
||||
|
||||
class defaultPrivilegesOn
|
||||
{
|
||||
public:
|
||||
defaultPrivilegesOn(const wxChar, const wxString &, const wxString &);
|
||||
|
||||
wxChar m_privilegeType;
|
||||
wxString m_privilegesOn;
|
||||
wxString m_privileges;
|
||||
wxArrayString m_privilegesList;
|
||||
};
|
||||
|
||||
|
||||
DECLARE_LOCAL_EVENT_TYPE(EVT_DEFAULTSECURITYPANEL_CHANGE, -1)
|
||||
|
||||
class pgConn;
|
||||
class ctlDefaultPrivilegesPanel;
|
||||
class dlgDefaultSecurityProperty;
|
||||
|
||||
class ctlDefaultSecurityPanel : public wxPanel
|
||||
{
|
||||
|
||||
public:
|
||||
ctlDefaultSecurityPanel(pgConn *, wxNotebook *, wxImageList *);
|
||||
|
||||
wxString GetDefaultPrivileges(const wxString &schemaName);
|
||||
void UpdatePrivilegePages(bool createDefPrivs, const wxString &defPrivsOnTables,
|
||||
const wxString &defPrivsOnSeqs, const wxString &defPrivsOnFuncs,
|
||||
const wxString &defPrivsOnTypes);
|
||||
|
||||
protected:
|
||||
wxNotebook *nbNotebook;
|
||||
wxArrayString m_groups;
|
||||
wxArrayString m_namespaces;
|
||||
|
||||
ctlDefaultPrivilegesPanel *m_defPrivOnTablesPanel, *m_defPrivOnSeqsPanel, *m_defPrivOnFuncsPanel, *m_defPrivOnTypesPanel;
|
||||
|
||||
friend class ctlDefaultPrivilegesPanel;
|
||||
friend class dlgDefaultSecurityProperty;
|
||||
|
||||
};
|
||||
|
||||
class ctlDefaultPrivilegesPanel : public wxPanel
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
ctlDefaultPrivilegesPanel(ctlDefaultSecurityPanel *, wxNotebook *, defaultPrivilegesOn &, wxImageList *);
|
||||
~ctlDefaultPrivilegesPanel();
|
||||
|
||||
void Update(wxString privs);
|
||||
wxString GetDefaultPrivileges(const wxString &schemaName);
|
||||
|
||||
protected:
|
||||
|
||||
typedef struct
|
||||
{
|
||||
wxString m_username;
|
||||
wxString m_origPriv;
|
||||
wxString m_newPriv;
|
||||
bool m_modified;
|
||||
} defPrivilege;
|
||||
|
||||
public:
|
||||
WX_DECLARE_STRING_HASH_MAP(defPrivilege, defPrivHash);
|
||||
|
||||
protected:
|
||||
|
||||
bool m_defPrivChanged;
|
||||
int privilegeCount;
|
||||
defaultPrivilegesOn m_privilegeType;
|
||||
defPrivHash m_privileges;
|
||||
defPrivilege *m_currentSelectedPriv;
|
||||
|
||||
ctlDefaultSecurityPanel *m_defSecurityPanel;
|
||||
wxButton *btnAddPriv, *btnDelPriv;
|
||||
wxCheckBox **privCheckboxes;
|
||||
wxCheckBox *allPrivileges, *allPrivilegesGrant;
|
||||
ctlListView *lbPrivileges;
|
||||
ctlComboBox *cbGroups;
|
||||
wxStaticText *stGroup;
|
||||
|
||||
void OnPrivSelChange(wxListEvent &ev);
|
||||
void OnAddPriv(wxCommandEvent &ev);
|
||||
void OnGroupChange(wxCommandEvent &ev);
|
||||
void OnDelPriv(wxCommandEvent &ev);
|
||||
void OnPrivCheck(wxCommandEvent &ev);
|
||||
void OnPrivCheckAll(wxCommandEvent &ev);
|
||||
void OnPrivCheckAllGrant(wxCommandEvent &ev);
|
||||
|
||||
bool PrivCheckBoxUpdate(wxString &strUser);
|
||||
void CheckGrantOpt(int index);
|
||||
bool CanGrant();
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
75
include/ctl/ctlListView.h
Normal file
75
include/ctl/ctlListView.h
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ctlListView.h - enhanced listview control
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef CTLLISTVIEW_H
|
||||
#define CTLLISTVIEW_H
|
||||
|
||||
// wxWindows headers
|
||||
#include <wx/wx.h>
|
||||
#include <wx/listctrl.h>
|
||||
#include "utils/misc.h"
|
||||
|
||||
class frmMain;
|
||||
|
||||
class ctlListView : public wxListView
|
||||
{
|
||||
public:
|
||||
ctlListView(wxWindow *p, int id, wxPoint pos, wxSize siz, long attr = 0);
|
||||
long GetSelection();
|
||||
wxString GetText(long row, long col = 0);
|
||||
|
||||
void CreateColumns(wxImageList *images, const wxString &left, const wxString &right, int leftSize = 60);
|
||||
void CreateColumns(wxImageList *images, const wxString &str1, const wxString &str2, const wxString &str3, int leftSize = 60);
|
||||
|
||||
void AddColumn(const wxString &text, int size = wxLIST_AUTOSIZE_USEHEADER, int format = wxLIST_FORMAT_LEFT);
|
||||
|
||||
long AppendItem(int icon, const wxString &val, const wxString &val2 = wxString(), const wxString &val3 = wxString(), const wxString &val4 = wxString());
|
||||
long AppendItem(const wxString &val, const wxString &val2 = wxString(), const wxString &val3 = wxString())
|
||||
{
|
||||
return AppendItem(PGICON_PROPERTY, val, val2, val3);
|
||||
}
|
||||
void AppendItem(const wxString &str, long l)
|
||||
{
|
||||
AppendItem(str, NumToStr(l));
|
||||
}
|
||||
void AppendItem(const wxString &str, double d)
|
||||
{
|
||||
AppendItem(str, NumToStr(d));
|
||||
}
|
||||
void AppendItem(const wxString &str, OID o)
|
||||
{
|
||||
AppendItem(str, NumToStr(o));
|
||||
}
|
||||
void AppendItem(const wxString &str, const wxDateTime &d)
|
||||
{
|
||||
AppendItem(str, DateToStr(d));
|
||||
}
|
||||
void AppendItem(const wxString &str, const wxLongLong &l)
|
||||
{
|
||||
AppendItem(str, l.ToString());
|
||||
}
|
||||
void AppendItem(const wxString &str, const wxULongLong &l)
|
||||
{
|
||||
AppendItem(str, l.ToString());
|
||||
}
|
||||
void AppendYesNoItem(const wxString &str, bool b)
|
||||
{
|
||||
AppendItem(str, BoolToYesNo(b));
|
||||
}
|
||||
|
||||
void DeleteCurrentItem()
|
||||
{
|
||||
DeleteItem(GetSelection());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
91
include/ctl/ctlMenuToolbar.h
Normal file
91
include/ctl/ctlMenuToolbar.h
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ctlMenuToolbar.h - Menu tool bar
|
||||
//
|
||||
// This code is essentially stolen (with the authors permission) from
|
||||
// Paul Nelson (http://www.pnelsoncomposer.com/)
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef CTLMENUTOOLBAR_H
|
||||
#define CTLMENUTOOLBAR_H
|
||||
|
||||
#include "wx/frame.h"
|
||||
|
||||
// ctlMenuButton - Can be used wherever you can use a standard wxBitmapButton
|
||||
//
|
||||
// Implements a small pull-down triangle (v), which, when clicked, will display
|
||||
// a pop-up menu.
|
||||
|
||||
class ctlMenuButton : public wxBitmapButton
|
||||
{
|
||||
public:
|
||||
ctlMenuButton(wxToolBar *toolBar, int ID, wxMenu *menu)
|
||||
{
|
||||
Create(toolBar, toolBar, ID, menu);
|
||||
}
|
||||
void DoProcessLeftClick(wxMouseEvent &event);
|
||||
|
||||
wxMenu *m_menu;
|
||||
|
||||
void FillMenu();
|
||||
|
||||
private:
|
||||
void Create(wxWindow *window, wxToolBar *toolBar, int ID, wxMenu *menu);
|
||||
wxToolBar *m_toolBar;
|
||||
};
|
||||
|
||||
|
||||
// ctlMenuTool - is only used internal to the implementation of ctlMenuToolbar.
|
||||
//
|
||||
// You should never have to use it yourself
|
||||
|
||||
class ctlMenuTool
|
||||
{
|
||||
public:
|
||||
ctlMenuTool(wxToolBarToolBase *new_tool, int toolId);
|
||||
wxToolBarToolBase *m_tool;
|
||||
wxMenu *m_menu;
|
||||
|
||||
private:
|
||||
int m_toolId;
|
||||
ctlMenuButton *m_button;
|
||||
};
|
||||
|
||||
WX_DECLARE_LIST(ctlMenuTool, ctlMenuToolList);
|
||||
|
||||
|
||||
// *** ctlMenuToolbar - A replacement for wxToolBar which implements menu buttons
|
||||
// and pull-down buttons
|
||||
//
|
||||
// A menu button is a standard looking toolbar tool which, when clicked, pops up a
|
||||
// menu which can be selected.
|
||||
//
|
||||
// A pull-down button presents a small black triangle which, when clicked, pops up
|
||||
// a menu which can be selected. These buttons are typically used for a list of previous
|
||||
// actions (for example, previous web pages visited).
|
||||
|
||||
class ctlMenuToolbar : public wxToolBar
|
||||
{
|
||||
public:
|
||||
ctlMenuToolbar();
|
||||
ctlMenuToolbar(wxFrame *parent, wxWindowID id, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxTB_HORIZONTAL | wxNO_BORDER, const wxString &name = wxPanelNameStr);
|
||||
~ctlMenuToolbar();
|
||||
|
||||
// NOTE: label, shortHelpString, are not implemented on all platforms and are only
|
||||
// included for possible future upgrades
|
||||
ctlMenuButton *AddMenuPulldownTool(int toolId, const wxString &label, const wxString &shortHelpString = wxEmptyString, wxMenu *popupmenu = 0);
|
||||
void DoProcessLeftClick(wxMouseEvent &event);
|
||||
|
||||
private:
|
||||
wxFrame *m_frame;
|
||||
ctlMenuToolList *m_menuTools;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
61
include/ctl/ctlProgressStatusBar.h
Normal file
61
include/ctl/ctlProgressStatusBar.h
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ctlProgressStatusBar.h - Status bar indicating the current progress
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
#ifndef CTLPROGRESS_STATUSBAR_H
|
||||
#define CTLPROGRESS_STATUSBAR_H
|
||||
|
||||
// wxWindows headers
|
||||
#include <wx/wx.h>
|
||||
#include <wx/gauge.h>
|
||||
#include <wx/timer.h>
|
||||
|
||||
class ctlProgressStatusBar : public wxStatusBar
|
||||
{
|
||||
public:
|
||||
ctlProgressStatusBar(wxWindow *parent, bool showProgressInitially = true, bool autoProgressive = true, int max = -1);
|
||||
virtual ~ctlProgressStatusBar();
|
||||
|
||||
void ShowProgress(bool restart = true);
|
||||
void StopProgress();
|
||||
void SetProgress(int val);
|
||||
virtual void SetFieldsCount(int number = 1, const int *widths = NULL);
|
||||
virtual void SetStatusWidths(int n, const int widths_field[]);
|
||||
|
||||
static const unsigned short ms_increment,
|
||||
ms_progressbar_width,
|
||||
ms_progressstatus_width;
|
||||
|
||||
protected:
|
||||
void OnTimer(wxTimerEvent &WXUNUSED(event));
|
||||
void OnSize(wxSizeEvent &ev);
|
||||
|
||||
wxGauge *m_progress;
|
||||
wxTimer m_timer;
|
||||
|
||||
bool m_progressStopped;
|
||||
bool m_autoProgressive;
|
||||
bool m_autoValIncrementing;
|
||||
|
||||
int m_hr, m_min, m_sec, m_mil;
|
||||
int m_val;
|
||||
|
||||
enum
|
||||
{
|
||||
Status_field,
|
||||
ProgressBar_field,
|
||||
ProgressStatus_field,
|
||||
Max_Field
|
||||
};
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif // CTLPROGRESS_STATUSBAR_H
|
||||
121
include/ctl/ctlSQLBox.h
Normal file
121
include/ctl/ctlSQLBox.h
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ctlSQLBox.h - SQL syntax highlighting textbox
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef CTLSQLBOX_H
|
||||
#define CTLSQLBOX_H
|
||||
|
||||
// wxWindows headers
|
||||
#include <wx/wx.h>
|
||||
#include <wx/stc/stc.h>
|
||||
#include <wx/fdrepdlg.h>
|
||||
#include "utils/macros.h"
|
||||
|
||||
#include "db/pgConn.h"
|
||||
#include "dlg/dlgFindReplace.h"
|
||||
|
||||
// These structs are from Scintilla.h which isn't easily #included :-(
|
||||
struct CharacterRange
|
||||
{
|
||||
long cpMin;
|
||||
long cpMax;
|
||||
};
|
||||
|
||||
struct TextToFind
|
||||
{
|
||||
struct CharacterRange chrg;
|
||||
char *lpstrText;
|
||||
struct CharacterRange chrgText;
|
||||
};
|
||||
|
||||
class sysProcess;
|
||||
|
||||
// Class declarations
|
||||
class ctlSQLBox : public wxStyledTextCtrl
|
||||
{
|
||||
static wxString sqlKeywords;
|
||||
|
||||
public:
|
||||
ctlSQLBox(wxWindow *parent, wxWindowID id = -1, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = 0);
|
||||
ctlSQLBox();
|
||||
~ctlSQLBox();
|
||||
|
||||
void Create(wxWindow *parent, wxWindowID id = -1, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = 0);
|
||||
|
||||
void SetDatabase(pgConn *db);
|
||||
|
||||
void OnKeyDown(wxKeyEvent &event);
|
||||
void OnAutoComplete(wxCommandEvent &event);
|
||||
void OnSearchReplace(wxCommandEvent &event);
|
||||
void OnKillFocus(wxFocusEvent &event);
|
||||
|
||||
bool Find(const wxString &find, bool wholeWord, bool matchCase, bool useRegexps, bool startAtTop, bool reverse);
|
||||
bool Replace(const wxString &find, const wxString &replace, bool wholeWord, bool matchCase, bool useRegexps, bool startAtTop, bool reverse);
|
||||
bool ReplaceAll(const wxString &find, const wxString &replace, bool wholeWord, bool matchCase, bool useRegexps);
|
||||
bool DoFind(const wxString &find, const wxString &replace, bool doReplace, bool wholeWord, bool matchCase, bool useRegexps, bool startAtTop, bool reverse);
|
||||
void SetAutoReplaceList(queryMacroList *autorep);
|
||||
void SetAutoIndent(bool on)
|
||||
{
|
||||
m_autoIndent = on;
|
||||
}
|
||||
void EnableAutoComp(bool on)
|
||||
{
|
||||
m_autocompDisabled = on;
|
||||
}
|
||||
bool BlockComment(bool uncomment = false);
|
||||
void UpdateLineNumber();
|
||||
wxString ExternalFormat();
|
||||
void AbortProcess();
|
||||
|
||||
CharacterRange RegexFindText(int minPos, int maxPos, const wxString &text);
|
||||
|
||||
// Having multiple SQL tabs warrants the following properties to be tracked per tab
|
||||
void SetChanged(bool b);
|
||||
bool IsChanged();
|
||||
void SetOrigin(int origin);
|
||||
int GetOrigin();
|
||||
void SetFilename(wxString &filename);
|
||||
wxString GetFilename();
|
||||
void SetTitle(wxString &title);
|
||||
wxString GetTitle(bool withChangeInd = true);
|
||||
wxString GetChangeIndicator();
|
||||
long SelectQuery(int startposition);
|
||||
DECLARE_DYNAMIC_CLASS(ctlSQLBox)
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
protected:
|
||||
void OnEndProcess(wxProcessEvent &ev);
|
||||
void UpdateTitle();
|
||||
|
||||
sysProcess *process;
|
||||
long processID;
|
||||
wxString processOutput, processErrorOutput;
|
||||
int processExitCode;
|
||||
|
||||
private:
|
||||
void OnPositionStc(wxStyledTextEvent &event);
|
||||
void OnMarginClick(wxStyledTextEvent &event);
|
||||
queryMacroList *autoreplace;
|
||||
dlgFindReplace *m_dlgFindReplace;
|
||||
pgConn *m_database;
|
||||
bool m_autoIndent, m_autocompDisabled;
|
||||
|
||||
// Variables to track info per SQL box
|
||||
wxString m_filename;
|
||||
wxString m_title;
|
||||
wxString m_changestr;
|
||||
bool m_changed;
|
||||
int m_origin;
|
||||
|
||||
friend class QueryPrintout;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
65
include/ctl/ctlSQLGrid.h
Normal file
65
include/ctl/ctlSQLGrid.h
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ctlSQLGrid.h - SQL Data Display Grid
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef CTLSQLGRID_H
|
||||
#define CTLSQLGRID_H
|
||||
|
||||
// wxWindows headers
|
||||
#include <wx/grid.h>
|
||||
|
||||
|
||||
class ctlSQLGrid : public wxGrid
|
||||
{
|
||||
public:
|
||||
ctlSQLGrid(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size);
|
||||
ctlSQLGrid();
|
||||
|
||||
wxString GetExportLine(int row);
|
||||
wxString GetExportLine(int row, wxArrayInt cols);
|
||||
wxString GetExportLine(int row, int col1, int col2);
|
||||
virtual bool IsColText(int col)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int Copy();
|
||||
|
||||
virtual bool CheckRowPresent(int row)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
wxSize GetBestSize(int row, int col);
|
||||
void OnLabelDoubleClick(wxGridEvent &event);
|
||||
void OnLabelClick(wxGridEvent &event);
|
||||
|
||||
void AutoSizeColumn(int col, bool setAsMin = false, bool doLimit = true);
|
||||
void AutoSizeColumns(bool setAsMin);
|
||||
|
||||
WX_DECLARE_STRING_HASH_MAP( int, ColKeySizeHashMap );
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(ctlSQLGrid)
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
private:
|
||||
void OnCopy(wxCommandEvent &event);
|
||||
void OnMouseWheel(wxMouseEvent &event);
|
||||
void OnGridColSize(wxGridSizeEvent &event);
|
||||
wxString GetColumnName(int colNum);
|
||||
wxString GetColKeyValue(int col);
|
||||
void AppendColumnHeader(wxString &str, int start, int end);
|
||||
void AppendColumnHeader(wxString &str, wxArrayInt columns);
|
||||
|
||||
// Stores sizes of colums explicitly resized by user
|
||||
ColKeySizeHashMap colSizes;
|
||||
// Max size for each column
|
||||
wxArrayInt colMaxSizes;
|
||||
};
|
||||
|
||||
#endif
|
||||
115
include/ctl/ctlSQLResult.h
Normal file
115
include/ctl/ctlSQLResult.h
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ctlSQLResult.h - SQL Query result window
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef CTLSQLRESULT_H
|
||||
#define CTLSQLRESULT_H
|
||||
|
||||
// wxWindows headers
|
||||
#include <wx/thread.h>
|
||||
|
||||
#include "db/pgSet.h"
|
||||
#include "db/pgConn.h"
|
||||
#include "ctlSQLGrid.h"
|
||||
#include "frm/frmExport.h"
|
||||
|
||||
#define CTLSQL_RUNNING 100 // must be greater than ExecStatusType PGRES_xxx values
|
||||
|
||||
class ctlSQLResult : public ctlSQLGrid
|
||||
{
|
||||
public:
|
||||
ctlSQLResult(wxWindow *parent, pgConn *conn, wxWindowID id, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize);
|
||||
~ctlSQLResult();
|
||||
|
||||
|
||||
int Execute(const wxString &query, int resultToDisplay = 0, wxWindow *caller = 0, long eventId = 0, void *data = 0); // > 0: resultset to display, <=0: last result
|
||||
void SetConnection(pgConn *conn);
|
||||
long NumRows() const;
|
||||
long InsertedCount() const;
|
||||
OID InsertedOid() const;
|
||||
|
||||
int Abort();
|
||||
|
||||
bool Export();
|
||||
bool ToFile();
|
||||
bool ToFile(frmExport *frm);
|
||||
bool CanExport()
|
||||
{
|
||||
return NumRows() > 0 && colNames.GetCount() > 0;
|
||||
}
|
||||
|
||||
wxString OnGetItemText(long item, long col) const;
|
||||
wxString SummaryColumn();
|
||||
bool IsColText(int col);
|
||||
bool hasRowNumber()
|
||||
{
|
||||
return !rowcountSuppressed;
|
||||
}
|
||||
|
||||
int RunStatus();
|
||||
wxString GetMessagesAndClear();
|
||||
wxString GetErrorMessage();
|
||||
pgError GetResultError();
|
||||
|
||||
void DisplayData(bool single = false);
|
||||
|
||||
bool GetRowCountSuppressed()
|
||||
{
|
||||
return rowcountSuppressed;
|
||||
};
|
||||
|
||||
void SetMaxRows(int rows);
|
||||
void ResultsFinished();
|
||||
void OnGridSelect(wxGridRangeSelectEvent &event);
|
||||
|
||||
wxArrayString colNames;
|
||||
wxArrayString colTypes;
|
||||
wxArrayLong colTypClasses;
|
||||
wxString sqlquerytext;
|
||||
private:
|
||||
pgQueryThread *thread;
|
||||
pgConn *conn;
|
||||
bool rowcountSuppressed;
|
||||
};
|
||||
|
||||
class sqlResultTable : public wxGridTableBase
|
||||
{
|
||||
public:
|
||||
sqlResultTable();
|
||||
wxString GetValue(int row, int col);
|
||||
int GetNumberRows();
|
||||
int GetNumberCols();
|
||||
bool IsEmptyCell(int row, int col)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
wxString GetColLabelValue(int col);
|
||||
void SetValue(int row, int col, const wxString &value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
void SetThread(pgQueryThread *t)
|
||||
{
|
||||
thread = t;
|
||||
}
|
||||
bool DeleteRows(size_t pos = 0, size_t numRows = 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool DeleteCols(size_t pos = 0, size_t numCols = 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
pgQueryThread *thread;
|
||||
};
|
||||
|
||||
#endif
|
||||
63
include/ctl/ctlSeclabelPanel.h
Normal file
63
include/ctl/ctlSeclabelPanel.h
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ctlSeclabelPanel.h - Panel with security label information
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef CTL_SECLBLPANEL_H
|
||||
#define CTL_SECLBLPANEL_H
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/notebook.h>
|
||||
|
||||
enum
|
||||
{
|
||||
CTL_LBSECLABEL = 250,
|
||||
CTL_ADDSECLABEL,
|
||||
CTL_DELSECLABEL,
|
||||
CTL_PROVIDER,
|
||||
CTL_SECLABEL
|
||||
};
|
||||
|
||||
DECLARE_LOCAL_EVENT_TYPE(EVT_SECLABELPANEL_CHANGE, -1)
|
||||
|
||||
class pgConn;
|
||||
|
||||
class ctlSeclabelPanel : public wxPanel
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
ctlSeclabelPanel(wxNotebook *nb);
|
||||
~ctlSeclabelPanel();
|
||||
|
||||
ctlListView *lbSeclabels;
|
||||
void SetConnection(pgConn *conn);
|
||||
void SetObject(pgObject *obj);
|
||||
void Disable();
|
||||
wxString GetSqlForSecLabels(wxString objecttype = wxEmptyString, wxString objectname = wxEmptyString);
|
||||
void GetCurrentProviderLabelArray(wxArrayString &secLabels);
|
||||
protected:
|
||||
wxNotebook *nbNotebook;
|
||||
pgConn *connection;
|
||||
pgObject *object;
|
||||
|
||||
wxButton *btnAddSeclabel, *btnDelSeclabel;
|
||||
wxTextCtrl *txtProvider, *txtSeclabel;
|
||||
|
||||
void OnSeclabelSelChange(wxListEvent &ev);
|
||||
void OnAddSeclabel(wxCommandEvent &ev);
|
||||
void OnDelSeclabel(wxCommandEvent &ev);
|
||||
void OnProviderChange(wxCommandEvent &ev);
|
||||
void OnSeclabelChange(wxCommandEvent &ev);
|
||||
void OnChange(wxCommandEvent &ev);
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif
|
||||
83
include/ctl/ctlSecurityPanel.h
Normal file
83
include/ctl/ctlSecurityPanel.h
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ctlSecurityPanel.h - Panel with security information
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef CTL_SECPANEL_H
|
||||
#define CTL_SECPANEL_H
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/notebook.h>
|
||||
|
||||
enum
|
||||
{
|
||||
CTL_PROPSQL = 250,
|
||||
CTL_MSG,
|
||||
CTL_LBPRIV,
|
||||
CTL_STATICGROUP,
|
||||
CTL_CBGROUP,
|
||||
CTL_ADDPRIV,
|
||||
CTL_DELPRIV,
|
||||
CTL_ALLPRIV,
|
||||
CTL_ALLPRIVGRANT,
|
||||
CTL_PRIVCB // base for all privilege checkboxes, must be last
|
||||
};
|
||||
|
||||
DECLARE_LOCAL_EVENT_TYPE(EVT_SECURITYPANEL_CHANGE, -1)
|
||||
|
||||
class pgConn;
|
||||
|
||||
class ctlSecurityPanel : public wxPanel
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
ctlSecurityPanel(wxNotebook *nb, const wxString &privList, const char *privChars, wxImageList *imgList);
|
||||
~ctlSecurityPanel();
|
||||
|
||||
ctlListView *lbPrivileges;
|
||||
ctlComboBox *cbGroups;
|
||||
wxStaticText *stGroup;
|
||||
void SetConnection(pgConn *conn);
|
||||
|
||||
/*
|
||||
* Except column level privileges, column will be always an empty string in any case
|
||||
*/
|
||||
wxString GetGrant(const wxString &allPattern, const wxString &grantObject, wxArrayString *currentAcl = 0, wxString column = wxEmptyString);
|
||||
wxString GetUserPrivileges();
|
||||
bool DisablePrivilege(const wxString &priv);
|
||||
protected:
|
||||
wxNotebook *nbNotebook;
|
||||
pgConn *connection;
|
||||
|
||||
wxButton *btnAddPriv, *btnDelPriv;
|
||||
int privilegeCount;
|
||||
const char *privilegeChars;
|
||||
wxCheckBox **privCheckboxes;
|
||||
wxCheckBox *allPrivileges, *allPrivilegesGrant;
|
||||
|
||||
void OnPrivSelChange(wxListEvent &ev);
|
||||
void OnAddPriv(wxCommandEvent &ev);
|
||||
void OnGroupChange(wxCommandEvent &ev);
|
||||
void OnDelPriv(wxCommandEvent &ev);
|
||||
void OnPrivCheck(wxCommandEvent &ev);
|
||||
void OnPrivCheckAll(wxCommandEvent &ev);
|
||||
void OnPrivCheckAllGrant(wxCommandEvent &ev);
|
||||
|
||||
void CheckGrantOpt(int index);
|
||||
bool GrantAllowed() const;
|
||||
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
97
include/ctl/ctlTree.h
Normal file
97
include/ctl/ctlTree.h
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ctlTree.h - wxTreeCtrl containing pgObjects
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef CTLTREE_H
|
||||
#define CTLTREE_H
|
||||
|
||||
// wxWindows headers
|
||||
#include <wx/wx.h>
|
||||
#include <wx/treectrl.h>
|
||||
#include <wx/timer.h>
|
||||
|
||||
class pgObject;
|
||||
class pgCollection;
|
||||
class pgaFactory;
|
||||
class ctlTreeFindTimer;
|
||||
|
||||
class ctlTree : public wxTreeCtrl
|
||||
{
|
||||
public:
|
||||
ctlTree(wxWindow *parent, wxWindowID id, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxTR_HAS_BUTTONS);
|
||||
void SetItemImage(const wxTreeItemId &item, int image, wxTreeItemIcon which = wxTreeItemIcon_Normal);
|
||||
wxTreeItemId AppendItem(const wxTreeItemId &parent, const wxString &text, int image = -1, int selImage = -1, wxTreeItemData *data = NULL);
|
||||
wxTreeItemId AppendObject(pgObject *parent, pgObject *object);
|
||||
void RemoveDummyChild(pgObject *obj);
|
||||
pgCollection *AppendCollection(pgObject *parent, pgaFactory &factory);
|
||||
pgObject *GetObject(wxTreeItemId id);
|
||||
pgObject *GetParentObject(wxTreeItemId id)
|
||||
{
|
||||
return GetObject(GetItemParent(id));
|
||||
}
|
||||
pgCollection *GetParentCollection(wxTreeItemId id);
|
||||
pgObject *FindObject(pgaFactory &factory, wxTreeItemId parent);
|
||||
pgCollection *FindCollection(pgaFactory &factory, wxTreeItemId parent);
|
||||
wxTreeItemId FindItem(const wxTreeItemId &item, const wxString &str);
|
||||
void NavigateTree(int keyCode);
|
||||
virtual ~ctlTree();
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
private:
|
||||
void OnChar(wxKeyEvent &event);
|
||||
wxString m_findPrefix;
|
||||
ctlTreeFindTimer *m_findTimer;
|
||||
|
||||
friend class ctlTreeFindTimer;
|
||||
};
|
||||
|
||||
|
||||
// timer used to clear ctlTreeCtrl::m_findPrefix if no key was pressed
|
||||
// for a sufficiently long time
|
||||
class ctlTreeFindTimer : public wxTimer
|
||||
{
|
||||
public:
|
||||
// reset the current prefix after half a second of inactivity
|
||||
enum { CTLTREE_DELAY = 500 };
|
||||
|
||||
ctlTreeFindTimer( ctlTree *owner )
|
||||
{
|
||||
m_owner = owner;
|
||||
}
|
||||
|
||||
virtual void Notify()
|
||||
{
|
||||
m_owner->m_findPrefix.clear();
|
||||
}
|
||||
|
||||
private:
|
||||
ctlTree *m_owner;
|
||||
|
||||
DECLARE_NO_COPY_CLASS(ctlTreeFindTimer)
|
||||
};
|
||||
|
||||
|
||||
class treeObjectIterator
|
||||
{
|
||||
public:
|
||||
treeObjectIterator(ctlTree *browser, pgObject *obj);
|
||||
pgObject *GetNextObject();
|
||||
|
||||
private:
|
||||
wxTreeItemId lastItem;
|
||||
ctlTree *browser;
|
||||
pgObject *object;
|
||||
wxCookieType cookie;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
159
include/ctl/explainCanvas.h
Normal file
159
include/ctl/explainCanvas.h
Normal file
|
|
@ -0,0 +1,159 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// explainCanvas.h - Explain Canvas
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef EXPLAINCANVAS_H
|
||||
#define EXPLAINCANVAS_H
|
||||
|
||||
#if wxUSE_POPUPWIN
|
||||
#include "wx/popupwin.h"
|
||||
|
||||
#define pgTipWindowBase wxPopupTransientWindow
|
||||
#else
|
||||
#include "wx/frame.h"
|
||||
|
||||
#define pgTipWindowBase wxFrame
|
||||
#endif
|
||||
|
||||
#include <ogl/ogl.h>
|
||||
|
||||
|
||||
#if wxUSE_DEPRECATED
|
||||
#error wxUSE_DEPRECATED should be 0!
|
||||
#endif
|
||||
|
||||
|
||||
class ExplainShape;
|
||||
class ExplainPopup;
|
||||
class ExplainText;
|
||||
|
||||
class ExplainCanvas : public wxShapeCanvas
|
||||
{
|
||||
public:
|
||||
ExplainCanvas(wxWindow *parent);
|
||||
~ExplainCanvas();
|
||||
|
||||
void ShowPopup(ExplainShape *s);
|
||||
void SetExplainString(const wxString &str);
|
||||
void Clear();
|
||||
void SaveAsImage(const wxString &fileName, wxBitmapType imageType);
|
||||
|
||||
private:
|
||||
void OnMouseMotion(wxMouseEvent &ev);
|
||||
|
||||
ExplainShape *rootShape;
|
||||
ExplainPopup *popup;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
||||
class ExplainShape : public wxBitmapShape
|
||||
{
|
||||
public:
|
||||
ExplainShape(const wxImage &bmp, const wxString &description, long tokenNo = -1, long detailNo = -1);
|
||||
static ExplainShape *Create(long level, ExplainShape *last, const wxString &str);
|
||||
|
||||
void SetCondition(const wxString &str)
|
||||
{
|
||||
if (condition.Length() == 0) condition = str;
|
||||
else condition += wxT(" ") + str;
|
||||
}
|
||||
long GetLevel()
|
||||
{
|
||||
return level;
|
||||
}
|
||||
wxRealPoint GetStartPoint();
|
||||
wxRealPoint GetEndPoint(int kidNo);
|
||||
int GetKidno()
|
||||
{
|
||||
return kidNo;
|
||||
}
|
||||
|
||||
ExplainShape *GetUpper()
|
||||
{
|
||||
return upperShape;
|
||||
}
|
||||
double GetAverageCost()
|
||||
{
|
||||
return (costHigh - costLow) / 2 + costLow;
|
||||
}
|
||||
|
||||
protected:
|
||||
void OnDraw(wxDC &dc);
|
||||
void OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
|
||||
|
||||
ExplainShape *upperShape;
|
||||
|
||||
void SetLabel(const wxString &str, int tokenNo = -1, int detailNo = -1);
|
||||
|
||||
long level;
|
||||
wxString description, detail, condition, label;
|
||||
wxString cost, actual;
|
||||
double costLow, costHigh;
|
||||
long rows, width;
|
||||
int kidCount, kidNo;
|
||||
int totalShapes; // horizontal space usage by shape and its kids
|
||||
int usedShapes;
|
||||
bool m_rootShape;
|
||||
|
||||
friend class ExplainCanvas;
|
||||
friend class ExplainText;
|
||||
};
|
||||
|
||||
|
||||
class ExplainLine : public wxLineShape
|
||||
{
|
||||
public:
|
||||
ExplainLine(ExplainShape *from, ExplainShape *to, double weight = 0);
|
||||
|
||||
private:
|
||||
int width;
|
||||
void OnDraw(wxDC &dc);
|
||||
};
|
||||
|
||||
|
||||
class ExplainPopup : public pgTipWindowBase
|
||||
{
|
||||
public:
|
||||
ExplainPopup(ExplainCanvas *parent, ExplainShape *shape, ExplainPopup **popup = NULL);
|
||||
void Close();
|
||||
~ExplainPopup();
|
||||
|
||||
protected:
|
||||
// event handlers
|
||||
void OnMouseClick(wxMouseEvent &event);
|
||||
void OnMouseMove(wxMouseEvent &ev);
|
||||
|
||||
#if !wxUSE_POPUPWIN
|
||||
void OnActivate(wxActivateEvent &event);
|
||||
void OnKillFocus(wxFocusEvent &event);
|
||||
|
||||
#else // wxUSE_POPUPWIN
|
||||
virtual void OnDismiss();
|
||||
void OnMouseLost(wxMouseCaptureLostEvent &ev);
|
||||
#endif // wxUSE_POPUPWIN/!wxUSE_POPUPWIN
|
||||
|
||||
ExplainPopup **m_ptr;
|
||||
wxRect m_rectBound;
|
||||
|
||||
ExplainText *m_explainText;
|
||||
|
||||
#if !wxUSE_POPUPWIN
|
||||
long m_creationTime;
|
||||
#endif // !wxUSE_POPUPWIN
|
||||
|
||||
friend class ExplainText;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
42
include/ctl/module.mk
Normal file
42
include/ctl/module.mk
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#######################################################################
|
||||
#
|
||||
# pgAdmin III - PostgreSQL Tools
|
||||
#
|
||||
# Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
# This software is released under the PostgreSQL Licence
|
||||
#
|
||||
# module.mk - pgadmin/include/ctl/ Makefile fragment
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
pgadmin3_SOURCES += \
|
||||
include/ctl/calbox.h \
|
||||
include/ctl/ctlAuiNotebook.h \
|
||||
include/ctl/ctlCheckTreeView.h \
|
||||
include/ctl/ctlColourPicker.h \
|
||||
include/ctl/ctlComboBox.h \
|
||||
include/ctl/ctlListView.h \
|
||||
include/ctl/ctlMenuToolbar.h \
|
||||
include/ctl/ctlDefaultSecurityPanel.h \
|
||||
include/ctl/ctlSeclabelPanel.h \
|
||||
include/ctl/ctlSecurityPanel.h \
|
||||
include/ctl/ctlSQLBox.h \
|
||||
include/ctl/ctlSQLGrid.h \
|
||||
include/ctl/ctlSQLResult.h \
|
||||
include/ctl/ctlProgressStatusBar.h \
|
||||
include/ctl/ctlTree.h \
|
||||
include/ctl/explainCanvas.h \
|
||||
include/ctl/timespin.h \
|
||||
include/ctl/wxgridsel.h \
|
||||
include/ctl/xh_calb.h \
|
||||
include/ctl/xh_ctlcombo.h \
|
||||
include/ctl/xh_ctlcolourpicker.h \
|
||||
include/ctl/xh_ctlchecktreeview.h \
|
||||
include/ctl/xh_ctltree.h \
|
||||
include/ctl/xh_sqlbox.h \
|
||||
include/ctl/xh_timespin.h
|
||||
|
||||
EXTRA_DIST += \
|
||||
include/ctl/module.mk
|
||||
|
||||
|
||||
135
include/ctl/timespin.h
Normal file
135
include/ctl/timespin.h
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// timespin.h - timeSpan SpinCtrl
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_TIMESPIN_H_
|
||||
#define _WX_TIMESPIN_H_
|
||||
|
||||
#include "wx/datetime.h"
|
||||
#include "wx/spinbutt.h"
|
||||
|
||||
|
||||
class wxTimeSpinCtrl : public wxControl
|
||||
{
|
||||
public:
|
||||
wxTimeSpinCtrl()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
wxTimeSpinCtrl(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint &pos = wxDefaultPosition,
|
||||
const wxSize &size = wxDefaultSize,
|
||||
long style = wxWANTS_CHARS, const wxString &name = wxT("wxTimeSpinCtrl"));
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint &pos = wxDefaultPosition,
|
||||
const wxSize &size = wxDefaultSize,
|
||||
long style = wxWANTS_CHARS, const wxString &name = wxT("wxTimeSpinCtrl"));
|
||||
|
||||
bool Destroy();
|
||||
bool Enable(bool enable = true);
|
||||
|
||||
void SetMax(long seconds, bool useDay = false);
|
||||
bool SetValue(const wxTimeSpan &span);
|
||||
bool SetTime(const wxDateTime &time);
|
||||
wxTimeSpan GetValue();
|
||||
|
||||
private:
|
||||
void Init();
|
||||
|
||||
void OnSpinUp(wxSpinEvent &ev);
|
||||
void OnSpinDown(wxSpinEvent &ev);
|
||||
void OnSpin(wxSpinEvent &ev);
|
||||
void OnText(wxCommandEvent &ev);
|
||||
void OnSetFocus(wxFocusEvent &ev);
|
||||
void OnKillFocus(wxFocusEvent &ev);
|
||||
void OnEditKey(wxKeyEvent &ev);
|
||||
void OnNavigate(wxNavigationKeyEvent &ev);
|
||||
|
||||
long GetTextTime();
|
||||
int GetTimePart();
|
||||
void DoSpin(int diff);
|
||||
void Highlight(int tp);
|
||||
|
||||
wxTextCtrl *m_txt;
|
||||
wxSpinButton *m_spn;
|
||||
wxString m_format;
|
||||
long spinValue, maxSpinValue;
|
||||
bool canWrap, hasDay;
|
||||
|
||||
wxSize DoGetBestSize() const;
|
||||
void OnSize(wxSizeEvent &event);
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxTimeSpinCtrl)
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_NO_COPY_CLASS(wxTimeSpinCtrl)
|
||||
};
|
||||
|
||||
|
||||
#if 0
|
||||
class wxTimeSpinCtrl : public wxSpinCtrl //wxControl
|
||||
{
|
||||
public:
|
||||
wxTimeSpinCtrl() { }
|
||||
wxTimeSpinCtrl(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxDateTime &date = wxDefaultDateTime,
|
||||
const wxPoint &pos = wxDefaultPosition,
|
||||
const wxSize &size = wxDefaultSize,
|
||||
long style = wxWANTS_CHARS, const wxString &name = wxT("wxTimeSpinCtrl"));
|
||||
|
||||
bool Destroy();
|
||||
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxDateTime &date,
|
||||
const wxPoint &pos,
|
||||
const wxSize &size,
|
||||
long style,
|
||||
const wxString &name);
|
||||
|
||||
bool SetValue(const wxTimeSpan &span);
|
||||
wxTimeSpan GetValue();
|
||||
|
||||
virtual bool Enable(bool enable = true);
|
||||
virtual bool Show(bool show = true);
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
|
||||
private:
|
||||
wxTextCtrl *m_txt;
|
||||
wxSpinCtrl *m_spn;
|
||||
wxButton *m_btn;
|
||||
wxString m_format;
|
||||
|
||||
bool m_dropped, m_processing;
|
||||
|
||||
void Init();
|
||||
void DropDown(bool down = true);
|
||||
|
||||
void OnEditKey(wxKeyEvent &event);
|
||||
void OnCalKey(wxKeyEvent &event);
|
||||
void OnClick(wxMouseEvent &ev);
|
||||
void OnSelChange(wxCalendarEvent &ev);
|
||||
void OnActivate(wxActivateEvent &ev);
|
||||
void OnSetFocus(wxFocusEvent &ev);
|
||||
void OnKillFocus(wxFocusEvent &ev);
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxTimeSpinCtrl)
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_NO_COPY_CLASS(wxTimeSpinCtrl)
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#endif // _WX_TIMESPIN_H_
|
||||
|
||||
26
include/ctl/wxgridsel.h
Normal file
26
include/ctl/wxgridsel.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// wxgridsel.h - replacement for wx/generic/gridsel.h
|
||||
// if binary wxWindows 2.4.0 distribution is used.
|
||||
// This file is necessary until wxGrid supports multiple wxGrid::SetTable() calls
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WXGRIDSEL_H
|
||||
#define __WXGRIDSEL_H
|
||||
|
||||
|
||||
class wxGridSelection
|
||||
{
|
||||
wxGridCellCoordsArray dummy1[3];
|
||||
wxArrayInt dummy2[2];
|
||||
void *dummy3;
|
||||
wxGrid::wxGridSelectionModes dummy4;
|
||||
};
|
||||
|
||||
#endif
|
||||
30
include/ctl/xh_calb.h
Normal file
30
include/ctl/xh_calb.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// xh_calb.h - wxCalendarBox handler
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef _WX_XH_CALB_H_
|
||||
#define _WX_XH_CALB_H_
|
||||
|
||||
|
||||
#include "wx/xrc/xmlres.h"
|
||||
|
||||
//class WXDLLIMPEXP_XRC
|
||||
class wxCalendarBoxXmlHandler : public wxXmlResourceHandler
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxCalendarBoxXmlHandler)
|
||||
public:
|
||||
wxCalendarBoxXmlHandler();
|
||||
virtual wxObject *DoCreateResource();
|
||||
virtual bool CanHandle(wxXmlNode *node);
|
||||
};
|
||||
|
||||
|
||||
#endif // _WX_XH_CALB_H_
|
||||
30
include/ctl/xh_ctlchecktreeview.h
Normal file
30
include/ctl/xh_ctlchecktreeview.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// xh_ctlchecktreeview.h - ctlCheckTreeView handler
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef _WX_XH_CTLCHECKTREEVIEW_H_
|
||||
#define _WX_XH_CTLCHECKTREEVIEW_H_
|
||||
|
||||
#include "wx/xrc/xmlres.h"
|
||||
#include "wx/xrc/xh_tree.h"
|
||||
|
||||
//class WXDLLIMPEXP_XRC
|
||||
class ctlCheckTreeViewXmlHandler : public wxTreeCtrlXmlHandler
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(ctlCheckTreeViewXmlHandler)
|
||||
public:
|
||||
ctlCheckTreeViewXmlHandler() : wxTreeCtrlXmlHandler() {}
|
||||
virtual wxObject *DoCreateResource();
|
||||
virtual bool CanHandle(wxXmlNode *node);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
31
include/ctl/xh_ctlcolourpicker.h
Normal file
31
include/ctl/xh_ctlcolourpicker.h
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the BSD Licence
|
||||
//
|
||||
// xh_ctlcolourpicker.h - ctlColourPicker handler
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef _WX_XH_CTLCOLOURPICKER_H_
|
||||
#define _WX_XH_CTLCOLOURPICKER_H_
|
||||
|
||||
|
||||
#include "wx/xrc/xmlres.h"
|
||||
#include "wx/xrc/xh_bmpbt.h"
|
||||
|
||||
//class WXDLLIMPEXP_XRC
|
||||
class ctlColourPickerXmlHandler : public wxBitmapButtonXmlHandler
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(ctlColourPickerXmlHandler)
|
||||
public:
|
||||
ctlColourPickerXmlHandler() : wxBitmapButtonXmlHandler() {}
|
||||
virtual wxObject *DoCreateResource();
|
||||
virtual bool CanHandle(wxXmlNode *node);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
31
include/ctl/xh_ctlcombo.h
Normal file
31
include/ctl/xh_ctlcombo.h
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// xh_ctlcombo.h - ctlComboBox handler
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef _WX_XH_CTLCOMBO_H_
|
||||
#define _WX_XH_CTLCOMBO_H_
|
||||
|
||||
|
||||
#include "wx/xrc/xmlres.h"
|
||||
#include "wx/xrc/xh_combo.h"
|
||||
|
||||
//class WXDLLIMPEXP_XRC
|
||||
class ctlComboBoxXmlHandler : public wxComboBoxXmlHandler
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(ctlComboBoxXmlHandler)
|
||||
public:
|
||||
ctlComboBoxXmlHandler() : wxComboBoxXmlHandler() {}
|
||||
virtual wxObject *DoCreateResource();
|
||||
virtual bool CanHandle(wxXmlNode *node);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
30
include/ctl/xh_ctltree.h
Normal file
30
include/ctl/xh_ctltree.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// xh_ctltree.h - ctlTree handler
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef _WX_XH_CTLTREE_H_
|
||||
#define _WX_XH_CTLTREE_H_
|
||||
|
||||
#include "wx/xrc/xmlres.h"
|
||||
#include "wx/xrc/xh_tree.h"
|
||||
|
||||
//class WXDLLIMPEXP_XRC
|
||||
class ctlTreeXmlHandler : public wxTreeCtrlXmlHandler
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(ctlTreeXmlHandler)
|
||||
public:
|
||||
ctlTreeXmlHandler() : wxTreeCtrlXmlHandler() {}
|
||||
virtual wxObject *DoCreateResource();
|
||||
virtual bool CanHandle(wxXmlNode *node);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
30
include/ctl/xh_sqlbox.h
Normal file
30
include/ctl/xh_sqlbox.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// xh_sqlbox.h - wxSqlBox handler
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef _WX_XH_SQLBOX_H_
|
||||
#define _WX_XH_SQLBOX_H_
|
||||
|
||||
|
||||
#include "wx/xrc/xmlres.h"
|
||||
|
||||
//class WXDLLIMPEXP_XRC
|
||||
class ctlSQLBoxXmlHandler : public wxXmlResourceHandler
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(ctlSQLBoxXmlHandler)
|
||||
public:
|
||||
ctlSQLBoxXmlHandler();
|
||||
virtual wxObject *DoCreateResource();
|
||||
virtual bool CanHandle(wxXmlNode *node);
|
||||
};
|
||||
|
||||
|
||||
#endif // _WX_XH_SQLBOX_H_
|
||||
30
include/ctl/xh_timespin.h
Normal file
30
include/ctl/xh_timespin.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// xh_timespin.h - wxTimeSpinCtrl handler
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef _WX_XH_TIMESPIN_H_
|
||||
#define _WX_XH_TIMESPIN_H_
|
||||
|
||||
|
||||
#include "wx/xrc/xmlres.h"
|
||||
|
||||
//class WXDLLIMPEXP_XRC
|
||||
class wxTimeSpinXmlHandler : public wxXmlResourceHandler
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxTimeSpinXmlHandler)
|
||||
public:
|
||||
wxTimeSpinXmlHandler();
|
||||
virtual wxObject *DoCreateResource();
|
||||
virtual bool CanHandle(wxXmlNode *node);
|
||||
};
|
||||
|
||||
|
||||
#endif // _WX_XH_TIMESPIN_H_
|
||||
20
include/db/module.mk
Normal file
20
include/db/module.mk
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#######################################################################
|
||||
#
|
||||
# pgAdmin III - PostgreSQL Tools
|
||||
#
|
||||
# Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
# This software is released under the PostgreSQL Licence
|
||||
#
|
||||
# module.mk - pgadmin/include/db/ Makefile fragment
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
pgadmin3_SOURCES += \
|
||||
include/db/pgConn.h \
|
||||
include/db/pgQueryThread.h \
|
||||
include/db/pgQueryResultEvent.h \
|
||||
include/db/pgSet.h
|
||||
|
||||
EXTRA_DIST += \
|
||||
include/db/module.mk
|
||||
|
||||
313
include/db/pgConn.h
Normal file
313
include/db/pgConn.h
Normal file
|
|
@ -0,0 +1,313 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// pgConn.h - PostgreSQL Connection class
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef PGCONN_H
|
||||
#define PGCONN_H
|
||||
|
||||
// wxWindows headers
|
||||
#include <wx/wx.h>
|
||||
|
||||
// PostgreSQL headers
|
||||
#include <libpq-fe.h>
|
||||
|
||||
// App headers
|
||||
#include "pgSet.h"
|
||||
|
||||
// status enums
|
||||
enum
|
||||
{
|
||||
PGCONN_OK = CONNECTION_OK,
|
||||
PGCONN_BAD = CONNECTION_BAD,
|
||||
PGCONN_REFUSED,
|
||||
PGCONN_DNSERR,
|
||||
PGCONN_ABORTED, // connect user aborted
|
||||
PGCONN_BROKEN, // tcp/pipe broken
|
||||
PGCONN_SSHTUNNEL_ERROR
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PGCONN_EMPTY_QUERY = PGRES_EMPTY_QUERY,
|
||||
PGCONN_COMMAND_OK = PGRES_COMMAND_OK,
|
||||
PGCONN_TUPLES_OK = PGRES_TUPLES_OK,
|
||||
PGCONN_COPY_OUT = PGRES_COPY_OUT,
|
||||
PGCONN_COPY_IN = PGRES_COPY_IN,
|
||||
PGCONN_BAD_RESPONSE = PGRES_BAD_RESPONSE,
|
||||
PGCONN_NONFATAL_ERROR = PGRES_NONFATAL_ERROR,
|
||||
PGCONN_FATAL_ERROR = PGRES_FATAL_ERROR
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PGCONN_TXSTATUS_IDLE = PQTRANS_IDLE,
|
||||
PGCONN_TXSTATUS_ACTIVE = PQTRANS_ACTIVE,
|
||||
PGCONN_TXSTATUS_INTRANS = PQTRANS_INTRANS,
|
||||
PGCONN_TXSTATUS_INERROR = PQTRANS_INERROR,
|
||||
PGCONN_TXSTATUS_UNKNOWN = PQTRANS_UNKNOWN
|
||||
};
|
||||
|
||||
// Our version of a pgNotify
|
||||
typedef struct pgNotification
|
||||
{
|
||||
wxString name;
|
||||
int pid;
|
||||
wxString data;
|
||||
} pgNotification;
|
||||
|
||||
// An error record
|
||||
typedef struct pgError
|
||||
{
|
||||
wxString severity;
|
||||
wxString sql_state;
|
||||
wxString msg_primary;
|
||||
wxString msg_detail;
|
||||
wxString msg_hint;
|
||||
wxString statement_pos;
|
||||
wxString internal_pos;
|
||||
wxString internal_query;
|
||||
wxString context;
|
||||
wxString source_file;
|
||||
wxString source_line;
|
||||
wxString source_function;
|
||||
wxString formatted_msg;
|
||||
|
||||
void SetError(PGresult *_res = NULL, wxMBConv *_conv = NULL);
|
||||
} pgError;
|
||||
|
||||
class pgConn
|
||||
{
|
||||
public:
|
||||
pgConn(const wxString &server = wxT(""), const wxString &service = wxT(""), const wxString &hostaddr = wxT(""),
|
||||
const wxString &database = wxT(""), const wxString &username = wxT(""), const wxString &password = wxT(""),
|
||||
int port = 5432, const wxString &rolename = wxT(""), int sslmode = 0, OID oid = 0,
|
||||
const wxString &applicationname = wxT("pgAdmin"),
|
||||
const wxString &sslcert = wxT(""), const wxString &sslkey = wxT(""), const wxString &sslrootcert = wxT(""), const wxString &sslcrl = wxT(""),
|
||||
const bool sslcompression = true);
|
||||
~pgConn();
|
||||
|
||||
bool IsSuperuser();
|
||||
bool HasPrivilege(const wxString &objTyp, const wxString &objName, const wxString &priv);
|
||||
bool HasFeature(int feature = 0, bool forceCheck = false);
|
||||
bool BackendMinimumVersion(int major, int minor);
|
||||
bool BackendMinimumVersion(int major, int minor, int patch);
|
||||
bool EdbMinimumVersion(int major, int minor);
|
||||
wxString SystemNamespaceRestriction(const wxString &nsp);
|
||||
int GetMajorVersion() const
|
||||
{
|
||||
return majorVersion;
|
||||
}
|
||||
int GetMinorVersion() const
|
||||
{
|
||||
return minorVersion;
|
||||
}
|
||||
bool GetIsEdb();
|
||||
bool GetIsGreenplum();
|
||||
bool GetIsHawq();
|
||||
wxString EncryptPassword(const wxString &user, const wxString &password);
|
||||
wxString qtDbString(const wxString &value);
|
||||
pgConn *Duplicate(const wxString &_appName = wxT(""));
|
||||
|
||||
static void ExamineLibpqVersion();
|
||||
static double GetLibpqVersion()
|
||||
{
|
||||
return libpqVersion;
|
||||
}
|
||||
|
||||
static bool IsValidServerEncoding(int encid)
|
||||
{
|
||||
return pg_valid_server_encoding_id(encid) == 0 ? false : true;
|
||||
}
|
||||
|
||||
void Close();
|
||||
bool Reconnect();
|
||||
bool ExecuteVoid(const wxString &sql, bool reportError = true);
|
||||
wxString ExecuteScalar(const wxString &sql, bool reportError = true);
|
||||
pgSet *ExecuteSet(const wxString &sql, bool reportError = true);
|
||||
void CancelExecution(void);
|
||||
|
||||
wxString GetHostAddr() const
|
||||
{
|
||||
return save_hostaddr;
|
||||
}
|
||||
wxString GetService() const
|
||||
{
|
||||
return save_service;
|
||||
}
|
||||
wxString GetUser() const
|
||||
{
|
||||
return conn ? wxString(PQuser(conn), *conv) : wxT("");
|
||||
}
|
||||
wxString GetPassword() const
|
||||
{
|
||||
return conn ? wxString(PQpass(conn), *conv) : wxT("");
|
||||
}
|
||||
wxString GetRole() const
|
||||
{
|
||||
return dbRole;
|
||||
}
|
||||
wxString GetHost() const
|
||||
{
|
||||
return dbHost;
|
||||
}
|
||||
wxString GetHostName() const
|
||||
{
|
||||
return dbHostName;
|
||||
}
|
||||
wxString GetDbname() const
|
||||
{
|
||||
return save_database;
|
||||
}
|
||||
wxString GetApplicationName() const
|
||||
{
|
||||
return save_applicationname;
|
||||
}
|
||||
wxString GetSSLCert() const
|
||||
{
|
||||
return save_sslcert;
|
||||
}
|
||||
wxString GetSSLKey() const
|
||||
{
|
||||
return save_sslkey;
|
||||
}
|
||||
wxString GetSSLRootCert() const
|
||||
{
|
||||
return save_sslrootcert;
|
||||
}
|
||||
wxString GetSSLCrl() const
|
||||
{
|
||||
return save_sslcrl;
|
||||
}
|
||||
bool GetSSLCompression() const
|
||||
{
|
||||
return save_sslcompression;
|
||||
}
|
||||
wxString GetName() const;
|
||||
bool GetNeedUtfConnectString()
|
||||
{
|
||||
return utfConnectString;
|
||||
}
|
||||
int GetPort() const
|
||||
{
|
||||
return conn ? atoi(PQport(conn)) : 0;
|
||||
};
|
||||
wxString GetTTY() const
|
||||
{
|
||||
return conn ? wxString(PQtty(conn), *conv) : wxT("");
|
||||
}
|
||||
wxString GetOptions() const
|
||||
{
|
||||
return conn ? wxString(PQoptions(conn), *conv) : wxT("");
|
||||
}
|
||||
int GetSslMode() const
|
||||
{
|
||||
return save_sslmode;
|
||||
}
|
||||
wxString GetSslModeName();
|
||||
int GetBackendPID() const
|
||||
{
|
||||
return conn ? PQbackendPID(conn) : 0;
|
||||
}
|
||||
int GetStatus() const;
|
||||
int GetLastResultStatus() const
|
||||
{
|
||||
return lastResultStatus;
|
||||
}
|
||||
bool IsAlive();
|
||||
wxString GetLastError() const;
|
||||
pgError GetLastResultError() const
|
||||
{
|
||||
return lastResultError;
|
||||
}
|
||||
wxString GetVersionString();
|
||||
OID GetLastSystemOID() const
|
||||
{
|
||||
return lastSystemOID;
|
||||
}
|
||||
OID GetDbOid() const
|
||||
{
|
||||
return dbOid;
|
||||
}
|
||||
void RegisterNoticeProcessor(PQnoticeProcessor proc, void *arg);
|
||||
wxMBConv *GetConv()
|
||||
{
|
||||
return conv;
|
||||
};
|
||||
|
||||
void LogError(const bool quiet = false);
|
||||
|
||||
bool IsSSLconnected();
|
||||
PGconn *connection()
|
||||
{
|
||||
return conn;
|
||||
}
|
||||
void Notice(const char *msg);
|
||||
pgNotification *GetNotification();
|
||||
int GetTxStatus();
|
||||
|
||||
void Reset();
|
||||
|
||||
bool StartCopy(const wxString query);
|
||||
bool PutCopyData(const char *data, long count);
|
||||
bool EndPutCopy(const wxString errormsg);
|
||||
bool GetCopyFinalStatus(void);
|
||||
|
||||
bool TableHasColumn(wxString schemaname, wxString tblname, const wxString &colname);
|
||||
|
||||
protected:
|
||||
PGconn *conn;
|
||||
PGcancel *m_cancelConn;
|
||||
wxMutex m_cancelConnMutex;
|
||||
int lastResultStatus;
|
||||
|
||||
int connStatus;
|
||||
|
||||
void SetLastResultError(PGresult *res, const wxString &msg = wxEmptyString);
|
||||
void SetConnCancel(void);
|
||||
void ResetConnCancel(void);
|
||||
pgError lastResultError;
|
||||
|
||||
wxMBConv *conv;
|
||||
bool needColQuoting, utfConnectString;
|
||||
wxString dbRole, dbHost, dbHostName;
|
||||
OID lastSystemOID;
|
||||
OID dbOid;
|
||||
|
||||
void *noticeArg;
|
||||
PQnoticeProcessor noticeProc;
|
||||
static double libpqVersion;
|
||||
|
||||
friend class pgQueryThread;
|
||||
|
||||
private:
|
||||
bool DoConnect();
|
||||
bool Initialize();
|
||||
|
||||
wxString qtString(const wxString &value);
|
||||
|
||||
bool features[32];
|
||||
int minorVersion, majorVersion, patchVersion;
|
||||
bool isEdb;
|
||||
bool isGreenplum;
|
||||
bool isHawq;
|
||||
|
||||
wxString reservedNamespaces;
|
||||
wxString connstr;
|
||||
|
||||
wxString save_server, save_service, save_hostaddr, save_database, save_username, save_password, save_rolename, save_applicationname;
|
||||
wxString save_sslcert, save_sslkey, save_sslrootcert, save_sslcrl;
|
||||
int save_port, save_sslmode;
|
||||
bool save_sslcompression;
|
||||
OID save_oid;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
79
include/db/pgQueryResultEvent.h
Normal file
79
include/db/pgQueryResultEvent.h
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// pgQueryResultEvent.h - Query Result Event from the pgQueryThread
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef PGQUERYRESULTEVENT_H
|
||||
#define PGQUERYRESULTEVENT_H
|
||||
|
||||
#include "wx/wx.h"
|
||||
#include "wx/event.h"
|
||||
|
||||
class pgBatchQuery;
|
||||
|
||||
extern const wxEventType PGQueryResultEvent;
|
||||
|
||||
|
||||
class pgQueryResultEvent : public wxCommandEvent
|
||||
{
|
||||
public:
|
||||
pgQueryResultEvent(unsigned long _thrdId, pgBatchQuery *_qry, int _id = 0);
|
||||
pgQueryResultEvent(const pgQueryResultEvent &_ev);
|
||||
|
||||
// Required for sending with wxPostEvent()
|
||||
wxEvent *Clone() const
|
||||
{
|
||||
return new pgQueryResultEvent(*this);
|
||||
}
|
||||
|
||||
pgBatchQuery *GetQuery()
|
||||
{
|
||||
return m_query;
|
||||
}
|
||||
unsigned long GetThreadID()
|
||||
{
|
||||
return m_thrdId;
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
PGQ_RESULT_ERROR = -8,
|
||||
PGQ_EXECUTION_CANCELLED = -7,
|
||||
PGQ_ERROR_CONSUME_INPUT = -6,
|
||||
PGQ_ERROR_SEND_QUERY = -5,
|
||||
PGQ_ERROR_EXECUTE_CALLABLE = -4,
|
||||
PGQ_ERROR_PREPARE_CALLABLE = -3,
|
||||
PGQ_STRING_INVALID = -2,
|
||||
PGQ_CONN_LOST = -1,
|
||||
};
|
||||
|
||||
private:
|
||||
pgBatchQuery *m_query;
|
||||
// Thread Id (pgQueryThread)
|
||||
unsigned long m_thrdId;
|
||||
};
|
||||
|
||||
typedef void (wxEvtHandler::*pgQueryResultEventFunc)(pgQueryResultEvent &);
|
||||
|
||||
// This #define simplifies the one below, and makes the syntax less
|
||||
// ugly if you want to use Connect() instead of an event table.
|
||||
#define pgQueryResultEventHandler(func) \
|
||||
(wxObjectEventFunction)(wxEventFunction)(wxCommandEventFunction) \
|
||||
wxStaticCastEvent(pgQueryResultEventFunc, &func)
|
||||
|
||||
// Define the event table entry. Yes, it really *does* end in a comma.
|
||||
#define EVT_PGQUERYRESULT(id, fn) \
|
||||
DECLARE_EVENT_TABLE_ENTRY(PGQueryResultEvent, id, wxID_ANY, \
|
||||
pgQueryResultEventHandler(fn), (wxObject*) NULL),
|
||||
|
||||
#define EVT_PGQUERYRESULT_RANGE(id1, id2, fn) \
|
||||
DECLARE_EVENT_TABLE_ENTRY(PGQueryResultEvent, id1, id2, \
|
||||
pgQueryResultEventHandler(fn), (wxObject*) NULL),
|
||||
|
||||
#endif // PGQUERYRESULTEVENT_H
|
||||
290
include/db/pgQueryThread.h
Normal file
290
include/db/pgQueryThread.h
Normal file
|
|
@ -0,0 +1,290 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// pgQueryThread.h - PostgreSQL threaded query class header
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef PGQUERYTHREAD_H
|
||||
#define PGQUERYTHREAD_H
|
||||
|
||||
#include "wx/wx.h"
|
||||
#include "wx/event.h"
|
||||
#include "db/pgConn.h"
|
||||
|
||||
// Forward declaration
|
||||
class pgSet;
|
||||
class pgQueryThread;
|
||||
class pgBatchQuery;
|
||||
|
||||
// Support for the IN & INOUT parameters type
|
||||
class pgParam : public wxObject
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
PG_PARAM_IN = 1,
|
||||
PG_PARAM_OUT = 2,
|
||||
PG_PARAM_INOUT = 3,
|
||||
PG_PARAM_VARIADIC = 4,
|
||||
PG_PARAM_TABLE = 5
|
||||
};
|
||||
|
||||
// Any data
|
||||
//
|
||||
// This constructor won't call the functions - 'htonl' or 'htons'
|
||||
// It will be the responsibility of the caller to take care
|
||||
// to call 'htonl' or 'htons' depending on requirements.
|
||||
//
|
||||
// NOTE:
|
||||
// This data will be owned by pgParam object and will be released.
|
||||
pgParam(Oid _type, void *_val, int _len, short mode = PG_PARAM_IN);
|
||||
|
||||
// wxString data
|
||||
pgParam(Oid _type, wxString *_val, wxMBConv *_conv = NULL,
|
||||
short mode = PG_PARAM_IN);
|
||||
|
||||
~pgParam();
|
||||
|
||||
// Returns 0 for text type and 1 for otherwise
|
||||
int GetFormat();
|
||||
|
||||
Oid GetType()
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
short GetMode()
|
||||
{
|
||||
return m_mode;
|
||||
}
|
||||
|
||||
protected:
|
||||
Oid m_type;
|
||||
void *m_val;
|
||||
int m_len;
|
||||
short m_format;
|
||||
// Modes are required by EnterpriseDB's callable statement
|
||||
short m_mode;
|
||||
|
||||
// Do not allow copy construction and shadow-copy
|
||||
// to avoid ownership
|
||||
// Force to use an pointer
|
||||
pgParam(const pgParam &)
|
||||
{
|
||||
wxASSERT(0);
|
||||
}
|
||||
pgParam &operator= (const pgParam &)
|
||||
{
|
||||
wxASSERT(0);
|
||||
return *this;
|
||||
}
|
||||
|
||||
friend class pgConn;
|
||||
friend class pgQueryThread;
|
||||
};
|
||||
|
||||
WX_DEFINE_ARRAY_PTR(pgParam *, pgParamsArray);
|
||||
|
||||
class pgBatchQuery : public wxObject
|
||||
{
|
||||
public:
|
||||
pgBatchQuery(const wxString &_query, pgParamsArray *_params = NULL,
|
||||
long _eventId = -1, void *_data = NULL, bool _useCallable = false,
|
||||
int _resultToRetrieve = 0)
|
||||
: m_query(_query), m_params(_params), m_eventID(_eventId), m_data(_data),
|
||||
m_useCallable(_useCallable), m_resToRetrieve(_resultToRetrieve),
|
||||
m_returnCode(-1), m_resultSet(NULL), m_rowsInserted(-1), m_insertedOid(-1)
|
||||
{
|
||||
// Do not honour the empty query string
|
||||
wxASSERT(!_query.IsEmpty());
|
||||
}
|
||||
~pgBatchQuery();
|
||||
|
||||
bool Release();
|
||||
|
||||
pgSet *ResultSet()
|
||||
{
|
||||
return m_resultSet;
|
||||
}
|
||||
|
||||
int ReturnCode()
|
||||
{
|
||||
return m_returnCode;
|
||||
}
|
||||
|
||||
const wxString &GetMessage()
|
||||
{
|
||||
return m_message;
|
||||
}
|
||||
|
||||
long RowInserted()
|
||||
{
|
||||
return m_rowsInserted;
|
||||
}
|
||||
|
||||
const wxString &GetErrorMessage();
|
||||
|
||||
protected:
|
||||
wxString m_query; // Query
|
||||
pgParamsArray *m_params; // parameters
|
||||
long m_eventID; // Event ID
|
||||
void *m_data; // Data to be send with event
|
||||
bool m_useCallable; // Use EnterpriseDB callable statement if possible
|
||||
int m_resToRetrieve; // Which result to be retrieved
|
||||
int m_returnCode; // Return code
|
||||
pgSet *m_resultSet; // Result-Set
|
||||
long m_rowsInserted; // No of rows inserted
|
||||
Oid m_insertedOid; // Inserted Oid
|
||||
wxString m_message; // Message generated during query execution
|
||||
pgError m_err; // Error
|
||||
|
||||
private:
|
||||
// Do not allow copy construction and '=' operator (shadow copying)
|
||||
// to avoid ownership of parameters and result-set
|
||||
//
|
||||
// This will force this class to be used as an pointer only.
|
||||
pgBatchQuery(const pgBatchQuery &)
|
||||
{
|
||||
wxASSERT(0);
|
||||
}
|
||||
pgBatchQuery &operator= (const pgBatchQuery &)
|
||||
{
|
||||
wxASSERT(0);
|
||||
return *this;
|
||||
}
|
||||
|
||||
friend class pgQueryThread;
|
||||
};
|
||||
WX_DEFINE_ARRAY_PTR(pgBatchQuery *, pgBatchQueryArray);
|
||||
|
||||
class pgQueryThread : public wxThread
|
||||
{
|
||||
public:
|
||||
// For running a single query (Used by few components)
|
||||
pgQueryThread(pgConn *_conn, const wxString &qry, int resultToRetrieve = -1,
|
||||
wxWindow *_caller = 0, long eventId = 0, void *_data = 0);
|
||||
|
||||
// Support for multiple queries support
|
||||
pgQueryThread(pgConn *_conn, wxEvtHandler *_caller = NULL,
|
||||
PQnoticeProcessor _processor = NULL, void *_noticeHandler = NULL);
|
||||
|
||||
~pgQueryThread();
|
||||
|
||||
bool HasMultipleQueriesSupport()
|
||||
{
|
||||
return m_multiQueries;
|
||||
}
|
||||
|
||||
bool SupportCallableStatement()
|
||||
{
|
||||
return m_useCallable;
|
||||
}
|
||||
|
||||
void SetEventOnCancellation(bool eventOnCancelled);
|
||||
|
||||
void AddQuery(
|
||||
const wxString &_qry, pgParamsArray *_params = NULL,
|
||||
long _eventId = 0, void *_data = NULL, bool _useCallable = false,
|
||||
int _resultToRetrieve = -1);
|
||||
|
||||
virtual void *Entry();
|
||||
bool DataValid(int _idx = -1) const
|
||||
{
|
||||
if (_idx == -1)
|
||||
_idx = m_currIndex;
|
||||
return (_idx >= 0 && _idx > m_currIndex ? false : (m_queries[_idx]->m_resultSet != NULL));
|
||||
}
|
||||
|
||||
pgConn *GetConn()
|
||||
{
|
||||
return m_conn;
|
||||
}
|
||||
|
||||
pgSet *DataSet(int _idx = -1)
|
||||
{
|
||||
if (_idx == -1)
|
||||
_idx = m_currIndex;
|
||||
return (_idx >= 0 && _idx > m_currIndex ? NULL : m_queries[_idx]->m_resultSet);
|
||||
}
|
||||
|
||||
int ReturnCode(int _idx = -1) const
|
||||
{
|
||||
if (_idx == -1)
|
||||
_idx = m_currIndex;
|
||||
return (_idx >= 0 && _idx > m_currIndex ? -1 : m_queries[_idx]->m_returnCode);
|
||||
}
|
||||
|
||||
long RowsInserted(int _idx = -1) const
|
||||
{
|
||||
if (_idx == -1)
|
||||
_idx = m_currIndex;
|
||||
return (_idx >= 0 && _idx > m_currIndex ? -1L : m_queries[_idx]->m_rowsInserted);
|
||||
}
|
||||
|
||||
Oid InsertedOid(int _idx = -1) const
|
||||
{
|
||||
if (_idx == -1)
|
||||
_idx = m_currIndex;
|
||||
return (_idx >= 0 && _idx > m_currIndex ? -1L : m_queries[_idx]->m_insertedOid);
|
||||
}
|
||||
|
||||
inline void CancelExecution()
|
||||
{
|
||||
m_cancelled = true;
|
||||
}
|
||||
|
||||
inline size_t GetNumberQueries()
|
||||
{
|
||||
return m_queries.GetCount();
|
||||
}
|
||||
|
||||
size_t QueriesExecuted()
|
||||
{
|
||||
return m_currIndex + 1;
|
||||
}
|
||||
|
||||
wxString GetMessagesAndClear(int _idx = -1);
|
||||
void AppendMessage(const wxString &_str);
|
||||
|
||||
int DeleteReleasedQueries();
|
||||
|
||||
pgError GetResultError(int idx = -1);
|
||||
|
||||
private:
|
||||
int Execute();
|
||||
int RaiseEvent(int _retval = 0);
|
||||
|
||||
// Queries to be executed
|
||||
pgBatchQueryArray m_queries;
|
||||
// Current running query index
|
||||
int m_currIndex;
|
||||
// Connection object
|
||||
pgConn *m_conn;
|
||||
// Execution cancelled?
|
||||
bool m_cancelled;
|
||||
// Raise events even when cancelled the execution
|
||||
bool m_eventOnCancellation;
|
||||
// Does this thread support multiple queries
|
||||
bool m_multiQueries;
|
||||
// Use EDB callable statement (if available and require)
|
||||
bool m_useCallable;
|
||||
// Is executing a query
|
||||
bool m_executing;
|
||||
// Queries are being accessed at this time
|
||||
wxMutex m_queriesLock;
|
||||
// When one thread is accesing messages, other should not be able to access it
|
||||
wxCriticalSection m_criticalSection;
|
||||
// Event Handler
|
||||
wxEvtHandler *m_caller;
|
||||
// Database server notice-processor
|
||||
PQnoticeProcessor m_processor;
|
||||
// Notice Handler
|
||||
void *m_noticeHandler;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
244
include/db/pgSet.h
Normal file
244
include/db/pgSet.h
Normal file
|
|
@ -0,0 +1,244 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// pgSet.h - PostgreSQL ResultSet class
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef PGSET_H
|
||||
#define PGSET_H
|
||||
|
||||
// wxWindows headers
|
||||
#include <wx/wx.h>
|
||||
#include <wx/datetime.h>
|
||||
|
||||
// PostgreSQL headers
|
||||
#include <libpq-fe.h>
|
||||
|
||||
#include "utils/misc.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PGTYPCLASS_NUMERIC = 1,
|
||||
PGTYPCLASS_BOOL,
|
||||
PGTYPCLASS_STRING,
|
||||
PGTYPCLASS_DATE,
|
||||
PGTYPCLASS_OTHER
|
||||
} pgTypClass;
|
||||
|
||||
class pgConn;
|
||||
|
||||
// Class declarations
|
||||
class pgSet
|
||||
{
|
||||
public:
|
||||
pgSet();
|
||||
pgSet(PGresult *newRes, pgConn *newConn, wxMBConv &cnv, bool needColQt);
|
||||
~pgSet();
|
||||
long NumRows() const
|
||||
{
|
||||
return nRows;
|
||||
}
|
||||
long NumCols() const
|
||||
{
|
||||
return nCols;
|
||||
}
|
||||
|
||||
void MoveNext()
|
||||
{
|
||||
if (pos <= nRows) pos++;
|
||||
}
|
||||
void MovePrevious()
|
||||
{
|
||||
if (pos > 0) pos--;
|
||||
}
|
||||
void MoveFirst()
|
||||
{
|
||||
if (nRows) pos = 1;
|
||||
else pos = 0;
|
||||
}
|
||||
void MoveLast()
|
||||
{
|
||||
pos = nRows;
|
||||
}
|
||||
void Locate(long l)
|
||||
{
|
||||
pos = l;
|
||||
}
|
||||
long CurrentPos() const
|
||||
{
|
||||
return pos;
|
||||
}
|
||||
bool Bof() const
|
||||
{
|
||||
return (!nRows || pos < 1);
|
||||
}
|
||||
bool Eof() const
|
||||
{
|
||||
return (!nRows || pos > nRows);
|
||||
}
|
||||
wxString ColName(const int col) const;
|
||||
OID ColTypeOid(const int col) const;
|
||||
long ColTypeMod(const int col) const;
|
||||
wxString ColType(const int col) const;
|
||||
wxString ColFullType(const int col) const;
|
||||
pgTypClass ColTypClass(const int col) const;
|
||||
|
||||
OID GetInsertedOid() const
|
||||
{
|
||||
return PQoidValue(res);
|
||||
}
|
||||
long GetInsertedCount() const;
|
||||
int ColSize(const int col) const
|
||||
{
|
||||
return PQfsize(res, col);
|
||||
}
|
||||
bool IsNull(const int col) const
|
||||
{
|
||||
return (PQgetisnull(res, pos - 1, col) != 0);
|
||||
}
|
||||
int ColScale(const int col) const;
|
||||
int ColNumber(const wxString &colName) const;
|
||||
bool HasColumn(const wxString &colname) const;
|
||||
|
||||
|
||||
wxString GetVal(const int col) const;
|
||||
wxString GetVal(const wxString &col) const;
|
||||
long GetLong(const int col) const;
|
||||
long GetLong(const wxString &col) const;
|
||||
bool GetBool(const int col) const;
|
||||
bool GetBool(const wxString &col) const;
|
||||
double GetDouble(const int col) const;
|
||||
double GetDouble(const wxString &col) const;
|
||||
wxDateTime GetDateTime(const int col) const;
|
||||
wxDateTime GetDateTime(const wxString &col) const;
|
||||
wxDateTime GetDate(const int col) const;
|
||||
wxDateTime GetDate(const wxString &col) const;
|
||||
wxULongLong GetLongLong(const int col) const;
|
||||
wxULongLong GetLongLong(const wxString &col) const;
|
||||
OID GetOid(const int col) const;
|
||||
OID GetOid(const wxString &col) const;
|
||||
|
||||
char *GetCharPtr(const int col) const;
|
||||
char *GetCharPtr(const wxString &col) const;
|
||||
|
||||
wxMBConv &GetConversion() const
|
||||
{
|
||||
return conv;
|
||||
}
|
||||
|
||||
wxString GetCommandStatus() const
|
||||
{
|
||||
if (res)
|
||||
{
|
||||
return wxString(PQcmdStatus(res), conv);
|
||||
}
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
||||
protected:
|
||||
pgConn *conn;
|
||||
PGresult *res;
|
||||
long pos, nRows, nCols;
|
||||
wxString ExecuteScalar(const wxString &sql) const;
|
||||
wxMBConv &conv;
|
||||
bool needColQuoting;
|
||||
mutable wxArrayString colTypes, colFullTypes;
|
||||
wxArrayInt colClasses;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class pgSetIterator
|
||||
{
|
||||
public:
|
||||
pgSetIterator(pgSet *s);
|
||||
pgSetIterator(pgConn *conn, const wxString &sql);
|
||||
~pgSetIterator();
|
||||
|
||||
bool RowsLeft();
|
||||
bool MovePrev();
|
||||
bool IsValid()
|
||||
{
|
||||
return set != 0;
|
||||
}
|
||||
pgSet *Set()
|
||||
{
|
||||
return set;
|
||||
}
|
||||
|
||||
wxString GetVal(const int col) const
|
||||
{
|
||||
return set->GetVal(col);
|
||||
}
|
||||
wxString GetVal(const wxString &col) const
|
||||
{
|
||||
return set->GetVal(col);
|
||||
}
|
||||
long GetLong(const int col) const
|
||||
{
|
||||
return set->GetLong(col);
|
||||
}
|
||||
long GetLong(const wxString &col) const
|
||||
{
|
||||
return set->GetLong(col);
|
||||
}
|
||||
bool GetBool(const int col) const
|
||||
{
|
||||
return set->GetBool(col);
|
||||
}
|
||||
bool GetBool(const wxString &col) const
|
||||
{
|
||||
return set->GetBool(col);
|
||||
}
|
||||
double GetDouble(const int col) const
|
||||
{
|
||||
return set->GetDouble(col);
|
||||
}
|
||||
double GetDouble(const wxString &col) const
|
||||
{
|
||||
return set->GetDouble(col);
|
||||
}
|
||||
wxDateTime GetDateTime(const int col) const
|
||||
{
|
||||
return set->GetDateTime(col);
|
||||
}
|
||||
wxDateTime GetDateTime(const wxString &col) const
|
||||
{
|
||||
return set->GetDateTime(col);
|
||||
}
|
||||
wxDateTime GetDate(const int col) const
|
||||
{
|
||||
return set->GetDate(col);
|
||||
}
|
||||
wxDateTime GetDate(const wxString &col) const
|
||||
{
|
||||
return set->GetDate(col);
|
||||
}
|
||||
wxULongLong GetLongLong(const int col) const
|
||||
{
|
||||
return set->GetLongLong(col);
|
||||
}
|
||||
wxULongLong GetLongLong(const wxString &col) const
|
||||
{
|
||||
return set->GetLongLong(col);
|
||||
}
|
||||
OID GetOid(const int col) const
|
||||
{
|
||||
return set->GetOid(col);
|
||||
}
|
||||
OID GetOid(const wxString &col) const
|
||||
{
|
||||
return set->GetOid(col);
|
||||
}
|
||||
|
||||
protected:
|
||||
pgSet *set;
|
||||
bool first;
|
||||
};
|
||||
|
||||
#endif
|
||||
115
include/dd/dditems/figures/ddColumnFigure.h
Normal file
115
include/dd/dditems/figures/ddColumnFigure.h
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddColumnFigure.h - Minimal Composite Figure for a column of a table
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDCOLUMNFIGURE_H
|
||||
#define DDCOLUMNFIGURE_H
|
||||
#include "hotdraw/figures/hdAttributeFigure.h"
|
||||
#include "dd/dditems/figures/ddColumnKindIcon.h"
|
||||
#include "dd/dditems/figures/ddColumnOptionIcon.h"
|
||||
#include "dd/dditems/figures/ddTextTableItemFigure.h"
|
||||
|
||||
class ddTableFigure;
|
||||
class ddRelationshipItem;
|
||||
|
||||
//Minimal overhead composite figure
|
||||
class ddColumnFigure : public hdAttributeFigure
|
||||
{
|
||||
public:
|
||||
ddColumnFigure(wxString &columnName, ddTableFigure *owner, ddRelationshipItem *sourceFk = NULL);
|
||||
ddColumnFigure(wxString &columnName, ddTableFigure *owner, ddColumnOptionType option, bool isGenFk, bool isPkColumn, wxString colDataType, int p = -1, int s = -1, int ukIdx = -1, ddRelationshipItem *sourceFk = NULL, ddRelationshipItem *usedAsFkDestFor = NULL );
|
||||
void Init(wxString &columnName, ddTableFigure *owner, ddRelationshipItem *sourceFk = NULL);
|
||||
~ddColumnFigure();
|
||||
virtual void AddPosForNewDiagram();
|
||||
virtual void RemovePosOfDiagram(int posIdx);
|
||||
virtual void basicMoveBy(int posIdx, int x, int y);
|
||||
virtual void moveTo(int posIdx, int x, int y);
|
||||
virtual void setOwnerTable(ddTableFigure *table);
|
||||
virtual bool containsPoint(int posIdx, int x, int y);
|
||||
virtual hdMultiPosRect &getBasicDisplayBox();
|
||||
virtual void basicDraw(wxBufferedDC &context, hdDrawingView *view);
|
||||
virtual void basicDrawSelected(wxBufferedDC &context, hdDrawingView *view);
|
||||
virtual hdIFigure *findFigure(int posIdx, int x, int y);
|
||||
virtual hdIFigure *getFigureAt(int pos);
|
||||
virtual hdITool *CreateFigureTool(hdDrawingView *view, hdITool *defaultTool);
|
||||
virtual ddTableFigure *getOwnerTable();
|
||||
void displayBoxUpdate();
|
||||
bool isNull();
|
||||
bool isNotNull();
|
||||
bool isNone();
|
||||
bool isPrimaryKey();
|
||||
void disablePrimaryKey();
|
||||
void enablePrimaryKey();
|
||||
bool isUniqueKey();
|
||||
bool isUniqueKey(int uniqueIndex);
|
||||
int getUniqueConstraintIndex();
|
||||
void setUniqueConstraintIndex(int i);
|
||||
bool isPlain();
|
||||
void setColumnKindToNone();
|
||||
void toggleColumnKind(ddColumnType type, hdDrawingView *view = NULL);
|
||||
void setColumnOption(ddColumnOptionType type);
|
||||
void setRightIconForColumn();
|
||||
ddColumnOptionType getColumnOption();
|
||||
ddDataType getDataType();
|
||||
void setDataType(ddDataType type);
|
||||
wxString &getColumnName(bool datatype = false);
|
||||
void setColumnName(wxString name);
|
||||
bool isForeignKey();
|
||||
bool isGeneratedForeignKey();
|
||||
bool isUserCreatedForeignKey();
|
||||
bool isForeignKeyFromPk();
|
||||
wxString generateSQL(bool forAlterColumn = false);
|
||||
bool isFkNameGenerated();
|
||||
void activateGenFkName();
|
||||
void deactivateGenFkName();
|
||||
ddRelationshipItem *getFkSource();
|
||||
void setFkSource(ddRelationshipItem *newColumn);
|
||||
int getPrecision();
|
||||
void setPrecision(int n);
|
||||
int getScale();
|
||||
void setScale(int n);
|
||||
void setAsUserCreatedFk(ddRelationshipItem *relatedFkItem);
|
||||
ddRelationshipItem *getRelatedFkItem();
|
||||
bool validateColumn(wxString &errors);
|
||||
void setTextColour(wxColour colour);
|
||||
ddColumnKindIcon *getKindImage()
|
||||
{
|
||||
return kindImage;
|
||||
};
|
||||
ddColumnOptionIcon *getOptionImage()
|
||||
{
|
||||
return optionImage;
|
||||
};
|
||||
ddTextTableItemFigure *getColumnText()
|
||||
{
|
||||
return columnText;
|
||||
};
|
||||
|
||||
/* Disable right now, it can be useful at the future when db designer will be improved again
|
||||
int getPgAttNumCol() { return pgAttNumColNumber;};
|
||||
void setPgAttNumCol(int attnum) { pgAttNumColNumber = attnum; };
|
||||
*/
|
||||
wxString getRawDataType();
|
||||
|
||||
protected:
|
||||
ddColumnKindIcon *kindImage;
|
||||
ddColumnOptionIcon *optionImage;
|
||||
ddTextTableItemFigure *columnText;
|
||||
ddTableFigure *ownerTable;
|
||||
ddRelationshipItem *usedAsFkDestFor;
|
||||
bool generateFkName;
|
||||
int pgAttNumColNumber;
|
||||
|
||||
private:
|
||||
ddRelationshipItem *fkSource;
|
||||
|
||||
|
||||
};
|
||||
#endif
|
||||
72
include/dd/dditems/figures/ddColumnKindIcon.h
Normal file
72
include/dd/dditems/figures/ddColumnKindIcon.h
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddColumnKindIcon.h - Figure container for kind of Column Images
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDCOLUMNKINDICON_H
|
||||
#define DDCOLUMNKINDICON_H
|
||||
|
||||
#include "hotdraw/figures/hdAbstractMenuFigure.h"
|
||||
|
||||
class ddColumnFigure;
|
||||
|
||||
enum ddColumnType
|
||||
{
|
||||
pk = 321,
|
||||
uk,
|
||||
none,
|
||||
noaction //no action kind means column type don't have right now a useful value
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
MNU_DDCTPKEY = 321,
|
||||
MNU_DDCTUKEY
|
||||
};
|
||||
|
||||
class ddColumnKindIcon : public hdAbstractMenuFigure
|
||||
{
|
||||
public:
|
||||
ddColumnKindIcon(ddColumnFigure *owner);
|
||||
~ddColumnKindIcon();
|
||||
virtual void OnGenericPopupClick(wxCommandEvent &event, hdDrawingView *view = NULL);
|
||||
virtual void createMenu(wxMenu &mnu);
|
||||
virtual void basicDraw(wxBufferedDC &context, hdDrawingView *view);
|
||||
virtual void basicDrawSelected(wxBufferedDC &context, hdDrawingView *view);
|
||||
virtual void toggleColumnKind(ddColumnType type, hdDrawingView *view = NULL, bool interaction = true);
|
||||
virtual int getWidth();
|
||||
virtual int getHeight();
|
||||
bool isNone();
|
||||
bool isPrimaryKey();
|
||||
bool isForeignKey();
|
||||
void disableUniqueKey();
|
||||
void disablePrimaryKey();
|
||||
void enablePrimaryKey();
|
||||
ddColumnFigure *getOwnerColumn();
|
||||
bool isUniqueKey();
|
||||
bool isUniqueKey(int uniqueIndex);
|
||||
int getUniqueConstraintIndex();
|
||||
void setUniqueConstraintIndex(int i);
|
||||
void setRightIconForColumn();
|
||||
void setPrimaryKey(bool value);
|
||||
void setUkIndex(int ukIdx);
|
||||
protected:
|
||||
|
||||
private:
|
||||
ddColumnFigure *ownerColumn;
|
||||
wxBitmap *iconToDraw;
|
||||
wxBitmap icon;
|
||||
int ukIndex;
|
||||
bool isPk;
|
||||
|
||||
//multiple Uk management at table
|
||||
void syncUkIndexes();
|
||||
bool uniqueConstraintManager(bool ukCol, hdDrawingView *view = NULL, bool interaction = true);
|
||||
};
|
||||
#endif
|
||||
54
include/dd/dditems/figures/ddColumnOptionIcon.h
Normal file
54
include/dd/dditems/figures/ddColumnOptionIcon.h
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddColumnOptionIcon.h -
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDCOLUMNOPTIONICON_H
|
||||
#define DDCOLUMNOPTIONICON_H
|
||||
|
||||
#include "hotdraw/figures/hdAbstractMenuFigure.h"
|
||||
|
||||
class ddColumnFigure;
|
||||
|
||||
enum ddColumnOptionType
|
||||
{
|
||||
null = 321,
|
||||
notnull
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
MNU_COLNULL = 321,
|
||||
MNU_COLNOTNULL
|
||||
};
|
||||
|
||||
class ddColumnOptionIcon : public hdAbstractMenuFigure
|
||||
{
|
||||
public:
|
||||
ddColumnOptionIcon(ddColumnFigure *owner);
|
||||
~ddColumnOptionIcon();
|
||||
virtual void OnGenericPopupClick(wxCommandEvent &event, hdDrawingView *view = NULL);
|
||||
virtual void createMenu(wxMenu &mnu);
|
||||
virtual void basicDraw(wxBufferedDC &context, hdDrawingView *view);
|
||||
virtual void basicDrawSelected(wxBufferedDC &context, hdDrawingView *view);
|
||||
virtual void changeIcon(ddColumnOptionType type);
|
||||
virtual int getWidth();
|
||||
virtual int getHeight();
|
||||
ddColumnOptionType getOption();
|
||||
ddColumnFigure *getOwnerColumn();
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
ddColumnOptionType colOption;
|
||||
ddColumnFigure *ownerColumn;
|
||||
wxBitmap *iconToDraw;
|
||||
wxBitmap icon;
|
||||
};
|
||||
#endif
|
||||
113
include/dd/dditems/figures/ddRelationshipFigure.h
Normal file
113
include/dd/dditems/figures/ddRelationshipFigure.h
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddRelationshipFigure.h - Figure to draw foreign keys between tables.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDRELATIONSHIPFIGURE_H
|
||||
#define DDRELATIONSHIPFIGURE_H
|
||||
#include "hotdraw/figures/hdLineConnection.h"
|
||||
#include "dd/dditems/figures/ddTableFigure.h"
|
||||
#include "dd/dditems/figures/ddColumnFigure.h"
|
||||
|
||||
enum
|
||||
{
|
||||
MNU_MANDATORYRELATIONSHIP = 321,
|
||||
MNU_IDENTIFYINGRELATIONSHIP,
|
||||
MNU_1MRELATIONSHIP,
|
||||
MNU_DELETERELATIONSHIP,
|
||||
MNU_FKCONSTRAINTNAME,
|
||||
MNU_FKMATCHTYPESIMPLE,
|
||||
MNU_FKMATCHTYPEFULL,
|
||||
MNU_FKONDELETENOACTION,
|
||||
MNU_FKONDELETERESTRICT,
|
||||
MNU_FKONDELETECASCADE,
|
||||
MNU_FKONDELETESETNULL,
|
||||
MNU_FKONDELETESETDEFAULT,
|
||||
MNU_FKONUPDATENOACTION,
|
||||
MNU_FKONUPDATERESTRICT,
|
||||
MNU_FKONUPDATECASCADE,
|
||||
MNU_FKONUPDATESETNULL,
|
||||
MNU_FKONUPDATESETDEFAULT,
|
||||
MNU_FKEYFROMPKEY,
|
||||
MNU_FKEYCUSTOMMAPPING,
|
||||
MNU_FKEYFROMUKEYBASE //This constant should be always the last one to allow hack of multiple uk selection in submenu
|
||||
};
|
||||
|
||||
enum actionKind
|
||||
{
|
||||
FK_ACTION_NO = 600,
|
||||
FK_RESTRICT,
|
||||
FK_CASCADE,
|
||||
FK_SETNULL,
|
||||
FK_SETDEFAULT
|
||||
};
|
||||
class ddRelationshipItem;
|
||||
|
||||
WX_DECLARE_STRING_HASH_MAP( ddRelationshipItem *, columnsHashMap );
|
||||
|
||||
|
||||
class ddRelationshipFigure : public hdLineConnection
|
||||
{
|
||||
public:
|
||||
ddRelationshipFigure();
|
||||
ddRelationshipFigure(int posIdx, hdIFigure *figure1, hdIFigure *figure2);
|
||||
~ddRelationshipFigure();
|
||||
virtual void createMenu(wxMenu &mnu);
|
||||
|
||||
void prepareFkForDelete(ddColumnFigure *column);
|
||||
void updateForeignKey();
|
||||
void removeForeignKeys();
|
||||
void addExistingColumnFk(ddColumnFigure *startTablesourceCol, wxString destColumn);
|
||||
bool getIdentifying();
|
||||
bool getOneToMany();
|
||||
bool getMandatory();
|
||||
void setOptionAtForeignKeys(ddColumnOptionType type);
|
||||
void updatePkAtFkCols();
|
||||
bool isForeignKeyFromPk();
|
||||
virtual void connectEnd(hdIConnector *end, hdDrawingView *view = NULL);
|
||||
virtual void connectStart(hdIConnector *start, hdDrawingView *view = NULL);
|
||||
void disconnectStart(hdDrawingView *view = NULL);
|
||||
void disconnectEnd(hdDrawingView *view = NULL);
|
||||
void setFkFrom(bool primaryKey, int useUkIndex = -1, bool issueUpdateFk = false);
|
||||
wxString generateSQL(wxString schemaName);
|
||||
wxString getConstraintName();
|
||||
ddTableFigure *getStartTable();
|
||||
ddTableFigure *getEndTable();
|
||||
void changeFkOSTextColor(wxColour originalColour, wxColour fkColour, bool reset = false);
|
||||
int getUkIndex();
|
||||
actionKind getOnUpdateAction();
|
||||
actionKind getOnDeleteAction();
|
||||
bool getMatchSimple();
|
||||
columnsHashMap &getItemsHashMap()
|
||||
{
|
||||
return chm;
|
||||
};
|
||||
void initRelationValues(ddTableFigure *source, ddTableFigure *destination, int ukIdx, wxString constraint, actionKind onUpdate, actionKind onDelete, bool simpleMatch, bool identifying, bool oneToMany, bool mandatory, bool fromPk);
|
||||
|
||||
protected:
|
||||
virtual void basicDrawSelected(wxBufferedDC &context, hdDrawingView *view);
|
||||
virtual void basicDraw(wxBufferedDC &context, hdDrawingView *view);
|
||||
|
||||
private:
|
||||
virtual void OnGenericPopupClick(wxCommandEvent &event, hdDrawingView *view);
|
||||
bool fkFromPk;
|
||||
bool fkMandatory;
|
||||
bool fkOneToMany;
|
||||
bool fkIdentifying;
|
||||
bool matchSimple;
|
||||
bool paintingFkColumns;
|
||||
actionKind onUpdateAction, onDeleteAction;
|
||||
wxString constraintName;
|
||||
|
||||
int ukIndex;
|
||||
columnsHashMap chm;
|
||||
ddTableFigure *disconnectedEndTable;
|
||||
};
|
||||
|
||||
#endif
|
||||
52
include/dd/dditems/figures/ddRelationshipItem.h
Normal file
52
include/dd/dditems/figures/ddRelationshipItem.h
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddRelationshipFigure.h - Item to keep track of foreign keys between tables in a relationship.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDRELATIONSHIPITEM_H
|
||||
#define DDRELATIONSHIPITEM_H
|
||||
#include "hotdraw/figures/hdLineConnection.h"
|
||||
#include "dd/dditems/figures/ddTableFigure.h"
|
||||
#include "dd/dditems/figures/ddColumnFigure.h"
|
||||
|
||||
class ddRelationshipItem : public hdObject
|
||||
{
|
||||
public:
|
||||
ddRelationshipItem();
|
||||
ddRelationshipItem(ddRelationshipFigure *owner, ddColumnFigure *originalColumn, ddTableFigure *destination, ddColumnOptionType type, ddColumnType colType, ddColumnFigure *existingColumn = NULL);
|
||||
~ddRelationshipItem();
|
||||
void initRelationshipItemValues(ddRelationshipFigure *owner, ddTableFigure *destination, bool fromExistingColumn, ddColumnFigure *fkCol, ddColumnFigure *sourceCol, wxString initialColName);
|
||||
wxString originalStartColName;
|
||||
ddColumnFigure *original;
|
||||
ddColumnFigure *fkColumn;
|
||||
|
||||
|
||||
wxString autoGenerateNameForFk();
|
||||
void syncAutoFkName();
|
||||
|
||||
ddTableFigure *getDestinationTable()
|
||||
{
|
||||
return destinationTable;
|
||||
};
|
||||
bool isAutomaticallyGenerated();
|
||||
bool relationIsIdentifying();
|
||||
bool relationIsMandatory();
|
||||
bool isForeignKeyFromPk();
|
||||
wxString sourceTableName();
|
||||
wxString destTableName();
|
||||
|
||||
|
||||
private:
|
||||
bool fkIsAutoGenerated;
|
||||
ddTableFigure *destinationTable;
|
||||
ddRelationshipFigure *ownerRel;
|
||||
wxString generatedName; //avoid linux bug
|
||||
};
|
||||
|
||||
#endif
|
||||
34
include/dd/dditems/figures/ddRelationshipTerminal.h
Normal file
34
include/dd/dditems/figures/ddRelationshipTerminal.h
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddRelationshipTerminal.h - Draw inverse arrows at fk terminal based on kind of relationship.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDRELATIONSHIPTERMINAL_H
|
||||
#define DDRELATIONSHIPTERMINAL_H
|
||||
#include "hotdraw/figures/hdLineTerminal.h"
|
||||
#include "hotdraw/utilities/hdPoint.h"
|
||||
#include "dd/dditems/figures/ddRelationshipFigure.h"
|
||||
|
||||
|
||||
|
||||
class ddRelationshipTerminal : public hdLineTerminal
|
||||
{
|
||||
public:
|
||||
ddRelationshipTerminal(ddRelationshipFigure *owner, bool endFigureTerminal);
|
||||
~ddRelationshipTerminal();
|
||||
virtual hdPoint &draw (wxBufferedDC &context, hdPoint &a, hdPoint &b, hdDrawingView *view);
|
||||
protected:
|
||||
|
||||
private:
|
||||
double lastFactor;
|
||||
ddRelationshipFigure *ownerFigure;
|
||||
bool endTerminal;
|
||||
hdPoint value;
|
||||
};
|
||||
#endif
|
||||
191
include/dd/dditems/figures/ddTableFigure.h
Normal file
191
include/dd/dditems/figures/ddTableFigure.h
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddTableFigure.h - Draw table figure of a model
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDTABLEFIGURE_H
|
||||
#define DDTABLEFIGURE_H
|
||||
#include "hotdraw/figures/hdCompositeFigure.h"
|
||||
#include "hotdraw/figures/hdRectangleFigure.h"
|
||||
#include "hotdraw/figures/hdSimpleTextFigure.h"
|
||||
#include "dd/dditems/figures/ddTextTableItemFigure.h"
|
||||
#include "dd/dditems/figures/ddColumnFigure.h"
|
||||
#include "dd/ddmodel/ddDatabaseDesign.h"
|
||||
|
||||
class ddScrollBarHandle;
|
||||
class ddRelationshipFigure;
|
||||
class hdDrawing;
|
||||
|
||||
class ddTableFigure : public hdCompositeFigure
|
||||
{
|
||||
public:
|
||||
ddTableFigure(wxString tableName, int x, int y);
|
||||
ddTableFigure(wxString tableName, int posIdx, int x, int y);
|
||||
void InitTableValues(wxArrayString UniqueKeysName, wxString primaryKeyName, int bdc, int bdi, int maxcolsi, int minidxsi, int maxidxsi, int colsrs, int colsw, int idxsrs, int idxsw);
|
||||
void Init(wxString tableName, int x, int y);
|
||||
hdMultiPosRect &getBasicDisplayBox();
|
||||
~ddTableFigure();
|
||||
|
||||
//Diagrams related functions
|
||||
virtual void AddPosForNewDiagram();
|
||||
virtual void RemovePosOfDiagram(int posIdx);
|
||||
|
||||
//add remove items
|
||||
ddColumnFigure *getColByName(wxString name);
|
||||
void addColumn(int posIdx, ddColumnFigure *column);
|
||||
void addColumnFromStorage(ddColumnFigure *column);
|
||||
void syncInternalsPosAt(int posIdx, int x, int y);
|
||||
void syncInternalsPosAt(wxArrayInt &x, wxArrayInt &y);
|
||||
void removeColumn(int posIdx, ddColumnFigure *column);
|
||||
|
||||
//movement
|
||||
void manuallyNotifyChange(int posIdx)
|
||||
{
|
||||
changed(posIdx);
|
||||
};
|
||||
virtual void basicMoveBy(int posIdx, int x, int y);
|
||||
|
||||
//show messages to set fk destination
|
||||
void setSelectFkDestMode(bool value);
|
||||
|
||||
//delete hack tables
|
||||
void processDeleteAlert(hdDrawing *drawing);
|
||||
|
||||
//columns scrolls
|
||||
void updateTableSize(bool notifyChange = true);
|
||||
void recalculateColsPos(int posIdx);
|
||||
void setColsRowsWindow(int num);
|
||||
hdMultiPosRect &getColsSpace();
|
||||
hdMultiPosRect &getFullSpace();
|
||||
hdMultiPosRect &getTitleRect();
|
||||
int getTotalColumns();
|
||||
int getColumnsWindow();
|
||||
int getTopColWindowIndex();
|
||||
void setColumnsWindow(int posIdx, int value, bool maximize = false);
|
||||
void columnsWindowUp(int posIdx);
|
||||
void columnsWindowDown(int posIdx);
|
||||
int getFiguresMaxWidth();
|
||||
int getColDefaultHeight(wxFont font);
|
||||
|
||||
//metadata
|
||||
wxString getTableName();
|
||||
wxString getShortTableName();
|
||||
wxString generateSQLCreate(wxString schemaName);
|
||||
wxString generateSQLAlterPks(wxString schemaName);
|
||||
wxString generateSQLAlterFks(wxString schemaName);
|
||||
wxString generateSQLAlterUks(wxString schemaName);
|
||||
wxString generateAltersTable(pgConn *connection, wxString schemaName, ddDatabaseDesign *design);
|
||||
wxArrayString getAllColumnsNames();
|
||||
wxArrayString getAllFkSourceColsNames(bool pk, int ukIndex = -1);
|
||||
ddColumnFigure *getColumnByName(wxString name);
|
||||
bool validateTable(wxString &errors);
|
||||
|
||||
//uk pk constraints
|
||||
void setPkConstraintName(wxString name);
|
||||
wxString getPkConstraintName();
|
||||
wxArrayString &getUkConstraintsNames();
|
||||
bool disablePrimaryKey();
|
||||
bool enablePrimaryKey();
|
||||
|
||||
//fk related
|
||||
void updateFkObservers();
|
||||
void updateSizeOfObservers();
|
||||
void prepareForDeleteFkColumn(ddColumnFigure *column);
|
||||
|
||||
//ScrollBar persistence related
|
||||
int getBeginDrawCols()
|
||||
{
|
||||
return beginDrawCols;
|
||||
};
|
||||
int getBeginDrawIdxs()
|
||||
{
|
||||
return beginDrawIdxs;
|
||||
};
|
||||
int getMaxColIndex()
|
||||
{
|
||||
return maxColIndex;
|
||||
};
|
||||
int getMinIdxIndex()
|
||||
{
|
||||
return minIdxIndex;
|
||||
};
|
||||
int getMaxIdxIndex()
|
||||
{
|
||||
return maxIdxIndex;
|
||||
};
|
||||
int getColsRowsSize()
|
||||
{
|
||||
return colsRowsSize;
|
||||
};
|
||||
int getColsWindow()
|
||||
{
|
||||
return colsWindow;
|
||||
};
|
||||
int getIdxsRowsSize()
|
||||
{
|
||||
return idxsRowsSize;
|
||||
};
|
||||
int getIdxsWindow()
|
||||
{
|
||||
return idxsWindow;
|
||||
};
|
||||
|
||||
//Temporary alter table instead of create Helper
|
||||
bool getBelongsToSchema()
|
||||
{
|
||||
return belongsToSchema;
|
||||
};
|
||||
void setBelongsToSchema(bool value)
|
||||
{
|
||||
belongsToSchema = value;
|
||||
};
|
||||
|
||||
protected:
|
||||
//drawing
|
||||
virtual void basicDraw(wxBufferedDC &context, hdDrawingView *view);
|
||||
virtual void basicDrawSelected(wxBufferedDC &context, hdDrawingView *view);
|
||||
|
||||
private:
|
||||
//Temporary alter table instead of create Helper
|
||||
bool belongsToSchema;
|
||||
|
||||
//Main Rectangle Sizes
|
||||
hdMultiPosRect fullSizeRect, titleRect, titleColsRect, colsRect, titleIndxsRect, indxsRect;
|
||||
hdMultiPosRect unScrolledColsRect, unScrolledFullSizeRect, unScrolledTitleRect;
|
||||
|
||||
//Rectangle item counters
|
||||
int colsRowsSize, colsWindow, idxsRowsSize, idxsWindow;
|
||||
|
||||
//vector indexes
|
||||
int maxColIndex, minIdxIndex, maxIdxIndex;
|
||||
|
||||
//position
|
||||
int beginDrawCols, beginDrawIdxs;
|
||||
|
||||
//Default Figures
|
||||
hdRectangleFigure *rectangleFigure;
|
||||
ddTextTableItemFigure *tableTitle;
|
||||
|
||||
//helper variables
|
||||
bool selectingFkDestination;
|
||||
int internalPadding, externalPadding;
|
||||
bool calcScrolled;
|
||||
|
||||
//specials handles
|
||||
ddScrollBarHandle *scrollbar;
|
||||
|
||||
//methods
|
||||
int getHeightFontMetric(wxString text, wxFont font);
|
||||
void calcInternalSubAreas(int posIdx);
|
||||
|
||||
//pk uk(s)
|
||||
wxString pkName;
|
||||
wxArrayString ukNames;
|
||||
};
|
||||
#endif
|
||||
89
include/dd/dditems/figures/ddTextTableItemFigure.h
Normal file
89
include/dd/dditems/figures/ddTextTableItemFigure.h
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddTextTableItemFigure.h -
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDTEXTTABLEITEMFIGURE_H
|
||||
#define DDTEXTTABLEITEMFIGURE_H
|
||||
|
||||
|
||||
#include <wx/arrstr.h>
|
||||
|
||||
#include "hotdraw/figures/hdSimpleTextFigure.h"
|
||||
#include "dd/dditems/utilities/ddDataType.h"
|
||||
|
||||
enum
|
||||
{
|
||||
MNU_DDADDCOLUMN = 321,
|
||||
MNU_DELCOLUMN,
|
||||
MNU_RENAMECOLUMN,
|
||||
MNU_AUTONAMCOLUMN,
|
||||
MNU_NOTNULL,
|
||||
MNU_PKEY,
|
||||
MNU_UKEY,
|
||||
MNU_TYPESERIAL,
|
||||
MNU_TYPEBOOLEAN,
|
||||
MNU_TYPEINTEGER,
|
||||
MNU_TYPEMONEY,
|
||||
MNU_TYPEVARCHAR,
|
||||
MNU_TYPEOTHER,
|
||||
MNU_TYPEPKEY_CONSTRAINTNAME,
|
||||
MNU_TYPEUKEY_CONSTRAINTNAME,
|
||||
MNU_DELTABLE
|
||||
};
|
||||
|
||||
class ddColumnFigure;
|
||||
class ddTableFigure;
|
||||
|
||||
class ddTextTableItemFigure : public hdSimpleTextFigure
|
||||
{
|
||||
public:
|
||||
ddTextTableItemFigure(wxString &columnName, ddDataType dataType, ddColumnFigure *owner);
|
||||
~ddTextTableItemFigure();
|
||||
virtual wxString &getText(bool extended = false);
|
||||
wxString getType(bool raw = false);
|
||||
virtual void setAlias(wxString alias);
|
||||
virtual wxString getAlias();
|
||||
virtual void setOneTimeNoAlias();
|
||||
virtual void createMenu(wxMenu &mnu);
|
||||
virtual const wxArrayString dataTypes();
|
||||
virtual void OnGenericPopupClick(wxCommandEvent &event, hdDrawingView *view);
|
||||
virtual void setText(wxString textString);
|
||||
virtual ddColumnFigure *getOwnerColumn();
|
||||
virtual void setOwnerColumn(ddColumnFigure *column);
|
||||
virtual void setShowDataType(bool value);
|
||||
virtual bool getShowDataType()
|
||||
{
|
||||
return showDataType;
|
||||
};
|
||||
hdITool *CreateFigureTool(hdDrawingView *view, hdITool *defaultTool);
|
||||
virtual void displayBoxUpdate();
|
||||
void recalculateDisplayBox();
|
||||
int getTextWidth();
|
||||
int getTextHeight();
|
||||
ddDataType getDataType();
|
||||
void setDataType(ddDataType type);
|
||||
void setOwnerTable(ddTableFigure *table); //only used by columns working as table title figure for setAlias method
|
||||
int getPrecision();
|
||||
int getScale();
|
||||
void setPrecision(int value);
|
||||
void setScale(int value);
|
||||
protected:
|
||||
ddColumnFigure *ownerColumn;
|
||||
ddTableFigure *ownerTable;
|
||||
wxString colAlias;
|
||||
private:
|
||||
ddDataType columnType;
|
||||
wxString out;
|
||||
bool showDataType;
|
||||
bool showAlias;
|
||||
bool oneTimeNoAlias;
|
||||
int precision;
|
||||
int scale;
|
||||
};
|
||||
#endif
|
||||
25
include/dd/dditems/figures/module.mk
Normal file
25
include/dd/dditems/figures/module.mk
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#######################################################################
|
||||
#
|
||||
# pgAdmin III - PostgreSQL Tools
|
||||
#
|
||||
# Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
# This software is released under the PostgreSQL Licence
|
||||
#
|
||||
# module.mk - pgadmin/include/dd/dditems/figures/ Makefile fragment
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
pgadmin3_SOURCES += \
|
||||
include/dd/dditems/figures/ddColumnFigure.h \
|
||||
include/dd/dditems/figures/ddColumnKindIcon.h \
|
||||
include/dd/dditems/figures/ddColumnOptionIcon.h \
|
||||
include/dd/dditems/figures/ddRelationshipFigure.h \
|
||||
include/dd/dditems/figures/ddRelationshipItem.h \
|
||||
include/dd/dditems/figures/ddRelationshipTerminal.h \
|
||||
include/dd/dditems/figures/ddTableFigure.h \
|
||||
include/dd/dditems/figures/ddTextTableItemFigure.h
|
||||
|
||||
EXTRA_DIST += \
|
||||
include/dd/dditems/figures/module.mk
|
||||
|
||||
include include/dd/dditems/figures/xml/module.mk
|
||||
66
include/dd/dditems/figures/xml/ddXmlStorage.h
Normal file
66
include/dd/dditems/figures/xml/ddXmlStorage.h
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// hdAbstractFigure.h - Base class for all figures with attributes (line size, fonts and others)
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDXMLSTORAGE_H
|
||||
#define DDXMLSTORAGE_H
|
||||
|
||||
#include "hotdraw/figures/xml/hdStorage.h"
|
||||
#include "dd/ddmodel/ddDatabaseDesign.h"
|
||||
#include <ctl/ctlAuiNotebook.h>
|
||||
|
||||
class ddXmlStorage : public hdStorage
|
||||
{
|
||||
public:
|
||||
ddXmlStorage();
|
||||
|
||||
//Generic part
|
||||
static bool Read(xmlTextReaderPtr reader);
|
||||
static bool Write(xmlTextWriterPtr writer, hdIFigure *figure);
|
||||
static void setModel(ddDatabaseDesign *sourceDesign);
|
||||
static void setNotebook(ctlAuiNotebook *notebook);
|
||||
static wxString getModelDTD();
|
||||
|
||||
//Write xml info Database Designer Related
|
||||
static void WriteLocal( xmlTextWriterPtr writer, ddColumnOptionIcon *figure);
|
||||
static void WriteLocal( xmlTextWriterPtr writer, ddColumnKindIcon *figure);
|
||||
static void WriteLocal( xmlTextWriterPtr writer, ddTextTableItemFigure *figure);
|
||||
static void WriteLocal( xmlTextWriterPtr writer, ddColumnFigure *figure);
|
||||
static void WriteLocal( xmlTextWriterPtr writer, ddTableFigure *figure);
|
||||
static void WriteLocal( xmlTextWriterPtr writer, ddRelationshipFigure *figure);
|
||||
static void WriteLocal( xmlTextWriterPtr writer, ddRelationshipItem *item);
|
||||
static void WriteLocal( xmlTextWriterPtr writer, hdDrawing *diagram);
|
||||
static void StarDiagrams( xmlTextWriterPtr writer);
|
||||
static void EndDiagrams( xmlTextWriterPtr writer);
|
||||
static void StartModel( xmlTextWriterPtr writer, ddDatabaseDesign *design);
|
||||
static void EndModel( xmlTextWriterPtr writer);
|
||||
static bool processResult(int value);
|
||||
|
||||
//Generic node processing functions
|
||||
static wxString getNodeName(xmlTextReaderPtr reader);
|
||||
static int getNodeType(xmlTextReaderPtr reader);
|
||||
static wxString getNodeValue(xmlTextReaderPtr reader);
|
||||
|
||||
//Read xml info Database Designer Related
|
||||
static void selectReader(xmlTextReaderPtr reader);
|
||||
static void checkVersion(xmlTextReaderPtr reader);
|
||||
static ddTableFigure *getTable(xmlTextReaderPtr reader);
|
||||
static ddColumnFigure *getColumn(xmlTextReaderPtr reader, ddTableFigure *colOwner);
|
||||
static ddRelationshipFigure *getRelationship(xmlTextReaderPtr reader);
|
||||
static ddRelationshipItem *getRelationshipItem(xmlTextReaderPtr reader, ddRelationshipFigure *itemOwner, ddTableFigure *source, ddTableFigure *destination);
|
||||
static void initDiagrams(xmlTextReaderPtr reader);
|
||||
static void initialModelParse(xmlTextReaderPtr reader);
|
||||
|
||||
private:
|
||||
|
||||
static ddDatabaseDesign *design;
|
||||
static ctlAuiNotebook *tabs;
|
||||
};
|
||||
#endif
|
||||
16
include/dd/dditems/figures/xml/module.mk
Normal file
16
include/dd/dditems/figures/xml/module.mk
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#######################################################################
|
||||
#
|
||||
# pgAdmin III - PostgreSQL Tools
|
||||
#
|
||||
# Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
# This software is released under the PostgreSQL Licence
|
||||
#
|
||||
# module.mk - pgadmin/include/dd/dditems/figures/xml Makefile fragment
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
pgadmin3_SOURCES += \
|
||||
include/dd/dditems/figures/xml/ddXmlStorage.h
|
||||
|
||||
EXTRA_DIST += \
|
||||
include/dd/dditems/figures/xml/module.mk
|
||||
32
include/dd/dditems/handles/ddAddColButtonHandle.h
Normal file
32
include/dd/dditems/handles/ddAddColButtonHandle.h
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddAddColButtonHandle.h - A handle for a table figure that allow to graphically add columns
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDADDCOLBUTTONHANDLE_H
|
||||
#define DDADDCOLBUTTONHANDLE_H
|
||||
|
||||
#include "hotdraw/handles/hdButtonHandle.h"
|
||||
|
||||
class ddAddColButtonHandle : public hdButtonHandle
|
||||
{
|
||||
public:
|
||||
ddAddColButtonHandle(hdIFigure *owner, hdILocator *buttonLocator , wxBitmap &buttonImage, wxSize &size);
|
||||
~ddAddColButtonHandle();
|
||||
|
||||
virtual void invokeStart(hdMouseEvent &event, hdDrawingView *view);
|
||||
virtual void invokeStep(hdMouseEvent &event, hdDrawingView *view);
|
||||
virtual void invokeEnd(hdMouseEvent &event, hdDrawingView *view);
|
||||
protected:
|
||||
|
||||
private:
|
||||
wxImage handleCursorImage;
|
||||
wxCursor handleCursor;
|
||||
};
|
||||
#endif
|
||||
32
include/dd/dditems/handles/ddAddFkButtonHandle.h
Normal file
32
include/dd/dditems/handles/ddAddFkButtonHandle.h
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddAddFkButtonHandle.h - A handle for a table figure that allow to graphically add relationships (fk)
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDADDFKBUTTONHANDLE_H
|
||||
#define DDADDFKBUTTONHANDLE_H
|
||||
|
||||
#include "hotdraw/handles/hdButtonHandle.h"
|
||||
|
||||
class ddAddFkButtonHandle : public hdButtonHandle
|
||||
{
|
||||
public:
|
||||
ddAddFkButtonHandle(hdIFigure *owner, hdILocator *buttonLocator , wxBitmap &buttonImage, wxSize &size);
|
||||
~ddAddFkButtonHandle();
|
||||
|
||||
virtual void invokeStart(hdMouseEvent &event, hdDrawingView *view);
|
||||
virtual void invokeStep(hdMouseEvent &event, hdDrawingView *view);
|
||||
virtual void invokeEnd(hdMouseEvent &event, hdDrawingView *view);
|
||||
protected:
|
||||
|
||||
private:
|
||||
wxImage handleCursorImage;
|
||||
wxCursor handleCursor;
|
||||
};
|
||||
#endif
|
||||
34
include/dd/dditems/handles/ddMinMaxTableButtonHandle.h
Normal file
34
include/dd/dditems/handles/ddMinMaxTableButtonHandle.h
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddMinMaxTableButtonHandle.h - A handle for a table figure that allow to graphically minimize or maximize table window size
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDMINMAXTABLEBUTTONHANDLE_H
|
||||
#define DDMINMAXTABLEBUTTONHANDLE_H
|
||||
|
||||
#include "hotdraw/handles/hdButtonHandle.h"
|
||||
|
||||
class ddMinMaxTableButtonHandle : public hdButtonHandle
|
||||
{
|
||||
public:
|
||||
ddMinMaxTableButtonHandle(hdIFigure *owner, hdILocator *buttonLocator , wxBitmap &buttonImage, wxBitmap &buttonSecondImage, wxSize &size);
|
||||
~ddMinMaxTableButtonHandle();
|
||||
|
||||
virtual void invokeStart(hdMouseEvent &event, hdDrawingView *view);
|
||||
virtual void invokeStep(hdMouseEvent &event, hdDrawingView *view);
|
||||
virtual void invokeEnd(hdMouseEvent &event, hdDrawingView *view);
|
||||
protected:
|
||||
|
||||
private:
|
||||
wxImage handleCursorImage;
|
||||
wxCursor handleCursor;
|
||||
wxBitmap buttonMaximizeImage, tmpImage;
|
||||
bool showFirst;
|
||||
};
|
||||
#endif
|
||||
32
include/dd/dditems/handles/ddRemoveTableButtonHandle.h
Normal file
32
include/dd/dditems/handles/ddRemoveTableButtonHandle.h
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddRemoveTableButtonHandle.h - A handle for a table figure that allow to delete it
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDREMOVETABLEBUTTONHANDLE_H
|
||||
#define DDREMOVETABLEBUTTONHANDLE_H
|
||||
|
||||
#include "hotdraw/handles/hdButtonHandle.h"
|
||||
|
||||
class ddRemoveTableButtonHandle : public hdButtonHandle
|
||||
{
|
||||
public:
|
||||
ddRemoveTableButtonHandle(hdIFigure *owner, hdILocator *buttonLocator , wxBitmap &buttonImage, wxSize &size);
|
||||
~ddRemoveTableButtonHandle();
|
||||
|
||||
virtual void invokeStart(hdMouseEvent &event, hdDrawingView *view);
|
||||
virtual void invokeStep(hdMouseEvent &event, hdDrawingView *view);
|
||||
virtual void invokeEnd(hdMouseEvent &event, hdDrawingView *view);
|
||||
protected:
|
||||
|
||||
private:
|
||||
wxImage handleCursorImage;
|
||||
wxCursor handleCursor;
|
||||
};
|
||||
#endif
|
||||
46
include/dd/dditems/handles/ddScrollBarHandle.h
Normal file
46
include/dd/dditems/handles/ddScrollBarHandle.h
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddScrollBarHandle.h - A handle for a table figure that allow to scroll it when table is not in full size
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDSCROLLBARHANDLE_H
|
||||
#define DDSCROLLBARHANDLE_H
|
||||
|
||||
#include "hotdraw/handles/hdIHandle.h"
|
||||
#include "hotdraw/handles/hdLocatorHandle.h"
|
||||
#include "hotdraw/utilities/hdRect.h"
|
||||
#include "hotdraw/utilities/hdPoint.h"
|
||||
#include "dd/dditems/figures/ddTableFigure.h"
|
||||
|
||||
|
||||
class ddScrollBarHandle : public hdLocatorHandle
|
||||
{
|
||||
public:
|
||||
ddScrollBarHandle(ddTableFigure *owner, hdILocator *scrollBarLocator , wxSize &size);
|
||||
~ddScrollBarHandle();
|
||||
|
||||
|
||||
virtual void draw(wxBufferedDC &context, hdDrawingView *view);
|
||||
virtual hdPoint &locate(int posIdx);
|
||||
virtual wxCursor createCursor();
|
||||
virtual void invokeStart(hdMouseEvent &event, hdDrawingView *view);
|
||||
virtual void invokeStep(hdMouseEvent &event, hdDrawingView *view);
|
||||
virtual void invokeEnd(hdMouseEvent &event, hdDrawingView *view);
|
||||
virtual hdRect &getDisplayBox(int posIdx);
|
||||
protected:
|
||||
private:
|
||||
hdPoint pointLocate;
|
||||
hdILocator *scrollLocator;
|
||||
ddTableFigure *table;
|
||||
wxBitmap upBitmap, downBitmap;
|
||||
wxSize barSize;
|
||||
int anchorY;
|
||||
|
||||
};
|
||||
#endif
|
||||
36
include/dd/dditems/handles/ddSouthTableSizeHandle.h
Normal file
36
include/dd/dditems/handles/ddSouthTableSizeHandle.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddSouthTableSizeHandle.h - Allow to change table size by using drag and drop from south side of table rectangle
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDSOUTHTABLESIZEHANDLE_H
|
||||
#define DDSOUTHTABLESIZEHANDLE_H
|
||||
|
||||
#include "hotdraw/handles/hdLocatorHandle.h"
|
||||
|
||||
class ddTableFigure;
|
||||
|
||||
class ddSouthTableSizeHandle : public hdLocatorHandle
|
||||
{
|
||||
public:
|
||||
ddSouthTableSizeHandle(ddTableFigure *owner, hdILocator *locator);
|
||||
~ddSouthTableSizeHandle();
|
||||
virtual wxCursor createCursor();
|
||||
virtual void draw(wxBufferedDC &context, hdDrawingView *view);
|
||||
virtual hdRect &getDisplayBox(int posIdx);
|
||||
virtual void invokeStart(hdMouseEvent &event, hdDrawingView *view);
|
||||
virtual void invokeStep(hdMouseEvent &event, hdDrawingView *view);
|
||||
virtual void invokeEnd(hdMouseEvent &event, hdDrawingView *view);
|
||||
protected:
|
||||
|
||||
private:
|
||||
int anchorY;
|
||||
|
||||
};
|
||||
#endif
|
||||
21
include/dd/dditems/handles/module.mk
Normal file
21
include/dd/dditems/handles/module.mk
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#######################################################################
|
||||
#
|
||||
# pgAdmin III - PostgreSQL Tools
|
||||
#
|
||||
# Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
# This software is released under the PostgreSQL Licence
|
||||
#
|
||||
# module.mk - pgadmin/include/dd/dditems/handles/ Makefile fragment
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
pgadmin3_SOURCES += \
|
||||
include/dd/dditems/handles/ddAddColButtonHandle.h \
|
||||
include/dd/dditems/handles/ddAddFkButtonHandle.h \
|
||||
include/dd/dditems/handles/ddMinMaxTableButtonHandle.h \
|
||||
include/dd/dditems/handles/ddRemoveTableButtonHandle.h \
|
||||
include/dd/dditems/handles/ddScrollBarHandle.h \
|
||||
include/dd/dditems/handles/ddSouthTableSizeHandle.h
|
||||
|
||||
EXTRA_DIST += \
|
||||
include/dd/dditems/handles/module.mk
|
||||
30
include/dd/dditems/locators/ddAddColLocator.h
Normal file
30
include/dd/dditems/locators/ddAddColLocator.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddAddColLocator.h - Locate table add column button inside a table.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDADDCOLLOCATOR_H
|
||||
#define DDADDCOLLOCATOR_H
|
||||
|
||||
#include "hotdraw/locators/hdILocator.h"
|
||||
#include "hotdraw/figures/hdIFigure.h"
|
||||
|
||||
class ddAddColLocator : public hdILocator
|
||||
{
|
||||
public:
|
||||
ddAddColLocator();
|
||||
~ddAddColLocator();
|
||||
|
||||
virtual hdPoint &locate(int posIdx, hdIFigure *owner);
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
};
|
||||
#endif
|
||||
30
include/dd/dditems/locators/ddAddFkLocator.h
Normal file
30
include/dd/dditems/locators/ddAddFkLocator.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddAddFkLocator.h - Locate table add fk relationship button inside a table.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDADDFKLOCATOR_H
|
||||
#define DDADDFKLOCATOR_H
|
||||
|
||||
#include "hotdraw/locators/hdILocator.h"
|
||||
#include "hotdraw/figures/hdIFigure.h"
|
||||
|
||||
class ddAddFkLocator : public hdILocator
|
||||
{
|
||||
public:
|
||||
ddAddFkLocator();
|
||||
~ddAddFkLocator();
|
||||
|
||||
virtual hdPoint &locate(int posIdx, hdIFigure *owner);
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
};
|
||||
#endif
|
||||
30
include/dd/dditems/locators/ddMinMaxTableLocator.h
Normal file
30
include/dd/dditems/locators/ddMinMaxTableLocator.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddMinMaxTableLocator.h - Locate table minimize/maximize button inside a table.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDMINMAXTABLELOCATOR_H
|
||||
#define DDMINMAXTABLELOCATOR_H
|
||||
|
||||
#include "hotdraw/locators/hdILocator.h"
|
||||
#include "hotdraw/figures/hdIFigure.h"
|
||||
|
||||
class ddMinMaxTableLocator : public hdILocator
|
||||
{
|
||||
public:
|
||||
ddMinMaxTableLocator();
|
||||
~ddMinMaxTableLocator();
|
||||
|
||||
virtual hdPoint &locate(int posIdx, hdIFigure *owner);
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
};
|
||||
#endif
|
||||
30
include/dd/dditems/locators/ddRemoveTableLocator.h
Normal file
30
include/dd/dditems/locators/ddRemoveTableLocator.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddRemoveColLocator.cpp - Locate table delete button inside a table.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDREMOVETABLELOCATOR_H
|
||||
#define DDREMOVETABLELOCATOR_H
|
||||
|
||||
#include "hotdraw/locators/hdILocator.h"
|
||||
#include "hotdraw/figures/hdIFigure.h"
|
||||
|
||||
class ddRemoveTableLocator : public hdILocator
|
||||
{
|
||||
public:
|
||||
ddRemoveTableLocator();
|
||||
~ddRemoveTableLocator();
|
||||
|
||||
virtual hdPoint &locate(int posIdx, hdIFigure *owner);
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
};
|
||||
#endif
|
||||
31
include/dd/dditems/locators/ddScrollBarTableLocator.h
Normal file
31
include/dd/dditems/locators/ddScrollBarTableLocator.h
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddScrollBarTableLocator.h - Locate table scrollbar inside a table.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDSCROLLBARTABLELOCATOR_H
|
||||
#define DDSCROLLBARTABLELOCATOR_H
|
||||
|
||||
#include "hotdraw/locators/hdILocator.h"
|
||||
#include "hotdraw/figures/hdIFigure.h"
|
||||
|
||||
class ddScrollBarTableLocator : public hdILocator
|
||||
{
|
||||
public:
|
||||
ddScrollBarTableLocator();
|
||||
~ddScrollBarTableLocator();
|
||||
|
||||
virtual hdPoint &locate(int posIdx, hdIFigure *owner);
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
#endif
|
||||
31
include/dd/dditems/locators/ddTableBottomLocator.h
Normal file
31
include/dd/dditems/locators/ddTableBottomLocator.h
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddTableBottomLocator.h - Locate bottom (south) of table for use of south table size handle.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDTABLEBOTTOMLOCATOR_H
|
||||
#define DDTABLEBOTTOMLOCATOR_H
|
||||
|
||||
#include "hotdraw/locators/hdILocator.h"
|
||||
#include "hotdraw/figures/hdIFigure.h"
|
||||
|
||||
class ddTableBottomLocator : public hdILocator
|
||||
{
|
||||
public:
|
||||
ddTableBottomLocator();
|
||||
~ddTableBottomLocator();
|
||||
|
||||
virtual hdPoint &locate(int posIdx, hdIFigure *owner);
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
#endif
|
||||
21
include/dd/dditems/locators/module.mk
Normal file
21
include/dd/dditems/locators/module.mk
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#######################################################################
|
||||
#
|
||||
# pgAdmin III - PostgreSQL Tools
|
||||
#
|
||||
# Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
# This software is released under the PostgreSQL Licence
|
||||
#
|
||||
# module.mk - pgadmin/include/dd/dditems/locators/ Makefile fragment
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
pgadmin3_SOURCES += \
|
||||
include/dd/dditems/locators/ddAddColLocator.h \
|
||||
include/dd/dditems/locators/ddAddFkLocator.h \
|
||||
include/dd/dditems/locators/ddMinMaxTableLocator.h \
|
||||
include/dd/dditems/locators/ddRemoveTableLocator.h \
|
||||
include/dd/dditems/locators/ddScrollBarTableLocator.h \
|
||||
include/dd/dditems/locators/ddTableBottomLocator.h
|
||||
|
||||
EXTRA_DIST += \
|
||||
include/dd/dditems/locators/module.mk
|
||||
19
include/dd/dditems/module.mk
Normal file
19
include/dd/dditems/module.mk
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#######################################################################
|
||||
#
|
||||
# pgAdmin III - PostgreSQL Tools
|
||||
#
|
||||
# Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
# This software is released under the PostgreSQL Licence
|
||||
#
|
||||
# module.mk - pgadmin/include/dd/dditems/ Makefile fragment
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
include include/dd/dditems/figures/module.mk
|
||||
include include/dd/dditems/handles/module.mk
|
||||
include include/dd/dditems/locators/module.mk
|
||||
include include/dd/dditems/tools/module.mk
|
||||
include include/dd/dditems/utilities/module.mk
|
||||
|
||||
EXTRA_DIST += \
|
||||
include/dd/dditems/module.mk
|
||||
34
include/dd/dditems/tools/ddColumnFigureTool.h
Normal file
34
include/dd/dditems/tools/ddColumnFigureTool.h
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddColumnFigureTool.h - Improvement to hdFigureTool to work with composite table figures
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDCOLUMNFIGURETOOL_H
|
||||
#define DDCOLUMNFIGURETOOL_H
|
||||
|
||||
#include "hotdraw/tools/hdFigureTool.h"
|
||||
|
||||
|
||||
class ddColumnFigureTool : public hdFigureTool
|
||||
{
|
||||
public:
|
||||
ddColumnFigureTool(hdDrawingView *view, hdIFigure *fig, hdITool *dt);
|
||||
~ddColumnFigureTool();
|
||||
virtual void setDefaultTool(hdITool *dt);
|
||||
virtual hdITool *getDefaultTool();
|
||||
virtual void mouseDown(hdMouseEvent &event); //Mouse Right Click
|
||||
virtual void activate(hdDrawingView *view);
|
||||
virtual void deactivate(hdDrawingView *view);
|
||||
virtual void setDelegateTool(hdDrawingView *view, hdITool *tool);
|
||||
virtual hdITool *getDelegateTool();
|
||||
protected:
|
||||
hdITool *delegateTool;
|
||||
private:
|
||||
};
|
||||
#endif
|
||||
33
include/dd/dditems/tools/ddColumnTextTool.h
Normal file
33
include/dd/dditems/tools/ddColumnTextTool.h
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddColumnTextTool.h - Modification of simple text tool for editing composite figure columns
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDCOLUMNTEXTTOOL_H
|
||||
#define DDCOLUMNTEXTTOOL_H
|
||||
|
||||
#include "hotdraw/tools/hdSimpleTextTool.h"
|
||||
#include "dd/dditems/figures/ddTextTableItemFigure.h"
|
||||
|
||||
|
||||
class ddColumnTextTool : public hdSimpleTextTool
|
||||
{
|
||||
|
||||
public:
|
||||
ddColumnTextTool(hdDrawingView *view, hdIFigure *fig, hdITool *dt, bool fastEdit = true, wxString dialogCaption = wxEmptyString, wxString dialogMessage = wxEmptyString);
|
||||
~ddColumnTextTool();
|
||||
virtual void mouseDown(hdMouseEvent &event); //Mouse Right Click
|
||||
virtual bool callDialog(hdDrawingView *view);
|
||||
// some events functions are needed but because a bug it were move to main View class as a hack.
|
||||
protected:
|
||||
private:
|
||||
ddTextTableItemFigure *colTextFigure;
|
||||
//Because a bug in the way wxwidgets connect events I can't declare it here, wxTextCtrl, instead I do it on the view.
|
||||
};
|
||||
#endif
|
||||
17
include/dd/dditems/tools/module.mk
Normal file
17
include/dd/dditems/tools/module.mk
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#######################################################################
|
||||
#
|
||||
# pgAdmin III - PostgreSQL Tools
|
||||
#
|
||||
# Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
# This software is released under the PostgreSQL Licence
|
||||
#
|
||||
# module.mk - pgadmin/include/dd/dditems/tools/ Makefile fragment
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
pgadmin3_SOURCES += \
|
||||
include/dd/dditems/tools/ddColumnFigureTool.h \
|
||||
include/dd/dditems/tools/ddColumnTextTool.h
|
||||
|
||||
EXTRA_DIST += \
|
||||
include/dd/dditems/tools/module.mk
|
||||
68
include/dd/dditems/utilities/ddDataType.h
Normal file
68
include/dd/dditems/utilities/ddDataType.h
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddDataType.h - data types related info for table use
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDDATATYPES_H
|
||||
#define DDDATATYPES_H
|
||||
|
||||
enum ddMenuColumn
|
||||
{
|
||||
add_column = 321,
|
||||
del_column,
|
||||
ren_column,
|
||||
change_datatype
|
||||
};
|
||||
|
||||
enum ddHiddenTypes
|
||||
{
|
||||
DDTABLEFIGURE = 100,
|
||||
DDRELATIONSHIPFIGURE = 200,
|
||||
DDCOLUMNFIGURE = 300,
|
||||
DDCOLUMNOPTIONICON = 400,
|
||||
DDCOLUMNKINDICON = 500,
|
||||
DDTEXTTABLEITEMFIGURE = 600
|
||||
};
|
||||
|
||||
enum ddDataType
|
||||
{
|
||||
dt_null = 0,
|
||||
dt_serial,
|
||||
dt_boolean,
|
||||
dt_integer,
|
||||
dt_money,
|
||||
dt_varchar, //(n)
|
||||
dt_bigint,
|
||||
dt_bit, //(n)
|
||||
dt_bytea,
|
||||
dt_char, //(n)
|
||||
dt_cidr,
|
||||
dt_circle,
|
||||
dt_date,
|
||||
dt_doubleprec,
|
||||
dt_inet,
|
||||
dt_interval, //(n)
|
||||
dt_line,
|
||||
dt_Lseg,
|
||||
dt_macaddr,
|
||||
dt_numeric, //(p,s)
|
||||
dt_path,
|
||||
dt_point,
|
||||
dt_polygon,
|
||||
dt_real,
|
||||
dt_smallint,
|
||||
dt_text,
|
||||
dt_time,
|
||||
dt_timestamp,
|
||||
dt_varbit //(n)
|
||||
};
|
||||
|
||||
static wxArrayString ddDatatypes;
|
||||
|
||||
#endif
|
||||
68
include/dd/dditems/utilities/ddPrecisionScaleDialog.h
Normal file
68
include/dd/dditems/utilities/ddPrecisionScaleDialog.h
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddPrecisionScaleDialog.h - Utility dialog class to allow user input of precision and scale
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDPRECISIONSCALEDIALOG_H
|
||||
#define DDPRECISIONSCALEDIALOG_H
|
||||
|
||||
class ddPrecisionScaleDialog : public pgDialog
|
||||
{
|
||||
public:
|
||||
ddPrecisionScaleDialog();
|
||||
~ddPrecisionScaleDialog();
|
||||
ddPrecisionScaleDialog( wxWindow *parent,
|
||||
const wxString &defaultValue1 = wxT("0"),
|
||||
const wxString &defaultValue2 = wxT("0")
|
||||
);
|
||||
|
||||
// Member initialization
|
||||
void Init();
|
||||
|
||||
// Sets the validators for the dialog controls
|
||||
//void SetDialogValidators();
|
||||
bool TransferDataToWindow();
|
||||
bool TransferDataFromWindow();
|
||||
|
||||
// Sets the help text for the dialog controls
|
||||
void SetDialogHelp();
|
||||
|
||||
// Value1 accessors
|
||||
void SetValue1(wxString value)
|
||||
{
|
||||
m_value1 = value;
|
||||
}
|
||||
wxString GetValue1()
|
||||
{
|
||||
return m_value1;
|
||||
}
|
||||
|
||||
// Value1 accessors
|
||||
void SetValue2(wxString value)
|
||||
{
|
||||
m_value2 = value;
|
||||
}
|
||||
wxString GetValue2()
|
||||
{
|
||||
return m_value2;
|
||||
}
|
||||
|
||||
//wxEVT_COMMAND_TEXT_ENTER event_handle for DDVALUE1
|
||||
void OnEnterPressed( wxCommandEvent &event );
|
||||
|
||||
|
||||
protected:
|
||||
// Data members
|
||||
wxString m_value1, m_value2;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
102
include/dd/dditems/utilities/ddSelectKindFksDialog.h
Normal file
102
include/dd/dditems/utilities/ddSelectKindFksDialog.h
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddTableNameDialog.h - Utility dialog class to allow user input of table name and short name
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDSELECTKINDFKSDIALOG_H
|
||||
#define DDSELECTKINDFKSDIALOG_H
|
||||
|
||||
#include <wx/statline.h>
|
||||
#include "dd/dditems/figures/ddRelationshipFigure.h"
|
||||
|
||||
class hdDrawingView;
|
||||
|
||||
enum
|
||||
{
|
||||
DDSELECTKINDFKSDIALOG = 10000,
|
||||
DDSELECTKINDFK = 10001,
|
||||
DDCHOICESELECTBASE = 30000
|
||||
};
|
||||
|
||||
class ddSelectFkKindLine : public hdObject
|
||||
{
|
||||
public:
|
||||
wxStaticText *sourceCtrl;
|
||||
wxChoice *destinationCtrl;
|
||||
|
||||
ddSelectFkKindLine(wxWindow *parent, wxString sourceColumn, wxArrayString possibleTargets, wxWindowID eventId);
|
||||
ddSelectFkKindLine();
|
||||
~ddSelectFkKindLine();
|
||||
};
|
||||
|
||||
|
||||
WX_DECLARE_STRING_HASH_MAP( ddSelectFkKindLine *, choicesControlsHashMap );
|
||||
|
||||
class ddSelectKindFksDialog : public wxDialog
|
||||
{
|
||||
DECLARE_CLASS( ddSelectKindFksDialog )
|
||||
DECLARE_EVENT_TABLE()
|
||||
public:
|
||||
ddSelectKindFksDialog();
|
||||
~ddSelectKindFksDialog();
|
||||
ddSelectKindFksDialog( wxWindow *parent,
|
||||
ddRelationshipFigure *relation,
|
||||
wxWindowID id = DDSELECTKINDFKSDIALOG,
|
||||
const wxPoint &pos = wxDefaultPosition,
|
||||
const wxSize &size = wxDefaultSize,
|
||||
long style = wxCAPTION
|
||||
);
|
||||
|
||||
// Member initialization
|
||||
void Init();
|
||||
// Creation
|
||||
bool Create( wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint &pos,
|
||||
const wxSize &size,
|
||||
long style);
|
||||
|
||||
|
||||
// Creates the controls and sizers
|
||||
void CreateControls();
|
||||
|
||||
// Sets the validators for the dialog controls
|
||||
bool TransferDataToWindow();
|
||||
bool TransferDataFromWindow();
|
||||
|
||||
// Sets the help text for the dialog controls
|
||||
void SetDialogHelp();
|
||||
|
||||
//wxEVT_COMMAND_TEXT_ENTER event_handle for DDVALUE1
|
||||
void OnEnterPressed( wxCommandEvent &event );
|
||||
void OnOkButtonClicked( wxCommandEvent &event );
|
||||
void OnCancelButtonClicked( wxCommandEvent &event );
|
||||
|
||||
|
||||
protected:
|
||||
//methods
|
||||
void populateColumnsControls(bool primaryKey, int useUkIndex);
|
||||
void deleteColsControls();
|
||||
void OnChoiceFkKind(wxCommandEvent &event);
|
||||
|
||||
// Data members
|
||||
ddRelationshipFigure *tablesRelation;
|
||||
|
||||
// Dialog controls
|
||||
choicesControlsHashMap choices;
|
||||
wxBoxSizer *topSizer, *linesSizer, *okCancelBox, *colsTopSizer;
|
||||
wxChoice *kindFkCtrl;
|
||||
wxButton *ok, *cancel;
|
||||
wxStaticLine *line;
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
87
include/dd/dditems/utilities/ddTableNameDialog.h
Normal file
87
include/dd/dditems/utilities/ddTableNameDialog.h
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddTableNameDialog.h - Utility dialog class to allow user input of table name and short name
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDTABLENAMEDIALOGS_H
|
||||
#define DDTABLENAMEDIALOGS_H
|
||||
|
||||
#include "dlg/dlgClasses.h"
|
||||
#include "dd/dditems/figures/ddTextTableItemFigure.h"
|
||||
|
||||
class ddTableNameDialog : public pgDialog
|
||||
{
|
||||
public:
|
||||
ddTableNameDialog();
|
||||
~ddTableNameDialog();
|
||||
ddTableNameDialog(wxWindow *parent,
|
||||
const wxString &defaultValue1 = wxEmptyString,
|
||||
const wxString &defaultValue2 = wxEmptyString,
|
||||
ddTextTableItemFigure *tableItem = NULL
|
||||
);
|
||||
|
||||
// Member initialization
|
||||
void Init();
|
||||
|
||||
// Sets the validators for the dialog controls
|
||||
//void SetDialogValidators();
|
||||
bool TransferDataToWindow();
|
||||
bool TransferDataFromWindow();
|
||||
|
||||
// Sets the help text for the dialog controls
|
||||
void SetDialogHelp();
|
||||
|
||||
// Value1 accessors
|
||||
void SetValue1(wxString value)
|
||||
{
|
||||
m_value1 = value;
|
||||
}
|
||||
wxString GetValue1()
|
||||
{
|
||||
return m_value1;
|
||||
}
|
||||
|
||||
// Value1 accessors
|
||||
void SetValue2(wxString value)
|
||||
{
|
||||
m_value2 = value;
|
||||
}
|
||||
wxString GetValue2()
|
||||
{
|
||||
return m_value2;
|
||||
}
|
||||
|
||||
// CheckBox accessors
|
||||
void SetValueGenerate(bool value)
|
||||
{
|
||||
checkGenerate = value;
|
||||
}
|
||||
bool GetValueGenerate()
|
||||
{
|
||||
return checkGenerate;
|
||||
}
|
||||
|
||||
//wxEVT_COMMAND_BUTTON_CLICKED event_handler for DDGENBUTTON
|
||||
void OnGenButtonClicked( wxCommandEvent &event );
|
||||
|
||||
|
||||
protected:
|
||||
// Data members
|
||||
wxString m_value1, m_value2;
|
||||
wxString label1, label2;
|
||||
bool checkGenerate;
|
||||
ddTextTableItemFigure *tabItem;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
19
include/dd/dditems/utilities/module.mk
Normal file
19
include/dd/dditems/utilities/module.mk
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#######################################################################
|
||||
#
|
||||
# pgAdmin III - PostgreSQL Tools
|
||||
#
|
||||
# Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
# This software is released under the PostgreSQL Licence
|
||||
#
|
||||
# module.mk - pgadmin/include/dd/dditems/utilities/ Makefile fragment
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
pgadmin3_SOURCES += \
|
||||
include/dd/dditems/utilities/ddDataType.h \
|
||||
include/dd/dditems/utilities/ddPrecisionScaleDialog.h \
|
||||
include/dd/dditems/utilities/ddSelectKindFksDialog.h \
|
||||
include/dd/dditems/utilities/ddTableNameDialog.h
|
||||
|
||||
EXTRA_DIST += \
|
||||
include/dd/dditems/utilities/module.mk
|
||||
28
include/dd/ddmodel/ddBrowserDataContainer.h
Normal file
28
include/dd/ddmodel/ddBrowserDataContainer.h
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddBrowserDataContainer.h - Item to contain data for each treview child.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDBROWSERDATACONTAINER_H
|
||||
#define DDBROWSERDATACONTAINER_H
|
||||
|
||||
#include "hotdraw/figures/hdIFigure.h"
|
||||
|
||||
class ddBrowserDataContainer : public wxTreeItemData
|
||||
{
|
||||
public:
|
||||
ddBrowserDataContainer(hdIFigure *data);
|
||||
~ddBrowserDataContainer();
|
||||
int getFigureKindId();
|
||||
hdIFigure *getFigure();
|
||||
|
||||
private:
|
||||
hdIFigure *figure;
|
||||
};
|
||||
#endif
|
||||
249
include/dd/ddmodel/ddDBReverseEngineering.h
Normal file
249
include/dd/ddmodel/ddDBReverseEngineering.h
Normal file
|
|
@ -0,0 +1,249 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddDBReverseEngineering.h - Reverse engineering database functions for database designer.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDDBREVERSEENGINEERING_H
|
||||
#define DDDBREVERSEENGINEERING_H
|
||||
#include "wx/wizard.h"
|
||||
#include "hotdraw/main/hdObject.h"
|
||||
#include "dd/dditems/utilities/ddDataType.h"
|
||||
#include "schema/pgDatatype.h"
|
||||
#include "dd/dditems/figures/ddTableFigure.h"
|
||||
#include "dd/ddmodel/ddDatabaseDesign.h"
|
||||
|
||||
class SelSchemaPage;
|
||||
class SelTablesPage;
|
||||
class ReportPage;
|
||||
class ddStubTable;
|
||||
|
||||
enum
|
||||
{
|
||||
DDALLSCHEMAS = 7001,
|
||||
DDALLTABS,
|
||||
DDSELTABS,
|
||||
DDADD,
|
||||
DDADDALL,
|
||||
DDREMOVE,
|
||||
DDREMOVEALL
|
||||
};
|
||||
|
||||
WX_DECLARE_STRING_HASH_MAP( ddStubTable *, stubTablesHashMap);
|
||||
WX_DEFINE_SORTED_ARRAY_INT(int, wxSortedArrayInt);
|
||||
|
||||
// Stub tables related classes
|
||||
class ddImportDBUtils : public hdObject
|
||||
{
|
||||
public:
|
||||
// Implement and replace at this and other dd related classes as Generation Wizard static wxArrayString getSchemasNames(...);
|
||||
static wxArrayString getTablesNames(pgConn *connection, wxString schemaName);
|
||||
static ddStubTable *getTable(pgConn *connection, wxString tableName, OID tableOid);
|
||||
static ddTableFigure *getTableFigure(ddStubTable *table);
|
||||
static void getAllRelationships(pgConn *connection, stubTablesHashMap &tables, ddDatabaseDesign *design);
|
||||
static int getPgColumnNum(pgConn *connection, wxString schemaName, wxString tableName, wxString columnName);
|
||||
static OID getTableOID(pgConn *connection, wxString schemaName, wxString tableName);
|
||||
static OID getSchemaOID(pgConn *connection, wxString schemaName);
|
||||
static bool existsFk(pgConn *connection, OID destTableOid, wxString schemaName, wxString fkName, wxString sourceTableName);
|
||||
static wxArrayString getFkAtDbNotInModel(pgConn *connection, OID destTableOid, wxString schemaName, wxArrayString existingFkList, ddDatabaseDesign *design);
|
||||
static bool isModelSameDbFk(pgConn *connection, OID destTableOid, wxString schemaName, wxString fkName, wxString sourceTableName, wxString destTableName, ddStubTable *destStubTable, ddRelationshipFigure *relation);
|
||||
|
||||
private:
|
||||
static bool setUniqueConstraints(pgConn *connection, ddStubTable *table);
|
||||
static bool setPkName(pgConn *connection, ddStubTable *table);
|
||||
static int sortFunc(int n1, int n2)
|
||||
{
|
||||
return n1 - n2;
|
||||
}
|
||||
};
|
||||
|
||||
class ddStubColumn : public hdObject
|
||||
{
|
||||
public:
|
||||
ddStubColumn();
|
||||
ddStubColumn(const ddStubColumn ©);
|
||||
ddStubColumn(wxString name, OID oidSource, bool notNull, bool pk, pgDatatype *type, int ukIndex = -1);
|
||||
ddStubColumn(wxString name, OID oidSource);
|
||||
~ddStubColumn();
|
||||
wxString columnName;
|
||||
bool isNotNull;
|
||||
bool isPrimaryKey;
|
||||
bool isUniqueKey();
|
||||
int uniqueKeyIndex;
|
||||
OID OIDTable;
|
||||
pgDatatype *typeColumn;
|
||||
int pgColNumber;
|
||||
};
|
||||
|
||||
WX_DECLARE_STRING_HASH_MAP( ddStubColumn *, stubColsHashMap);
|
||||
|
||||
class ddStubTable : public hdObject
|
||||
{
|
||||
public:
|
||||
ddStubTable();
|
||||
ddStubTable(wxString name, OID tableOID);
|
||||
ddStubColumn *getColumnByNumber(int pgColNumber);
|
||||
~ddStubTable();
|
||||
wxString tableName;
|
||||
OID OIDTable;
|
||||
stubColsHashMap cols;
|
||||
wxString PrimaryKeyName;
|
||||
wxArrayString UniqueKeysNames;
|
||||
};
|
||||
|
||||
//
|
||||
//
|
||||
// Wizard related classes
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
WX_DECLARE_STRING_HASH_MAP( OID, oidsHashMap);
|
||||
|
||||
class ddDBReverseEngineering : public wxWizard
|
||||
{
|
||||
public:
|
||||
ddDBReverseEngineering(wxFrame *frame, ddDatabaseDesign *design, pgConn *connection, bool useSizer = true);
|
||||
~ddDBReverseEngineering();
|
||||
|
||||
//Wizard related functions
|
||||
wxWizardPage *GetFirstPage() const
|
||||
{
|
||||
return initialPage;
|
||||
}
|
||||
|
||||
// Reverse Enginnering related functions
|
||||
wxArrayString getTables();
|
||||
pgConn *getConnection()
|
||||
{
|
||||
return conn;
|
||||
};
|
||||
|
||||
//transfer data between pages
|
||||
OID OIDSelectedSchema;
|
||||
wxString schemaName;
|
||||
oidsHashMap tablesOIDHM;
|
||||
stubTablesHashMap stubsHM;
|
||||
SelSchemaPage *page2;
|
||||
SelTablesPage *page3;
|
||||
ReportPage *page4;
|
||||
ddDatabaseDesign *getDesign()
|
||||
{
|
||||
return figuresDesign;
|
||||
};
|
||||
|
||||
private:
|
||||
void OnFinishPressed(wxWizardEvent &event);
|
||||
pgConn *conn;
|
||||
wxWizardPageSimple *initialPage;
|
||||
wxStaticText *frontText;
|
||||
ddDatabaseDesign *figuresDesign;
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
class SelSchemaPage : public wxWizardPage
|
||||
{
|
||||
public:
|
||||
SelSchemaPage(wxWizard *parent, wxWizardPage *prev);
|
||||
~SelSchemaPage();
|
||||
virtual wxWizardPage *GetPrev() const
|
||||
{
|
||||
return m_prev;
|
||||
};
|
||||
virtual wxWizardPage *GetNext() const
|
||||
{
|
||||
return m_next;
|
||||
};
|
||||
void SetPrev(wxWizardPage *prev)
|
||||
{
|
||||
m_prev = prev;
|
||||
}
|
||||
void SetNext(wxWizardPage *next)
|
||||
{
|
||||
m_next = next;
|
||||
}
|
||||
private:
|
||||
void OnWizardPageChanging(wxWizardEvent &event);
|
||||
void refreshSchemas(pgConn *connection);
|
||||
wxStaticText *message;
|
||||
wxWizardPage *m_prev, *m_next;
|
||||
wxListBox *m_allSchemas;
|
||||
wxArrayString schemasNames;
|
||||
oidsHashMap schemasHM;
|
||||
ddDBReverseEngineering *wparent;
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
||||
class SelTablesPage : public wxWizardPage
|
||||
{
|
||||
public:
|
||||
SelTablesPage(wxWizard *parent, wxWizardPage *prev);
|
||||
~SelTablesPage();
|
||||
virtual wxWizardPage *GetPrev() const
|
||||
{
|
||||
return m_prev;
|
||||
};
|
||||
virtual wxWizardPage *GetNext() const
|
||||
{
|
||||
return m_next;
|
||||
};
|
||||
void SetPrev(wxWizardPage *prev)
|
||||
{
|
||||
m_prev = prev;
|
||||
}
|
||||
void SetNext(wxWizardPage *next)
|
||||
{
|
||||
m_next = next;
|
||||
}
|
||||
void RefreshTablesList();
|
||||
void OnButtonAdd(wxCommandEvent &);
|
||||
void OnButtonAddAll(wxCommandEvent &);
|
||||
void OnButtonRemove(wxCommandEvent &);
|
||||
void OnButtonRemoveAll(wxCommandEvent &);
|
||||
private:
|
||||
void OnWizardPageChanging(wxWizardEvent &event);
|
||||
wxStaticText *leftText, *rightText, *centerText;
|
||||
wxWizardPage *m_prev, *m_next;
|
||||
wxListBox *m_allTables, *m_selTables;
|
||||
ddDBReverseEngineering *wparent;
|
||||
wxArrayString tablesNames;
|
||||
wxBitmapButton *buttonAdd, *buttonAddAll, *buttonRemove, *buttonRemoveAll;
|
||||
wxBitmap addBitmap, addAllBitmap, removeBitmap, removeAllBitmap;
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
class ReportPage : public wxWizardPage
|
||||
{
|
||||
public:
|
||||
ReportPage(wxWizard *parent, wxWizardPage *prev);
|
||||
~ReportPage();
|
||||
virtual wxWizardPage *GetPrev() const
|
||||
{
|
||||
return m_prev;
|
||||
};
|
||||
virtual wxWizardPage *GetNext() const
|
||||
{
|
||||
return m_next;
|
||||
};
|
||||
void SetPrev(wxWizardPage *prev)
|
||||
{
|
||||
m_prev = prev;
|
||||
}
|
||||
void SetNext(wxWizardPage *next)
|
||||
{
|
||||
m_next = next;
|
||||
}
|
||||
wxTextCtrl *results;
|
||||
private:
|
||||
void OnWizardPageChanging(wxWizardEvent &event);
|
||||
wxWizardPage *m_prev, *m_next;
|
||||
ddDBReverseEngineering *wparent;
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
#endif
|
||||
80
include/dd/ddmodel/ddDatabaseDesign.h
Normal file
80
include/dd/ddmodel/ddDatabaseDesign.h
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddDatabaseDesign.h - Manages all design related info and contains all model(s) and tables.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDDATABASEDESIGN_H
|
||||
#define DDDATABASEDESIGN_H
|
||||
|
||||
#include <libxml/xmlwriter.h>
|
||||
#include <ctl/ctlAuiNotebook.h>
|
||||
|
||||
#include "dd/ddmodel/ddDrawingEditor.h"
|
||||
#include "hotdraw/tools/hdITool.h"
|
||||
#include "dd/dditems/figures/ddTableFigure.h"
|
||||
|
||||
class ddModelBrowser;
|
||||
|
||||
enum
|
||||
{
|
||||
DDGENCREATE = 6000,
|
||||
DDGENALTER,
|
||||
DDGENDROPCRE,
|
||||
DDGENNOTHING
|
||||
};
|
||||
|
||||
WX_DECLARE_STRING_HASH_MAP( wxString , tablesMappingHashMap );
|
||||
|
||||
class ddDatabaseDesign : public wxObject
|
||||
{
|
||||
public:
|
||||
ddDatabaseDesign(wxWindow *parent, wxWindow *frmOwner);
|
||||
~ddDatabaseDesign();
|
||||
hdDrawingView *getView(int diagramIndex);
|
||||
ddDrawingEditor *getEditor();
|
||||
void addTableToModel(hdIFigure *figure);
|
||||
void addTableToView(int diagramIndex, hdIFigure *figure);
|
||||
void removeTable(int diagramIndex, hdIFigure *figure);
|
||||
hdDrawing *createDiagram(wxWindow *owner, wxString name, bool fromXml);
|
||||
void deleteDiagram(int diagramIndex, bool deleteView = true);
|
||||
void refreshDraw(int diagramIndex);
|
||||
void eraseDiagram(int diagramIndex);
|
||||
void emptyModel();
|
||||
wxArrayString getDiagramTables(int diagramIndex);
|
||||
wxString generateDiagram(int diagramIndex, wxString schemaName);
|
||||
wxArrayString getModelTables();
|
||||
wxString generateModel(wxString schemaName);
|
||||
wxString generateList(wxArrayString tables, wxArrayInt options, pgConn *connection = NULL, wxString schemaName = wxEmptyString);
|
||||
bool validateModel(wxString &errors);
|
||||
ddTableFigure *getSelectedTable(int diagramIndex);
|
||||
ddTableFigure *getTable(wxString tableName);
|
||||
bool writeXmlModel(wxString file);
|
||||
bool readXmlModel(wxString file, ctlAuiNotebook *notebook);
|
||||
|
||||
wxString getTableId(wxString tableName);
|
||||
void addTableToMapping(wxString IdKey, wxString tableName);
|
||||
wxString getTableName(wxString Id);
|
||||
void registerBrowser(ddModelBrowser *browser);
|
||||
void refreshBrowser();
|
||||
static wxString getVersionXML();
|
||||
void markSchemaOn(wxArrayString tables);
|
||||
void unMarkSchemaOnAll();
|
||||
|
||||
protected:
|
||||
tablesMappingHashMap mappingNameToId;
|
||||
tablesMappingHashMap mappingIdToName;
|
||||
private:
|
||||
ddModelBrowser *attachedBrowser;
|
||||
int diagramCounter;
|
||||
ddDrawingEditor *editor;
|
||||
hdITool *tool;
|
||||
xmlTextWriterPtr xmlWriter;
|
||||
|
||||
};
|
||||
#endif
|
||||
44
include/dd/ddmodel/ddDrawingEditor.h
Normal file
44
include/dd/ddmodel/ddDrawingEditor.h
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// hdDrawingEditor.h - Main class that manages all other classes
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDDRAWINGEDITOR_H
|
||||
#define DDDRAWINGEDITOR_H
|
||||
|
||||
#include "hotdraw/main/hdDrawingEditor.h"
|
||||
class frmDatabaseDesigner;
|
||||
|
||||
enum
|
||||
{
|
||||
MNU_NEWTABLE = 321
|
||||
};
|
||||
|
||||
class ddDatabaseDesign;
|
||||
|
||||
class ddDrawingEditor : public hdDrawingEditor
|
||||
{
|
||||
public:
|
||||
ddDrawingEditor(wxWindow *owner, wxWindow *frmOwner, ddDatabaseDesign *design);
|
||||
virtual hdDrawing *createDiagram(wxWindow *owner, bool fromXml);
|
||||
virtual void remOrDelSelFigures(int diagramIndex);
|
||||
void checkRelationshipsConsistency(int diagramIndex);
|
||||
void checkAllDigramsRelConsistency();
|
||||
ddDatabaseDesign *getDesign()
|
||||
{
|
||||
return databaseDesign;
|
||||
};
|
||||
virtual void notifyChanged();
|
||||
|
||||
protected:
|
||||
private:
|
||||
ddDatabaseDesign *databaseDesign;
|
||||
frmDatabaseDesigner *frm;
|
||||
};
|
||||
#endif
|
||||
40
include/dd/ddmodel/ddDrawingView.h
Normal file
40
include/dd/ddmodel/ddDrawingView.h
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// hdDrawingEditor.h - Main class that manages all other classes
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDDRAWINGVIEW_H
|
||||
#define DDDRAWINGVIEW_H
|
||||
|
||||
#include "hotdraw/main/hdDrawingView.h"
|
||||
#include "dd/ddmodel/ddDrawingEditor.h"
|
||||
#include "dd/ddmodel/ddDatabaseDesign.h"
|
||||
|
||||
class ddDrawingView : public hdDrawingView
|
||||
{
|
||||
public:
|
||||
ddDrawingView(int diagram, wxWindow *ddParent, ddDrawingEditor *editor , wxSize size, hdDrawing *drawing);
|
||||
//Hack To allow right click menu at canvas without a figure
|
||||
virtual void createViewMenu(wxMenu &mnu);
|
||||
virtual void OnGenericViewPopupClick(wxCommandEvent &event);
|
||||
protected:
|
||||
private:
|
||||
};
|
||||
|
||||
// A drop target that do nothing only accept text, if accept then tree add table to model
|
||||
class ddDropTarget : public wxTextDropTarget
|
||||
{
|
||||
public:
|
||||
ddDropTarget(ddDatabaseDesign *sourceDesign, hdDrawing *targetDrawing);
|
||||
virtual bool OnDropText(wxCoord x, wxCoord y, const wxString &text);
|
||||
private:
|
||||
hdDrawing *target;
|
||||
ddDatabaseDesign *source;
|
||||
};
|
||||
#endif
|
||||
224
include/dd/ddmodel/ddGenerationWizard.h
Normal file
224
include/dd/ddmodel/ddGenerationWizard.h
Normal file
|
|
@ -0,0 +1,224 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddBrowserDataContainer.h - Item to contain data for each treview child.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDGENERATIONWIZARD_H
|
||||
#define DDGENERATIONWIZARD_H
|
||||
|
||||
#include "hotdraw/figures/hdIFigure.h"
|
||||
#include "dd/ddmodel/ddDatabaseDesign.h"
|
||||
#include "dd/ddmodel/ddDBReverseEngineering.h"
|
||||
#include <wx/grid.h>
|
||||
|
||||
class SelGenTablesPage;
|
||||
class SelGenSchemaPage;
|
||||
class ReportGridPage;
|
||||
|
||||
enum
|
||||
{
|
||||
DDTABSGRID = 7100
|
||||
};
|
||||
|
||||
class ddGenerationWizard : public wxWizard
|
||||
{
|
||||
public:
|
||||
ddGenerationWizard(wxFrame *frame, ddDatabaseDesign *design, pgConn *connection, bool useSizer = true);
|
||||
~ddGenerationWizard();
|
||||
|
||||
// Wizard related functions
|
||||
wxWizardPage *GetFirstPage() const
|
||||
{
|
||||
return initialPage;
|
||||
}
|
||||
ddDatabaseDesign *getDesign()
|
||||
{
|
||||
return figuresDesign;
|
||||
};
|
||||
pgConn *getConnection()
|
||||
{
|
||||
return conn;
|
||||
};
|
||||
// Transfer data between pages
|
||||
OID OIDSelectedSchema;
|
||||
wxString schemaName;
|
||||
SelGenTablesPage *page2;
|
||||
SelGenSchemaPage *page3;
|
||||
ReportGridPage *page4;
|
||||
wxString DDL;
|
||||
wxArrayString preSelTables;
|
||||
|
||||
private:
|
||||
|
||||
void OnWizardPageChanging(wxWizardEvent &event);
|
||||
|
||||
// Page 4 - Report and Finish
|
||||
void OnFinishPressed(wxWizardEvent &event);
|
||||
|
||||
pgConn *conn;
|
||||
wxWizardPageSimple *initialPage;
|
||||
wxStaticText *frontText;
|
||||
ddDatabaseDesign *figuresDesign;
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
class SelGenTablesPage : public wxWizardPage
|
||||
{
|
||||
public:
|
||||
SelGenTablesPage(wxWizard *parent, wxWizardPage *prev);
|
||||
~SelGenTablesPage();
|
||||
virtual wxWizardPage *GetPrev() const
|
||||
{
|
||||
return m_prev;
|
||||
};
|
||||
virtual wxWizardPage *GetNext() const
|
||||
{
|
||||
return m_next;
|
||||
};
|
||||
void SetPrev(wxWizardPage *prev)
|
||||
{
|
||||
m_prev = prev;
|
||||
}
|
||||
void SetNext(wxWizardPage *next)
|
||||
{
|
||||
m_next = next;
|
||||
}
|
||||
void OnButtonAdd(wxCommandEvent &);
|
||||
void OnButtonAddAll(wxCommandEvent &);
|
||||
void OnButtonRemove(wxCommandEvent &);
|
||||
void OnButtonRemoveAll(wxCommandEvent &);
|
||||
void RefreshTablesList();
|
||||
int countSelTables()
|
||||
{
|
||||
return m_selTables->GetCount();
|
||||
};
|
||||
wxString getSelTableName(int index)
|
||||
{
|
||||
return m_selTables->GetString(index);
|
||||
};
|
||||
private:
|
||||
void moveToSelectList(wxString tableName);
|
||||
void OnWizardPageChanging(wxWizardEvent &event);
|
||||
wxStaticText *leftText, *rightText, *centerText;
|
||||
wxWizardPage *m_prev, *m_next;
|
||||
wxListBox *m_allTables, *m_selTables;
|
||||
ddGenerationWizard *wparent;
|
||||
wxArrayString tablesNames;
|
||||
wxBitmapButton *buttonAdd, *buttonAddAll, *buttonRemove, *buttonRemoveAll;
|
||||
wxBitmap addBitmap, addAllBitmap, removeBitmap, removeAllBitmap;
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
class SelGenSchemaPage : public wxWizardPage
|
||||
{
|
||||
public:
|
||||
SelGenSchemaPage(wxWizard *parent, wxWizardPage *prev);
|
||||
~SelGenSchemaPage();
|
||||
virtual wxWizardPage *GetPrev() const
|
||||
{
|
||||
return m_prev;
|
||||
};
|
||||
virtual wxWizardPage *GetNext() const
|
||||
{
|
||||
return m_next;
|
||||
};
|
||||
void SetPrev(wxWizardPage *prev)
|
||||
{
|
||||
m_prev = prev;
|
||||
}
|
||||
void SetNext(wxWizardPage *next)
|
||||
{
|
||||
m_next = next;
|
||||
}
|
||||
private:
|
||||
void OnWizardPageChanging(wxWizardEvent &event);
|
||||
void refreshSchemas(pgConn *connection);
|
||||
wxStaticText *message;
|
||||
wxWizardPage *m_prev, *m_next;
|
||||
wxListBox *m_allSchemas;
|
||||
wxArrayString schemasNames;
|
||||
oidsHashMap schemasHM;
|
||||
ddGenerationWizard *wparent;
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
// Special version of wxGrid to allow use of fast comboboxes and grid columns auto fit
|
||||
// some snippets from http://forums.wxwidgets.org/viewtopic.php?t=27568 under same wxwidgets license
|
||||
// others from pgAdming gqb
|
||||
class wxDDGrid: public wxGrid
|
||||
{
|
||||
public:
|
||||
wxDDGrid(wxWindow *parent, wxWindowID id);
|
||||
void ComboBoxEvent(wxGridEvent &event);
|
||||
void RevertSel();
|
||||
|
||||
int sf[10];
|
||||
|
||||
void OnSizeEvt( wxSizeEvent &ev );
|
||||
int StretchIt();
|
||||
int keepFit;
|
||||
|
||||
public:
|
||||
void SetColStretch ( unsigned i, int factor )
|
||||
{
|
||||
if( i < 10 ) sf[i] = factor;
|
||||
}
|
||||
int GetColStretch ( unsigned i ) const
|
||||
{
|
||||
return (i < 10) ? sf[i] : 1;
|
||||
}
|
||||
void ReLayout()
|
||||
{
|
||||
StretchIt();
|
||||
}
|
||||
void SetFit( int fit_style )
|
||||
{
|
||||
keepFit = fit_style;
|
||||
}
|
||||
private:
|
||||
wxGridSelection *m_selTemp;
|
||||
};
|
||||
|
||||
class ReportGridPage : public wxWizardPage
|
||||
{
|
||||
public:
|
||||
ReportGridPage(wxWizard *parent, wxWizardPage *prev);
|
||||
~ReportGridPage();
|
||||
virtual wxWizardPage *GetPrev() const
|
||||
{
|
||||
return m_prev;
|
||||
};
|
||||
virtual wxWizardPage *GetNext() const
|
||||
{
|
||||
return m_next;
|
||||
};
|
||||
void SetPrev(wxWizardPage *prev)
|
||||
{
|
||||
m_prev = prev;
|
||||
}
|
||||
void SetNext(wxWizardPage *next)
|
||||
{
|
||||
m_next = next;
|
||||
}
|
||||
void populateGrid();
|
||||
wxDDGrid *getGrid()
|
||||
{
|
||||
return reportGrid;
|
||||
};
|
||||
private:
|
||||
void OnWizardPageChanging(wxWizardEvent &event);
|
||||
void OnCellLeftClick(wxGridEvent &ev);
|
||||
|
||||
wxStaticText *message;
|
||||
wxWizardPage *m_prev, *m_next;
|
||||
wxDDGrid *reportGrid;
|
||||
ddGenerationWizard *wparent;
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
#endif
|
||||
46
include/dd/ddmodel/ddModelBrowser.h
Normal file
46
include/dd/ddmodel/ddModelBrowser.h
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ddModelBrowser.h - Tables Tree of Database Designer.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DDMODELBROWSER_H
|
||||
#define DDMODELBROWSER_H
|
||||
|
||||
#include "dd/ddmodel/ddDatabaseDesign.h"
|
||||
|
||||
enum ddBrowser
|
||||
{
|
||||
DD_BROWSER = 13000
|
||||
};
|
||||
|
||||
enum ddBrowserImages
|
||||
{
|
||||
DD_IMG_FIG_DATABASE = 0,
|
||||
DD_IMG_FIG_TABLE = 1
|
||||
};
|
||||
|
||||
class ddModelBrowser : public wxTreeCtrl
|
||||
{
|
||||
public:
|
||||
ddModelBrowser(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style, ddDatabaseDesign *design);
|
||||
~ddModelBrowser();
|
||||
wxTreeItemId &createRoot(wxString Name);
|
||||
void refreshFromModel();
|
||||
|
||||
private:
|
||||
void OnItemActivated(wxTreeEvent &event);
|
||||
void OnBeginDrag(wxTreeEvent &event);
|
||||
|
||||
wxTreeItemId rootNode;
|
||||
ddDatabaseDesign *ownerDesign;
|
||||
wxImageList *imageList;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
#endif
|
||||
22
include/dd/ddmodel/module.mk
Normal file
22
include/dd/ddmodel/module.mk
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#######################################################################
|
||||
#
|
||||
# pgAdmin III - PostgreSQL Tools
|
||||
#
|
||||
# Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
# This software is released under the PostgreSQL Licence
|
||||
#
|
||||
# module.mk - pgadmin/include/dd/ddmodel/ Makefile fragment
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
pgadmin3_SOURCES += \
|
||||
include/dd/ddmodel/ddBrowserDataContainer.h \
|
||||
include/dd/ddmodel/ddDatabaseDesign.h \
|
||||
include/dd/ddmodel/ddDrawingEditor.h \
|
||||
include/dd/ddmodel/ddDBReverseEngineering.h \
|
||||
include/dd/ddmodel/ddDrawingView.h \
|
||||
include/dd/ddmodel/ddGenerationWizard.h \
|
||||
include/dd/ddmodel/ddModelBrowser.h
|
||||
|
||||
EXTRA_DIST += \
|
||||
include/dd/ddmodel/module.mk
|
||||
17
include/dd/module.mk
Normal file
17
include/dd/module.mk
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#######################################################################
|
||||
#
|
||||
# pgAdmin III - PostgreSQL Tools
|
||||
#
|
||||
# Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
# This software is released under the PostgreSQL Licence
|
||||
#
|
||||
# module.mk - pgadmin/include/dd/ Makefile fragment
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
include include/dd/dditems/module.mk
|
||||
include include/dd/ddmodel/module.mk
|
||||
|
||||
|
||||
EXTRA_DIST += \
|
||||
include/dd/module.mk
|
||||
44
include/debugger/ctlMessageWindow.h
Normal file
44
include/debugger/ctlMessageWindow.h
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ctlMessageWindow.h - debugger
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// class ctlMessageWindow
|
||||
//
|
||||
// This class implements the window that displays DBMS messages at the
|
||||
// bottom of the debugger window. When we create a ctlMessageWindow, the parent
|
||||
// is a ctlTabWindow (the ctlMessageWindow becomes a tab in a tab control).
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef CTLMESSAGEWINDOW_H
|
||||
#define CTLMESSAGEWINDOW_H
|
||||
|
||||
class ctlMessageWindow : public wxTextCtrl
|
||||
{
|
||||
DECLARE_CLASS(ctlMessageWindow)
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
public:
|
||||
ctlMessageWindow(wxWindow *parent, wxWindowID id);
|
||||
|
||||
void AddMessage(wxString message); // Add a message to the window
|
||||
void DelMessage(const char *name = NULL); // Remove a message from the window
|
||||
wxString GetMessage(int row);
|
||||
|
||||
protected:
|
||||
wxString m_currMsg;
|
||||
wxTimer m_timer;
|
||||
wxMutex m_mutex;
|
||||
|
||||
void OnTimer(wxTimerEvent &);
|
||||
};
|
||||
|
||||
#endif
|
||||
37
include/debugger/ctlResultGrid.h
Normal file
37
include/debugger/ctlResultGrid.h
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ctlResultGrid.h - debugger
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// class ctlResultGrid
|
||||
//
|
||||
// A ctlResultGrid is a grid control that knows how to display that result set
|
||||
// generated by a PostgreSQL query. In the workstation application, a ctlResultGrid
|
||||
// is a child of the notebook owned by a ctlTabWindow.
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef CTLRESULTGRID_H
|
||||
#define CTLRESULTGRID_H
|
||||
|
||||
#include <wx/grid.h>
|
||||
|
||||
class ctlResultGrid : public wxGrid
|
||||
{
|
||||
DECLARE_CLASS(ctlResultGrid)
|
||||
|
||||
public:
|
||||
ctlResultGrid(wxWindow *parent, wxWindowID id);
|
||||
|
||||
// Copy a result set into the grid
|
||||
void FillResult(pgSet *set);
|
||||
};
|
||||
|
||||
#endif
|
||||
84
include/debugger/ctlStackWindow.h
Normal file
84
include/debugger/ctlStackWindow.h
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ctlStackWindow.h - debugger
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// class ctlStackWindow
|
||||
//
|
||||
// This class implements the window that displays the current call stack at
|
||||
// bottom of the debugger window. When we create a ctlStackWindow, the parent
|
||||
// is a ctlTabWindow (the ctlStackWindow becomes a tab in a tab control).
|
||||
//
|
||||
// It is a simple grid control - the grid contains two columns:
|
||||
// the RowLabel column displays the stack level
|
||||
// column 0 displays the function name, line number and argument list
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef CTLSTACKWINDOW_H
|
||||
#define CTLSTACKWINDOW_H
|
||||
|
||||
#include <wx/grid.h>
|
||||
#include <wx/laywin.h>
|
||||
#include <wx/listbox.h>
|
||||
#include <wx/clntdata.h>
|
||||
|
||||
class dbgStackFrame : public wxClientData
|
||||
{
|
||||
public:
|
||||
dbgStackFrame(const wxString &_level, const wxString &_pkg,
|
||||
const wxString &_func, const wxString &_desc)
|
||||
: m_level(_level), m_func(_func), m_pkg(_pkg), m_desc(_desc) {}
|
||||
|
||||
dbgStackFrame(const dbgStackFrame &s)
|
||||
: m_level(s.m_level), m_func(s.m_func), m_pkg(s.m_pkg), m_desc(s.m_pkg) {}
|
||||
|
||||
const wxString &GetLevel() const
|
||||
{
|
||||
return m_level;
|
||||
}
|
||||
const wxString &GetFunction() const
|
||||
{
|
||||
return m_func;
|
||||
}
|
||||
const wxString &GetPackage() const
|
||||
{
|
||||
return m_pkg;
|
||||
}
|
||||
const wxString &GetDescription() const
|
||||
{
|
||||
return m_desc;
|
||||
}
|
||||
|
||||
private:
|
||||
wxString m_level, m_func, m_pkg, m_desc;
|
||||
};
|
||||
|
||||
WX_DECLARE_LIST(dbgStackFrame, dbgStackFrameList);
|
||||
|
||||
|
||||
class ctlStackWindow : public wxListBox
|
||||
{
|
||||
DECLARE_CLASS( ctlVarWindow )
|
||||
|
||||
public:
|
||||
ctlStackWindow(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
|
||||
long style = wxCLIP_CHILDREN | wxSW_3D,
|
||||
const wxString &name = wxT("stackWindow"));
|
||||
|
||||
// Remove all frames from the stack trace
|
||||
void ClearStack();
|
||||
// Add an array of frames to the stack trace
|
||||
void SetStack(const dbgStackFrameList &stacks, int selected = -1);
|
||||
void SelectFrame(const wxString &pkg, const wxString &frm);
|
||||
};
|
||||
|
||||
#endif
|
||||
68
include/debugger/ctlTabWindow.h
Normal file
68
include/debugger/ctlTabWindow.h
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
// RCS-ID:
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ctlTabWindow.h - debugger
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// class ctlTabWindow
|
||||
//
|
||||
// The ctlTabWindow class implements the tab control that displays at the
|
||||
// bottom of the debugger window.
|
||||
//
|
||||
// A ctlTabWindow object holds a notebook control, a result window (a window
|
||||
// that displays the result set generated by a query), and a varWindow (a
|
||||
// window that displays the local variables when debugging a PL function).
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef CTLTABWINDOW_H
|
||||
#define CTLTABWINDOW_H
|
||||
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/aui/aui.h>
|
||||
|
||||
#include "debugger/ctlVarWindow.h"
|
||||
#include "debugger/ctlMessageWindow.h"
|
||||
#include "debugger/ctlStackWindow.h"
|
||||
#include "debugger/ctlResultGrid.h"
|
||||
|
||||
WX_DECLARE_HASH_MAP(int, int, wxIntegerHash, wxIntegerEqual, wsTabHash);
|
||||
|
||||
class ctlTabWindow : public ctlAuiNotebook
|
||||
{
|
||||
DECLARE_CLASS(ctlTabWindow)
|
||||
|
||||
public:
|
||||
|
||||
ctlTabWindow(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
|
||||
long style = wxCLIP_CHILDREN | wxSW_3D,
|
||||
const wxString &name = wxT("layoutWindow"));
|
||||
|
||||
ctlVarWindow *GetVarWindow(bool create = true); // Returns a pointer to the local-variables window (creates it if requested)
|
||||
ctlVarWindow *GetPkgVarWindow(bool create = true); // Returns a pointer to the package-variables window (creates it if requested)
|
||||
ctlVarWindow *GetParamWindow(bool create = true); // Returns a pointer to the parameters window (creates it if requested)
|
||||
|
||||
ctlResultGrid *GetResultWindow(); // Returns a pointer to the result window (creates it if necessary)
|
||||
ctlStackWindow *GetStackWindow(); // Returns a pointer to the stack-trace window (creates it if necessary)
|
||||
ctlMessageWindow *GetMessageWindow(); // Returns a pointer to the DBMS messages window (creates it if necessary)
|
||||
void SelectTab(wxWindowID id);
|
||||
|
||||
private:
|
||||
ctlResultGrid *m_resultWindow; // Displays the result set from a query
|
||||
ctlVarWindow *m_varWindow; // Displays the local variables when debugging a PL function
|
||||
ctlVarWindow *m_pkgVarWindow; // Displays the package variables when debugging a PL function
|
||||
ctlStackWindow *m_stackWindow; // Displays the current call stack
|
||||
ctlVarWindow *m_paramWindow; // Displays the parameters when debugging a PL function
|
||||
ctlMessageWindow *m_messageWindow; // Displays the DBMS messages when debugging a PL function
|
||||
|
||||
wsTabHash *m_tabMap; // Map window ID's to tab numbers;
|
||||
};
|
||||
|
||||
#endif
|
||||
80
include/debugger/ctlVarWindow.h
Normal file
80
include/debugger/ctlVarWindow.h
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// ctlVarWindow.h - debugger
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// class ctlVarWindow
|
||||
//
|
||||
// This class implements the window that displays PL variable values at the
|
||||
// bottom of the debugger window. When we create a ctlVarWindow, the parent
|
||||
// is a ctlTabWindow (the ctlVarWindow becomes a tab in a tab control).
|
||||
//
|
||||
// It is a simple grid control - the grid contains three columns:
|
||||
// the RowLabel column displays the name of each variable
|
||||
// column 0 displays the value of each variable
|
||||
// column 1 displays the data type of each variable
|
||||
//
|
||||
// Each ctlVarWindow contains a hash map that can locate a grid cell given a
|
||||
// variable name
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef CTLVARWINDOW_H
|
||||
#define CTLVARWINDOW_H
|
||||
|
||||
#include <wx/hashmap.h>
|
||||
#include <wx/hashset.h>
|
||||
#include <wx/grid.h>
|
||||
|
||||
class ctlVarWindow : public wxGrid
|
||||
{
|
||||
DECLARE_CLASS(ctlVarWindow)
|
||||
|
||||
public:
|
||||
ctlVarWindow(wxWindow *parent, wxWindowID id);
|
||||
|
||||
// Add a variable to the window
|
||||
void AddVar(wxString name, wxString value, wxString type, bool readOnly);
|
||||
// Remove a variable from the window
|
||||
void DelVar(wxString name = wxEmptyString);
|
||||
|
||||
wxString GetVarName(int row);
|
||||
wxString GetVarValue(int row);
|
||||
|
||||
private:
|
||||
|
||||
// The content of a grid cell is defined by the gridCell structure
|
||||
typedef struct
|
||||
{
|
||||
int m_row; // Row number for this variable/grid cell
|
||||
wxString m_value; // Variable value
|
||||
wxString m_type; // Variable type
|
||||
} gridCell;
|
||||
|
||||
enum
|
||||
{
|
||||
COL_NAME = 0, // Column 0 contains the variable name
|
||||
COL_TYPE, // This column contains the variable type
|
||||
COL_VALUE // This column contains the variable value
|
||||
};
|
||||
|
||||
// The m_cells hash translates variable names into gridCell references
|
||||
public:
|
||||
WX_DECLARE_STRING_HASH_MAP(gridCell, wsCellHash);
|
||||
WX_DECLARE_HASH_SET(wxString, wxStringHash, wxStringEqual, wsStringSet);
|
||||
|
||||
private:
|
||||
wsStringSet m_hiddenNames; // List of hidden variable names
|
||||
wsStringSet m_hiddenTypes; // List of hidden variable types
|
||||
wsCellHash *m_cells; // name-to-gridCell map
|
||||
wxFont m_nameFont; // Font used to display field names
|
||||
};
|
||||
|
||||
#endif
|
||||
49
include/debugger/dbgBreakPoint.h
Normal file
49
include/debugger/dbgBreakPoint.h
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// dbgBreakPoint.h - debugger
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// class dbgBreakPoint
|
||||
//
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DBGBREAKPOINT_H
|
||||
#define DBGBREAKPOINT_H
|
||||
|
||||
class dbgBreakPoint
|
||||
{
|
||||
public:
|
||||
dbgBreakPoint(const wxString &_funcOid, const wxString &_pkgOid = wxT("-1"),
|
||||
const int &_lineNo = -1)
|
||||
: m_func(_funcOid), m_pkg(_pkgOid), m_lineNo(_lineNo) {}
|
||||
|
||||
wxString &GetFunctionOid()
|
||||
{
|
||||
return m_func;
|
||||
}
|
||||
wxString &GetPackageOid()
|
||||
{
|
||||
return m_pkg;
|
||||
}
|
||||
int &GetLineNo()
|
||||
{
|
||||
return m_lineNo;
|
||||
}
|
||||
|
||||
private:
|
||||
wxString m_func;
|
||||
wxString m_pkg;
|
||||
int m_lineNo;
|
||||
};
|
||||
|
||||
WX_DECLARE_LIST(dbgBreakPoint, dbgBreakPointList);
|
||||
|
||||
#endif
|
||||
80
include/debugger/dbgConst.h
Normal file
80
include/debugger/dbgConst.h
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// dbgConst.h - debugger
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Constants and enumerator Identifiers for the entire debugger
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DBGCONST_H
|
||||
#define DBGCONST_H
|
||||
|
||||
const int ID_BTNNEXT = 1800;
|
||||
const int ID_GRDFUNCARGS = 1810;
|
||||
const int ID_TXTMESSAGE = 1820;
|
||||
const int ID_TIMER = 1830;
|
||||
const int ID_BTNCANCEL = 1840;
|
||||
|
||||
const int ID_PARAMGRID = 1000;
|
||||
const int ID_VARGRID = 1001;
|
||||
const int ID_MSG_PAGE = 1002;
|
||||
const int ID_PKGVARGRID = 1003;
|
||||
|
||||
enum
|
||||
{
|
||||
MENU_ID_EXECUTE = 10001, // Execute command entered by user
|
||||
|
||||
MENU_ID_TOGGLE_BREAK, // Set/Unset breakpoint
|
||||
MENU_ID_CLEAR_ALL_BREAK, // Clear all breakpoints
|
||||
MENU_ID_CONTINUE, // Continue
|
||||
MENU_ID_STEP_OVER, // Step over
|
||||
MENU_ID_STEP_INTO, // Step into
|
||||
MENU_ID_STOP, // Stop debugging
|
||||
|
||||
MENU_ID_START_DEBUGGING, // Spawn a separate debugger process
|
||||
MENU_ID_NOTICE_RECEIVED, // NOTICE received from server
|
||||
WINDOW_ID_STACK, // Tree-control window
|
||||
WINDOW_ID_CONSOLE, // Console window
|
||||
WINDOW_ID_TABS, // Tab window
|
||||
WINDOW_ID_BREAKPOINTS, // Breakpoints window
|
||||
WINDOW_ID_RESULT_GRID, // Results window
|
||||
WINDOW_ID_COMMAND, // Command window
|
||||
SOCKET_ID_DEBUG, // Debugger Socket ID
|
||||
|
||||
MENU_ID_VIEW_TOOLBAR, // View menu options
|
||||
MENU_ID_VIEW_STACKPANE,
|
||||
MENU_ID_VIEW_OUTPUTPANE,
|
||||
MENU_ID_VIEW_DEFAULTVIEW,
|
||||
|
||||
RESULT_ID_ATTACH_TO_PORT, // Debugger - attach to port completed
|
||||
RESULT_ID_BREAKPOINT, // Debugger - breakpoint reached
|
||||
RESULT_ID_GET_VARS, // Debugger - variable list complete
|
||||
RESULT_ID_GET_STACK, // Debugger - stack trace complete
|
||||
RESULT_ID_GET_BREAKPOINTS, // Debugger - breakpoint list complete
|
||||
RESULT_ID_NEW_BREAKPOINT, // Debugger - set breakpoint complete
|
||||
RESULT_ID_NEW_BREAKPOINT_WAIT, // Debugger - set breakpoint complete, wait for target progress
|
||||
RESULT_ID_DEL_BREAKPOINT, // Debugger - drop breakpoint complete
|
||||
RESULT_ID_DEPOSIT_VALUE, // Debugger - deposit value complete
|
||||
RESULT_ID_ADD_BREAKPOINT, // Debugger - target info received, now set a breakpoint
|
||||
RESULT_ID_LISTENER_CREATED, // Debugger - global listener created
|
||||
RESULT_ID_TARGET_READY, // Debugger - target session attached
|
||||
RESULT_ID_LAST_BREAKPOINT, // Debugger - last breakpoint created
|
||||
RESULT_ID_ARGS_UPDATED, // Debugger - Values are evaluated and been updated in the arguments
|
||||
RESULT_ID_ARGS_UPDATE_ERROR, // Debugger - Error while evaluateling the value for the arguments
|
||||
|
||||
RESULT_ID_DIRECT_TARGET_COMPLETE, // DirectDebug - target function complete
|
||||
|
||||
ID_DEBUG_INITIALIZER // Debugger - debug package initializer? checkbox
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
183
include/debugger/dbgController.h
Normal file
183
include/debugger/dbgController.h
Normal file
|
|
@ -0,0 +1,183 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// dbgController.h - Debugger controller
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// class dbgController
|
||||
//
|
||||
// A dbgController object controls the behaviour of the debugger. It stays
|
||||
// in the central of the whole debugger mechanism. It controls the flow of
|
||||
// execution and also, asks the view to update the user presentation (when
|
||||
// needed), also execute commands based on the user inputs.
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DBGCONTROLLER_H
|
||||
#define DBGCONTROLLER_H
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/event.h>
|
||||
|
||||
#include "db/pgQueryResultEvent.h"
|
||||
#include "debugger/dbgTargetInfo.h"
|
||||
#include "debugger/dbgModel.h"
|
||||
|
||||
class frmMain;
|
||||
class frmDebugger;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DBG_SESSION_TYPE_UNKNOWN, // Session could be in-context or direct
|
||||
DBG_SESSION_TYPE_INCONTEXT, // Session is configured for in-context debugging
|
||||
DBG_SESSION_TYPE_DIRECT // Session is configured for direct debugging
|
||||
} DebuggerSessionType;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DEBUGGER_UNKNOWN_API = 0,
|
||||
DEBUGGER_V1_API = 1,
|
||||
DEBUGGER_V2_API = 2,
|
||||
DEBUGGER_V3_API = 3
|
||||
} DebuggerApiVersion;
|
||||
|
||||
|
||||
class dbgController : public wxEvtHandler
|
||||
{
|
||||
public:
|
||||
dbgController(frmMain *_main, pgObject *_obj, bool _directDebugging = false);
|
||||
~dbgController();
|
||||
|
||||
dbgTargetInfo *GetTargetInfo();
|
||||
dbgModel *GetModel()
|
||||
{
|
||||
return m_model;
|
||||
}
|
||||
|
||||
bool CanRestart()
|
||||
{
|
||||
return (m_dbgConn && (m_dbgConn->GetStatus() != PGCONN_OK));
|
||||
}
|
||||
|
||||
// Debugging actions (called from the frmDebugger)
|
||||
bool Start();
|
||||
void ClearBreakpoint(int _lineNo);
|
||||
void SetBreakpoint(int _lineNo);
|
||||
void Countinue();
|
||||
void StepOver();
|
||||
void StepInto();
|
||||
bool Stop();
|
||||
void DepositValue(const wxString &_name, const wxString &_val);
|
||||
bool SelectFrame(int _frameNo);
|
||||
void UpdateBreakpoints();
|
||||
|
||||
bool HandleQuery(pgBatchQuery *_qry, const wxString &_err);
|
||||
|
||||
// Closing Debugger
|
||||
bool CloseDebugger();
|
||||
bool ExecuteTarget();
|
||||
bool IsTerminated()
|
||||
{
|
||||
return m_terminated;
|
||||
}
|
||||
|
||||
// Event functions
|
||||
void OnNoticeReceived(wxCommandEvent &);
|
||||
void OnStartDebugging(wxCommandEvent &);
|
||||
|
||||
void ResultTargetComplete(pgQueryResultEvent &);
|
||||
void ResultPortAttach(pgQueryResultEvent &);
|
||||
void ResultBreakpoint(pgQueryResultEvent &);
|
||||
void ResultVarList(pgQueryResultEvent &);
|
||||
void ResultStack(pgQueryResultEvent &);
|
||||
void ResultBreakpoints(pgQueryResultEvent &);
|
||||
void ResultNewBreakpoint(pgQueryResultEvent &);
|
||||
void ResultNewBreakpointWait(pgQueryResultEvent &);
|
||||
void ResultDeletedBreakpoint(pgQueryResultEvent &);
|
||||
void ResultDepositValue(pgQueryResultEvent &);
|
||||
void ResultListenerCreated(pgQueryResultEvent &);
|
||||
void ResultTargetReady(pgQueryResultEvent &);
|
||||
|
||||
private:
|
||||
static void NoticeHandler(void *arg, const char *message);
|
||||
|
||||
private:
|
||||
const static wxString ms_cmdDebugSPLV1;
|
||||
const static wxString ms_cmdDebugSPLV2;
|
||||
const static wxString ms_cmdDebugPLPGSQLV1;
|
||||
const static wxString ms_cmdDebugPLPGSQLV2;
|
||||
const static wxString ms_cmdAttachToPort;
|
||||
const static wxString ms_cmdWaitForBreakpointV1;
|
||||
const static wxString ms_cmdWaitForBreakpointV2;
|
||||
const static wxString ms_cmdGetVars;
|
||||
const static wxString ms_cmdGetStack;
|
||||
const static wxString ms_cmdGetBreakpoints;
|
||||
const static wxString ms_cmdStepOverV1;
|
||||
const static wxString ms_cmdStepOverV2;
|
||||
const static wxString ms_cmdStepIntoV1;
|
||||
const static wxString ms_cmdStepIntoV2;
|
||||
const static wxString ms_cmdContinueV1;
|
||||
const static wxString ms_cmdContinueV2;
|
||||
const static wxString ms_cmdSetBreakpointV1;
|
||||
const static wxString ms_cmdSetBreakpointV2;
|
||||
const static wxString ms_cmdClearBreakpointV1;
|
||||
const static wxString ms_cmdClearBreakpointV2;
|
||||
const static wxString ms_cmdSelectFrameV1;
|
||||
const static wxString ms_cmdSelectFrameV2;
|
||||
const static wxString ms_cmdDepositValue;
|
||||
const static wxString ms_cmdAbortTarget;
|
||||
const static wxString ms_cmdAddBreakpointEDB;
|
||||
const static wxString ms_cmdAddBreakpointPG;
|
||||
const static wxString ms_cmdGetTargetInfo;
|
||||
const static wxString ms_cmdCreateListener;
|
||||
const static wxString ms_cmdWaitForTarget;
|
||||
const static wxString ms_cmdIsBackendRunning;
|
||||
|
||||
private:
|
||||
// Debugger Version for the current server
|
||||
DebuggerApiVersion m_ver;
|
||||
|
||||
// Session type
|
||||
DebuggerSessionType m_sessionType;
|
||||
|
||||
// Line actually shown from this offset
|
||||
int m_lineOffset;
|
||||
|
||||
// Debugging Terminated
|
||||
bool m_terminated;
|
||||
bool m_isStopping;
|
||||
|
||||
// Main Window for the debugger
|
||||
frmDebugger *m_frm;
|
||||
|
||||
// Connection for collecting the current debugging information
|
||||
pgConn *m_dbgConn;
|
||||
// Connetion Thread for fetching the debugging information in background
|
||||
pgQueryThread *m_dbgThread;
|
||||
// Connection to execute the function/procedure for the direct debugging
|
||||
pgConn *m_execConn;
|
||||
// Connection-thread to run the function in background for debugging
|
||||
pgQueryThread *m_execConnThread;
|
||||
// Mutex for debugger thread
|
||||
wxMutex m_dbgThreadLock;
|
||||
|
||||
// Debugger Data Model
|
||||
dbgModel *m_model;
|
||||
|
||||
// In-direct Debugging on which target-pid
|
||||
wxString m_currTargetPid;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
};
|
||||
|
||||
#define MARKERINDEX_TO_MARKERMASK( MI ) ( 1 << MI )
|
||||
|
||||
#endif
|
||||
142
include/debugger/dbgModel.h
Normal file
142
include/debugger/dbgModel.h
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// dbgModel.h - Debugger Model
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DBGMODEL_H
|
||||
#define DBGMODEL_H
|
||||
|
||||
#include <wx/wx.h>
|
||||
|
||||
#include "debugger/dbgBreakPoint.h"
|
||||
#include "debugger/dbgTargetInfo.h"
|
||||
|
||||
class dbgCachedStack
|
||||
{
|
||||
public:
|
||||
dbgCachedStack() {}
|
||||
dbgCachedStack(const wxString &_pkg, const wxString &_func,
|
||||
const wxString &_target, const wxString &_arg, const wxString &_src)
|
||||
: m_func(_func), m_pkg(_pkg), m_source(_src),
|
||||
m_target(_target), m_arg(_arg) {}
|
||||
|
||||
dbgCachedStack(const dbgCachedStack &_src)
|
||||
: m_func(_src.m_func), m_pkg(_src.m_pkg), m_source(_src.m_source),
|
||||
m_target(_src.m_target), m_arg(_src.m_arg) {}
|
||||
|
||||
dbgCachedStack &operator =(const dbgCachedStack &_src)
|
||||
{
|
||||
m_func = _src.m_func;
|
||||
m_pkg = _src.m_pkg;
|
||||
m_source = _src.m_source;
|
||||
m_target = _src.m_target;
|
||||
m_arg = _src.m_arg;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
wxString m_pkg; // Package OID
|
||||
wxString m_func; // Function OID
|
||||
wxString m_target; // Target Name
|
||||
wxString m_arg; // Argument passed to the target
|
||||
wxString m_source; // Source code for this function
|
||||
|
||||
friend class frmDebugger;
|
||||
};
|
||||
|
||||
WX_DECLARE_STRING_HASH_MAP(dbgCachedStack, dbgSourceHash);
|
||||
|
||||
class dbgModel
|
||||
{
|
||||
public:
|
||||
dbgModel(Oid _target, pgConn *_conn);
|
||||
|
||||
dbgTargetInfo *GetTarget()
|
||||
{
|
||||
return m_target;
|
||||
}
|
||||
dbgBreakPointList &GetBreakPoints()
|
||||
{
|
||||
return m_breakpoints;
|
||||
}
|
||||
|
||||
wxString &GetPort()
|
||||
{
|
||||
return m_port;
|
||||
}
|
||||
wxString &GetSession()
|
||||
{
|
||||
return m_session;
|
||||
}
|
||||
wxString &GetTargetPid()
|
||||
{
|
||||
return m_targetPid;
|
||||
}
|
||||
|
||||
bool GetSource(const wxString &_funcOid, dbgCachedStack *_cached = NULL);
|
||||
void ClearCachedSource();
|
||||
void AddSource(const wxString &_funcOid, const dbgCachedStack &cached);
|
||||
|
||||
bool RequireDisplayUpdate()
|
||||
{
|
||||
return (m_focusedFuncOid != m_displayedFuncOid ||
|
||||
m_displayedPkgOid != m_focusedPkgOid);
|
||||
}
|
||||
|
||||
wxString &GetFocusedPackage()
|
||||
{
|
||||
return m_focusedPkgOid;
|
||||
}
|
||||
wxString &GetDisplayedPackage()
|
||||
{
|
||||
return m_displayedPkgOid;
|
||||
}
|
||||
wxString &GetFocusedFunction()
|
||||
{
|
||||
return m_focusedFuncOid;
|
||||
}
|
||||
wxString &GetDisplayedFunction()
|
||||
{
|
||||
return m_displayedFuncOid;
|
||||
}
|
||||
|
||||
int &GetCurrLineNo()
|
||||
{
|
||||
return m_currLineNo;
|
||||
}
|
||||
|
||||
private:
|
||||
// Target Information
|
||||
dbgTargetInfo *m_target;
|
||||
|
||||
// Break-Points
|
||||
dbgBreakPointList m_breakpoints;
|
||||
|
||||
// Debugging Port, session-handle & target-backend pid
|
||||
wxString m_port;
|
||||
wxString m_session;
|
||||
wxString m_targetPid;
|
||||
|
||||
// Cached source-code for the stacked functions
|
||||
dbgSourceHash m_sourceMap;
|
||||
|
||||
// Current focused function-information
|
||||
wxString m_focusedFuncOid;
|
||||
wxString m_focusedPkgOid;
|
||||
|
||||
// Current displayed function-information
|
||||
wxString m_displayedFuncOid;
|
||||
wxString m_displayedPkgOid;
|
||||
|
||||
// Current Line number
|
||||
int m_currLineNo;
|
||||
};
|
||||
|
||||
#endif
|
||||
248
include/debugger/dbgTargetInfo.h
Normal file
248
include/debugger/dbgTargetInfo.h
Normal file
|
|
@ -0,0 +1,248 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// dbgTargetInfo.h - debugger
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#ifndef DBGTARGETINFO_H
|
||||
#define DBGTARGETINFO_H
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include "db/pgConn.h"
|
||||
#include "db/pgQueryThread.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// class dbgArgInfo
|
||||
//
|
||||
// A dbgArgInfo object contains information about a function (or procedure)
|
||||
// argument. Inside of each wsArgInfo object, we store the name of the argument,
|
||||
// the argument type, and the argument mode (IN (i), OUT (o), or INOUT (b)).
|
||||
//
|
||||
// Once the user has had a chance to enter values for each of the IN and INOUT
|
||||
// arguments, we store those values inside of the corresponding wsArgInfo objects
|
||||
class dbgArgInfo
|
||||
{
|
||||
public:
|
||||
dbgArgInfo(const wxString &_name, const wxString &_type, Oid _typeOid,
|
||||
short _mode = pgParam::PG_PARAM_IN);
|
||||
|
||||
Oid GetType()
|
||||
{
|
||||
return m_typeOid;
|
||||
}
|
||||
const wxString &GetTypeName()
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
wxString &GetName()
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
short GetMode()
|
||||
{
|
||||
return m_mode;
|
||||
}
|
||||
bool IsArray()
|
||||
{
|
||||
return !(m_baseType.IsEmpty());
|
||||
}
|
||||
const wxString &GetBaseType()
|
||||
{
|
||||
return m_baseType;
|
||||
}
|
||||
bool &Null()
|
||||
{
|
||||
return m_null;
|
||||
}
|
||||
wxString &Value()
|
||||
{
|
||||
return m_val;
|
||||
}
|
||||
|
||||
void SetDefault(const wxString &val)
|
||||
{
|
||||
m_hasDefault = true;
|
||||
m_defValue = val;
|
||||
}
|
||||
wxString &Default()
|
||||
{
|
||||
return m_defValue;
|
||||
}
|
||||
bool HasDefault()
|
||||
{
|
||||
return m_hasDefault;
|
||||
}
|
||||
bool &UseDefault()
|
||||
{
|
||||
return m_useDefault;
|
||||
}
|
||||
|
||||
pgParam *GetParam(wxMBConv *_conv = NULL);
|
||||
|
||||
private:
|
||||
dbgArgInfo(const dbgArgInfo &_arg)
|
||||
{
|
||||
wxASSERT(0);
|
||||
}
|
||||
|
||||
dbgArgInfo &operator= (const dbgArgInfo &)
|
||||
{
|
||||
wxASSERT(0);
|
||||
return *this;
|
||||
}
|
||||
|
||||
wxString m_name; /* Name of the argument */
|
||||
wxString m_type; /* Type of the argument */
|
||||
wxString m_baseType; /* Base type of an array type */
|
||||
wxString m_defValue; /* Default Value */
|
||||
Oid m_typeOid; /* OID of Type */
|
||||
short m_mode; /* IN, IN OUT, OUT, or VARAIDIC */
|
||||
bool m_hasDefault; /* Has the default value? */
|
||||
bool m_useDefault; /* Use the default value? */
|
||||
bool m_null; /* Is Value NULL */
|
||||
wxString m_val; /* Value */
|
||||
};
|
||||
|
||||
WX_DEFINE_ARRAY_PTR(dbgArgInfo *, pgDbgArgs);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// class dbgTargetInfo
|
||||
//
|
||||
// This class implements a container that holds information necessary to invoke
|
||||
// a debugger target (a function or procedure).
|
||||
//
|
||||
// When the constructor is called, it sends a query to the server to retreive:
|
||||
// the OID of the target,
|
||||
// the name of the target,
|
||||
// the name of the schema in which the target is defined
|
||||
// the name of the language in which the target is defined
|
||||
// the number of arguments expected by the target
|
||||
// the argument names
|
||||
// the argument types
|
||||
// the argument modes (IN, OUT, or INOUT)
|
||||
// the target type (function or procedure)
|
||||
//
|
||||
// This class offers a number of (inline) member functions that you can call
|
||||
// to extract the above information after it's been queried from the server.
|
||||
//
|
||||
class dbgTargetInfo
|
||||
{
|
||||
public:
|
||||
dbgTargetInfo(Oid _target, pgConn *_conn);
|
||||
|
||||
const wxString &GetQualifiedName()
|
||||
{
|
||||
return m_fqName;
|
||||
}
|
||||
|
||||
const wxString &GetLanguage()
|
||||
{
|
||||
return m_language;
|
||||
}
|
||||
|
||||
const wxString &GetPackageName()
|
||||
{
|
||||
return m_package;
|
||||
}
|
||||
const wxString &GetSchemaName()
|
||||
{
|
||||
return m_schema;
|
||||
}
|
||||
|
||||
const wxString &GetName()
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
const wxString &GetReturnType()
|
||||
{
|
||||
return m_returnType;
|
||||
}
|
||||
|
||||
long GetOid()
|
||||
{
|
||||
return m_oid;
|
||||
}
|
||||
|
||||
long GetPkgOid()
|
||||
{
|
||||
return m_pkgOid;
|
||||
}
|
||||
|
||||
long GetSchemaOid()
|
||||
{
|
||||
return m_schemaOid;
|
||||
}
|
||||
|
||||
long GetPkgInitOid()
|
||||
{
|
||||
return m_pkgInitOid;
|
||||
}
|
||||
|
||||
bool GetIsFunction()
|
||||
{
|
||||
return m_isFunction;
|
||||
}
|
||||
|
||||
bool GetReturnsSet()
|
||||
{
|
||||
return m_returnsSet;
|
||||
}
|
||||
|
||||
bool RequireUserInput()
|
||||
{
|
||||
return ((m_pkgOid != 0 && m_pkgInitOid != 0) || m_inputParamCnt != 0);
|
||||
}
|
||||
|
||||
bool &DebugPackageConstructor()
|
||||
{
|
||||
return m_debugPkgCon;
|
||||
}
|
||||
|
||||
dbgArgInfo *operator[](int index);
|
||||
|
||||
pgDbgArgs *GetArgs()
|
||||
{
|
||||
return m_args;
|
||||
}
|
||||
|
||||
bool HasVariadic()
|
||||
{
|
||||
return m_hasVariadic;
|
||||
}
|
||||
|
||||
bool AddForExecution(pgQueryThread *_thread);
|
||||
|
||||
private:
|
||||
wxString m_name; // Target name (function or procedure)
|
||||
wxString m_schema; // Schema in which target resides
|
||||
wxString m_package; // Package in which target resides
|
||||
wxString m_language; // Language in which target is defined
|
||||
|
||||
wxString m_returnType; // Return type
|
||||
wxString m_funcSignature; // Function Signature
|
||||
|
||||
wxString m_fqName; // Function qualified name
|
||||
|
||||
bool m_isFunction; // true->target is a function, false->target is a procedure
|
||||
bool m_returnsSet; // Returns a set?
|
||||
bool m_hasVariadic; // Has the variadic argument
|
||||
|
||||
bool m_debugPkgCon; // Debug Package Constructor
|
||||
|
||||
long m_oid; // Target function/procedure OID
|
||||
long m_pkgOid; // Package in which target defined (if non-zero)
|
||||
long m_pkgInitOid; // OID of the package initializer function.
|
||||
long m_schemaOid; // OID of the schema
|
||||
|
||||
size_t m_inputParamCnt; // IN/IN OUT parameter count
|
||||
|
||||
pgDbgArgs *m_args; // Function arguments
|
||||
};
|
||||
|
||||
#endif
|
||||
42
include/debugger/debugger.h
Normal file
42
include/debugger/debugger.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// debugger.h - Debugger factories
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DEBUGGER_H
|
||||
#define DEBUGGER_H
|
||||
|
||||
// wxWindows headers
|
||||
#include <wx/wx.h>
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
// Debugger factory
|
||||
///////////////////////////////////////////////////
|
||||
class debuggerFactory : public actionFactory
|
||||
{
|
||||
public:
|
||||
debuggerFactory(menuFactoryList *list, wxMenu *mnu, ctlMenuToolbar *toolbar);
|
||||
wxWindow *StartDialog(frmMain *form, pgObject *obj);
|
||||
bool CheckEnable(pgObject *obj);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
// Breakpoint factory
|
||||
///////////////////////////////////////////////////
|
||||
class breakpointFactory : public actionFactory
|
||||
{
|
||||
public:
|
||||
breakpointFactory(menuFactoryList *list, wxMenu *mnu, ctlMenuToolbar *toolbar);
|
||||
wxWindow *StartDialog(frmMain *form, pgObject *obj);
|
||||
bool CheckEnable(pgObject *obj);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
126
include/debugger/dlgDirectDbg.h
Normal file
126
include/debugger/dlgDirectDbg.h
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// dlgDirectDbg.h - debugger
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// class dlgDirectDbg
|
||||
//
|
||||
// This class implements 'direct-debugging'. In direct-debugging, the user
|
||||
// provides a function signature, procedure signature, or OID on the command
|
||||
// line (this identifies the debug target). We query the server for the
|
||||
// names, types, and in/out modes for each target parameter and then prompt
|
||||
// the user to enter a value for each of the IN (and IN/OUT) parameters.
|
||||
//
|
||||
// When the user fills in the parameter values and clicks OK, we set a
|
||||
// breakpoint at the target and then execute a SELECT statement or an
|
||||
// EXEC statement that invokes the target (with the parameter values
|
||||
// provided by the user).
|
||||
//
|
||||
// A dlgDirectDbg object is typically a child of the frmDebugger object
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DLGDIRECTDBG_H
|
||||
#define DLGDIRECTDBG_H
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/grid.h>
|
||||
#include <wx/strconv.h>
|
||||
|
||||
#include "dlg/dlgClasses.h"
|
||||
|
||||
class dbgArgInfo;
|
||||
class frmDebugger;
|
||||
class dbgController;
|
||||
|
||||
class ctlGridCellBoolEditor : public wxGridCellBoolEditor
|
||||
{
|
||||
public:
|
||||
ctlGridCellBoolEditor(dbgArgInfo *_arg = NULL);
|
||||
void BeginEdit (int _row, int _col, wxGrid *_grid);
|
||||
wxGridCellEditor *Clone() const;
|
||||
|
||||
dbgArgInfo *GetArg()
|
||||
{
|
||||
return m_arg;
|
||||
}
|
||||
|
||||
private:
|
||||
dbgArgInfo *m_arg;
|
||||
};
|
||||
|
||||
class dlgDirectDbg;
|
||||
|
||||
class dbgArgValueEvaluator : public wxThread
|
||||
{
|
||||
public:
|
||||
dbgArgValueEvaluator(pgConn *, dlgDirectDbg *);
|
||||
|
||||
void *Entry();
|
||||
void CancelEval();
|
||||
static void NoticeHandler(void *, const char *);
|
||||
|
||||
private:
|
||||
pgConn *m_conn;
|
||||
dlgDirectDbg *m_dlg;
|
||||
|
||||
bool m_cancelled;
|
||||
};
|
||||
|
||||
|
||||
class dlgDirectDbg : public pgDialog
|
||||
{
|
||||
DECLARE_CLASS(dlgDirectDbg)
|
||||
|
||||
public:
|
||||
dlgDirectDbg(frmDebugger *_parent, dbgController *_controller,
|
||||
pgConn *_conn);
|
||||
|
||||
enum
|
||||
{
|
||||
COL_NAME = 0, // Column 0 contains the variable name
|
||||
COL_TYPE, // Type of column
|
||||
COL_NULL, // Value Set to NULL (yes/no)
|
||||
COL_EXPR, // Value is an expression (yes/no)
|
||||
COL_VALUE, // Value (constant ,or an expression)
|
||||
COL_USE_DEF, // Use the default value
|
||||
COL_DEF_VAL // Default value for the column
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
void PopulateParamGrid();
|
||||
|
||||
void OnOk(wxCommandEvent &event);
|
||||
void OnCancel(wxCommandEvent &event);
|
||||
void OnClickGridLabel(wxGridEvent &event);
|
||||
|
||||
void ResultArgsUpdated(wxCommandEvent &);
|
||||
void ResultArgsUpdateError(wxCommandEvent &);
|
||||
|
||||
void SaveSettings();
|
||||
void LoadSettings();
|
||||
// Function to retrive last cell value if the provieded parameter value is an invalid.
|
||||
void LoadLastCellSetting(int row_number, int array_row_number,
|
||||
int index_number, bool isArray);
|
||||
|
||||
wxGrid *GetParamsGrid();
|
||||
bool DebugPkgConstructor();
|
||||
|
||||
dbgController *m_controller;
|
||||
pgConn *m_conn;
|
||||
dbgArgValueEvaluator *m_thread;
|
||||
|
||||
friend class dbgArgValueEvaluator;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif
|
||||
176
include/debugger/frmDebugger.h
Normal file
176
include/debugger/frmDebugger.h
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// frmDebugger.h - debugger
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// class frmDebugger
|
||||
//
|
||||
// frmDebugger manages the user interface for the workstation. This class
|
||||
// manages the toolbar, menu, status bar, and top-level windows.
|
||||
//
|
||||
// This class also defines event handlers for a number of high-level events
|
||||
// (such as window sizing and layout, and creation of new windows).
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef FRMDEBUGGER_H
|
||||
#define FRMDEBUGGER_H
|
||||
|
||||
#include <wx/aui/aui.h>
|
||||
#include <wx/progdlg.h>
|
||||
|
||||
#include "ctl/ctlProgressStatusBar.h"
|
||||
|
||||
//
|
||||
// This number MUST be incremented if changing any of the default perspectives
|
||||
//
|
||||
#define FRMDEBUGGER_PERSPECTIVE_VER wxT("8189")
|
||||
|
||||
#ifdef __WXMAC__
|
||||
#define FRMDEBUGGER_DEFAULT_PERSPECTIVE wxT("layout2|name=toolBar;caption=Toolbar;state=2108144;dir=1;layer=10;row=0;pos=1;prop=100000;bestw=154;besth=23;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=sourcePane;caption=Source pane;state=1020;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=350;besth=200;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=stackPane;caption=Stack pane;state=2099196;dir=2;layer=0;row=0;pos=0;prop=100000;bestw=250;besth=200;minw=100;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=outputPane;caption=Output pane;state=2099196;dir=3;layer=0;row=0;pos=0;prop=100000;bestw=550;besth=300;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|dock_size(1,10,0)=25|dock_size(5,0,0)=237|dock_size(2,0,0)=237|dock_size(3,0,0)=156|")
|
||||
#else
|
||||
#ifdef __WXGTK__
|
||||
#define FRMDEBUGGER_DEFAULT_PERSPECTIVE wxT("layout2|name=toolBar;caption=Toolbar;state=2108144;dir=1;layer=10;row=0;pos=1;prop=100000;bestw=205;besth=30;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=sourcePane;caption=Source pane;state=1020;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=350;besth=200;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=stackPane;caption=Stack pane;state=2099196;dir=2;layer=0;row=0;pos=0;prop=100000;bestw=250;besth=200;minw=100;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=outputPane;caption=Output pane;state=2099196;dir=3;layer=0;row=0;pos=0;prop=100000;bestw=550;besth=300;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|dock_size(1,10,0)=25|dock_size(5,0,0)=237|dock_size(2,0,0)=237|dock_size(3,0,0)=156|")
|
||||
#else
|
||||
#define FRMDEBUGGER_DEFAULT_PERSPECTIVE wxT("layout2|name=toolBar;caption=Toolbar;state=2108144;dir=1;layer=10;row=0;pos=1;prop=100000;bestw=154;besth=23;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=sourcePane;caption=Source pane;state=1020;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=350;besth=200;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=stackPane;caption=Stack pane;state=2099196;dir=2;layer=0;row=0;pos=0;prop=100000;bestw=250;besth=200;minw=100;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=outputPane;caption=Output pane;state=2099196;dir=3;layer=0;row=0;pos=0;prop=100000;bestw=550;besth=300;minw=200;minh=100;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|dock_size(1,10,0)=25|dock_size(5,0,0)=237|dock_size(2,0,0)=237|dock_size(3,0,0)=156|")
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Debugger Controller
|
||||
class dbgController;
|
||||
class frmMain;
|
||||
class ctlTabWindow;
|
||||
class ctlResultGrid;
|
||||
class ctlVarWindow;
|
||||
class ctlSQLBox;
|
||||
class dbgCachedStack;
|
||||
|
||||
class frmDebugger : public pgFrame
|
||||
{
|
||||
DECLARE_CLASS(frmDebugger)
|
||||
|
||||
public:
|
||||
frmDebugger(frmMain *_parent, dbgController *_controller,
|
||||
const wxString &_title);
|
||||
virtual ~frmDebugger();
|
||||
|
||||
void SetupDebugger();
|
||||
|
||||
void SetStatusText(const wxString &_status);
|
||||
|
||||
ctlTabWindow *GetTabWindow()
|
||||
{
|
||||
return m_tabWindow;
|
||||
}
|
||||
ctlStackWindow *GetStackWindow()
|
||||
{
|
||||
return m_stackWindow;
|
||||
}
|
||||
ctlMessageWindow *GetMessageWindow()
|
||||
{
|
||||
return m_tabWindow->GetMessageWindow();
|
||||
}
|
||||
|
||||
ctlVarWindow *GetVarWindow(bool create)
|
||||
{
|
||||
return m_tabWindow->GetVarWindow(create);
|
||||
}
|
||||
ctlVarWindow *GetParamWindow(bool create)
|
||||
{
|
||||
return m_tabWindow->GetParamWindow(create);
|
||||
}
|
||||
ctlVarWindow *GetPkgVarWindow(bool create)
|
||||
{
|
||||
return m_tabWindow->GetPkgVarWindow(create);
|
||||
}
|
||||
ctlResultGrid *GetResultWindow()
|
||||
{
|
||||
return m_tabWindow->GetResultWindow();
|
||||
}
|
||||
|
||||
void DisplaySource(dbgCachedStack &);
|
||||
|
||||
void EnableToolsAndMenus(bool enable = true);
|
||||
void UnhilightCurrentLine();
|
||||
void HighlightLine(int _lineNo);
|
||||
void ClearBreakpointMarkers();
|
||||
void MarkBreakpoint(int lineNo);
|
||||
void CloseProgressBar();
|
||||
void LaunchWaitingDialog(const wxString &msg = wxEmptyString);
|
||||
|
||||
private:
|
||||
|
||||
int GetLineNo();
|
||||
bool IsBreakpoint(int _lineNo);
|
||||
void ClearAllBreakpoints();
|
||||
|
||||
wxMenuBar *SetupMenuBar( void );
|
||||
ctlMenuToolbar *SetupToolBar( void );
|
||||
ctlProgressStatusBar *SetupStatusBar( void );
|
||||
|
||||
enum
|
||||
{
|
||||
MARKER_CURRENT = 0x02, // Current line marker
|
||||
MARKER_CURRENT_BG = 0x04, // Current line marker - background hilight
|
||||
MARKER_BREAKPOINT = 0x01, // Breakpoint marker
|
||||
};
|
||||
|
||||
private:
|
||||
// Menu bar
|
||||
wxMenuBar *m_menuBar;
|
||||
// Frames' toolbar
|
||||
ctlMenuToolbar *m_toolBar;
|
||||
// View menu (can be modified by wxCodeWindow)
|
||||
wxMenu *m_viewMenu;
|
||||
// Debug menu (can be modified by wxCodeWindow)
|
||||
wxMenu *m_debugMenu;
|
||||
|
||||
wxAuiManager m_manager;
|
||||
// Frame's status bar
|
||||
ctlProgressStatusBar *m_statusBar;
|
||||
// Main Frame
|
||||
frmMain *m_parent;
|
||||
// Debugger Controller
|
||||
dbgController *m_controller;
|
||||
|
||||
// Stack Window
|
||||
ctlStackWindow *m_stackWindow;
|
||||
// Tab Window
|
||||
ctlTabWindow *m_tabWindow;
|
||||
// Function Code Viewer
|
||||
ctlSQLBox *m_codeViewer;
|
||||
|
||||
// Operation Status
|
||||
wxString m_statusTxt;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
void OnExecute(wxCommandEvent &_ev);
|
||||
void OnDebugCommand(wxCommandEvent &_ev);
|
||||
void OnSelectFrame(wxCommandEvent &_ev);
|
||||
// Toggle break-point on margin click
|
||||
void OnMarginClick(wxStyledTextEvent &_ev);
|
||||
void OnPositionStc(wxStyledTextEvent &_ev);
|
||||
void OnVarChange(wxGridEvent &_ev);
|
||||
void OnClose(wxCloseEvent &_ev);
|
||||
void OnExit(wxCommandEvent &_ev);
|
||||
void OnSize(wxSizeEvent &_ev);
|
||||
void OnEraseBackground(wxEraseEvent &_ev);
|
||||
void OnHelp(wxCommandEvent &_ev);
|
||||
void OnContents(wxCommandEvent &_ev);
|
||||
|
||||
void OnToggleToolBar(wxCommandEvent &_ev);
|
||||
void OnToggleStackPane(wxCommandEvent &_ev);
|
||||
void OnToggleOutputPane(wxCommandEvent &_ev);
|
||||
void OnAuiUpdate(wxAuiManagerEvent &_ev);
|
||||
void OnDefaultView(wxCommandEvent &_ev);
|
||||
};
|
||||
|
||||
#endif
|
||||
30
include/debugger/module.mk
Normal file
30
include/debugger/module.mk
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#######################################################################
|
||||
#
|
||||
# pgAdmin III - PostgreSQL Tools
|
||||
#
|
||||
# Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
# This software is released under the PostgreSQL Licence
|
||||
#
|
||||
# module.mk - pgadmin/debugger/include/ Makefile fragment
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
pgadmin3_SOURCES += \
|
||||
include/debugger/dbgController.h \
|
||||
include/debugger/dbgModel.h \
|
||||
include/debugger/ctlMessageWindow.h \
|
||||
include/debugger/ctlResultGrid.h \
|
||||
include/debugger/ctlStackWindow.h \
|
||||
include/debugger/ctlTabWindow.h \
|
||||
include/debugger/ctlVarWindow.h \
|
||||
include/debugger/dbgBreakPoint.h \
|
||||
include/debugger/dbgConst.h \
|
||||
include/debugger/dbgTargetInfo.h \
|
||||
include/debugger/debugger.h \
|
||||
include/debugger/dlgDirectDbg.h \
|
||||
include/debugger/frmDebugger.h
|
||||
|
||||
EXTRA_DIST += \
|
||||
include/debugger/module.mk
|
||||
|
||||
|
||||
39
include/dlg/dlgAddFavourite.h
Normal file
39
include/dlg/dlgAddFavourite.h
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// dlgAddFavourite.h - Add a favourite
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef dlgAddFavourite_H
|
||||
#define dlgAddFavourite_H
|
||||
|
||||
#include "dlg/dlgClasses.h"
|
||||
#include "utils/favourites.h"
|
||||
|
||||
// Class declarations
|
||||
class dlgAddFavourite : public pgDialog
|
||||
{
|
||||
public:
|
||||
dlgAddFavourite(wxWindow *parent, queryFavouriteFolder *favourites);
|
||||
~dlgAddFavourite();
|
||||
int AddFavourite(wxString newtext);
|
||||
|
||||
private:
|
||||
queryFavouriteFolder *favourites;
|
||||
void OnOK(wxCommandEvent &ev);
|
||||
void OnCancel(wxCommandEvent &ev);
|
||||
void OnChange(wxCommandEvent &ev);
|
||||
void OnTreeChange(wxTreeEvent &ev);
|
||||
void OnNewFolder(wxCommandEvent &ev);
|
||||
|
||||
bool anythingChanged;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif
|
||||
79
include/dlg/dlgAggregate.h
Normal file
79
include/dlg/dlgAggregate.h
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// dlgAggregate.h - Aggregate properties dialog
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __DLG_AGGREGATEPROP
|
||||
#define __DLG_AGGREGATEPROP
|
||||
|
||||
#include "dlg/dlgProperty.h"
|
||||
#include "ctl/ctlSeclabelPanel.h"
|
||||
|
||||
class pgSchema;
|
||||
class pgAggregate;
|
||||
|
||||
class dlgAggregate : public dlgTypeProperty
|
||||
{
|
||||
public:
|
||||
dlgAggregate(pgaFactory *factory, frmMain *frame, pgAggregate *agg, pgSchema *sch);
|
||||
int Go(bool modal);
|
||||
|
||||
void CheckChange();
|
||||
wxString GetSql();
|
||||
pgObject *CreateObject(pgCollection *collection);
|
||||
pgObject *GetObject();
|
||||
|
||||
protected:
|
||||
/*
|
||||
* Aggregate Privileges:
|
||||
* - Did not inherit dlgTypeProperty & dlgSecurityProperty as it will
|
||||
* lead to a lot of problem later
|
||||
**/
|
||||
|
||||
ctlSecurityPanel *securityPage;
|
||||
wxArrayString currentAcl;
|
||||
wxArrayString groups;
|
||||
bool securityChanged;
|
||||
|
||||
wxString GetGrant(const wxString &allPattern, const wxString &grantObject);
|
||||
|
||||
void OnAddPriv(wxCommandEvent &ev);
|
||||
void OnDelPriv(wxCommandEvent &ev);
|
||||
|
||||
private:
|
||||
pgSchema *schema;
|
||||
pgAggregate *aggregate;
|
||||
ctlSeclabelPanel *seclabelPage;
|
||||
|
||||
virtual wxString GetDisplayName()
|
||||
{
|
||||
return GetName() + wxT("(") + GetInputTypesList() + wxT(")");
|
||||
};
|
||||
|
||||
#ifdef __WXMAC__
|
||||
void OnChangeSize(wxSizeEvent &ev);
|
||||
#endif
|
||||
|
||||
void OnChange(wxCommandEvent &event);
|
||||
void OnChangeType(wxCommandEvent &ev);
|
||||
void OnChangeTypeBase(wxCommandEvent &ev);
|
||||
void OnChangeTypeState(wxCommandEvent &ev);
|
||||
|
||||
void OnAddInputType(wxCommandEvent &ev);
|
||||
void OnRemoveInputType(wxCommandEvent &ev);
|
||||
void OnSelectInputType(wxListEvent &ev);
|
||||
|
||||
long GetInputTypeOid(int param);
|
||||
wxString GetInputTypesList();
|
||||
wxString GetInputTypesOidList();
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif
|
||||
43
include/dlg/dlgCast.h
Normal file
43
include/dlg/dlgCast.h
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin III - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
// dlgCast.h - Cast property
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef __DLG_CASTPROP
|
||||
#define __DLG_CASTPROP
|
||||
|
||||
#include "dlg/dlgProperty.h"
|
||||
|
||||
class pgCast;
|
||||
|
||||
class dlgCast : public dlgTypeProperty
|
||||
{
|
||||
public:
|
||||
dlgCast(pgaFactory *factory, frmMain *frame, pgCast *ca);
|
||||
int Go(bool modal);
|
||||
|
||||
void CheckChange();
|
||||
wxString GetSql();
|
||||
pgObject *CreateObject(pgCollection *collection);
|
||||
pgObject *GetObject();
|
||||
|
||||
private:
|
||||
void OnChangeType(wxCommandEvent &ev);
|
||||
void OnChangeTypeSrc(wxCommandEvent &ev);
|
||||
void OnChangeTypeTrg(wxCommandEvent &ev);
|
||||
|
||||
pgCast *cast;
|
||||
wxArrayString functions;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue