diff -Nru pgadmin3/src/dlg/dlgDatabase.cpp pgadmin3_1.4.svn20060522/src/dlg/dlgDatabase.cpp
--- pgadmin3/src/dlg/dlgDatabase.cpp 2006-01-06 17:33:27.000000000 +0000
+++ pgadmin3_1.4.svn20060522/src/dlg/dlgDatabase.cpp 2006-05-30 10:49:51.000000000 +0000
@@ -85,12 +85,18 @@
int dlgDatabase::Go(bool modal)
{
- if (!database)
- cbOwner->Append(wxT(""));
-
- AddGroups();
- AddUsers(cbOwner);
+ if (connection->BackendMinimumVersion(8, 1))
+ {
+ AddRoles(cbOwner);
+ }
+ else
+ {
+ if (!database)
+ cbOwner->Append(wxT(""));
+ AddGroups();
+ AddUsers(cbOwner);
+ }
if (connection->BackendMinimumVersion(7, 5))
{
diff -Nru pgadmin3/src/dlg/dlgFunction.cpp pgadmin3_1.4.svn20060522/src/dlg/dlgFunction.cpp
--- pgadmin3/src/dlg/dlgFunction.cpp 2006-01-06 17:33:27.000000000 +0000
+++ pgadmin3_1.4.svn20060522/src/dlg/dlgFunction.cpp 2006-05-24 14:52:21.000000000 +0000
@@ -130,11 +130,18 @@
rdbDirection->Disable();
isProcedure = function->GetIsProcedure();
}
+
+ if (connection->BackendMinimumVersion(8, 1))
+ {
+ AddRoles(cbOwner);
+ }
else
- cbOwner->Append(wxEmptyString);
-
- AddGroups();
- AddUsers(cbOwner);
+ {
+ if (!function)
+ cbOwner->Append(wxT(""));
+ AddGroups();
+ AddUsers(cbOwner);
+ }
if (!connection->BackendMinimumVersion(8, 0))
cbOwner->Disable();
diff -Nru pgadmin3/src/dlg/dlgLanguage.cpp pgadmin3_1.4.svn20060522/src/dlg/dlgLanguage.cpp
--- pgadmin3/src/dlg/dlgLanguage.cpp 2006-01-06 17:33:27.000000000 +0000
+++ pgadmin3_1.4.svn20060522/src/dlg/dlgLanguage.cpp 2006-05-30 11:42:12.000000000 +0000
@@ -56,9 +56,17 @@
{
if (!connection->BackendMinimumVersion(7, 5))
txtComment->Disable();
+
+ if (connection->BackendMinimumVersion(8, 1))
+ {
+ AddRoles();
+ }
+ else
+ {
+ AddGroups();
+ AddUsers();
+ }
- AddGroups();
- AddUsers();
if (language)
{
// edit mode
diff -Nru pgadmin3/src/dlg/dlgProperty.cpp pgadmin3_1.4.svn20060522/src/dlg/dlgProperty.cpp
--- pgadmin3/src/dlg/dlgProperty.cpp 2006-01-06 17:33:27.000000000 +0000
+++ pgadmin3_1.4.svn20060522/src/dlg/dlgProperty.cpp 2006-05-30 11:45:30.000000000 +0000
@@ -237,9 +237,17 @@
if (cbowner && !cbowner->GetCount())
{
- if (!GetObject())
- cbOwner->Append(wxEmptyString);
- AddUsers(cbowner);
+ if (connection && connection->BackendMinimumVersion(8, 1))
+ {
+ AddRoles(cbOwner);
+ }
+ else
+ {
+ if (!GetObject())
+ cbOwner->Append(wxEmptyString);
+ AddUsers(cbowner);
+ }
+
}
if (txtOid)
txtOid->Disable();
@@ -406,6 +414,32 @@
FillCombobox(wxT("SELECT usename FROM pg_user ORDER BY usename"), cb1, cb2);
}
+void dlgProperty::AddRoles(ctlComboBoxFix *cb1, ctlComboBoxFix *cb2)
+{
+
+ if (connection && settings)
+ {
+ pgSet *set=connection->ExecuteSet(wxT("SELECT rolname, rolcanlogin from pg_roles ORDER BY rolname"));
+
+ if (set)
+ {
+ while (!set->Eof())
+ {
+ if (cb1 && (set->GetBool(1) || settings->GetShowGroupsForOwnings()))
+ cb1->Append(set->GetVal(0));
+ set->MoveNext();
+ }
+ delete set;
+ if (database && cb1) {
+ cb1->SetValue(database->GetServer()->GetUsername());
+ } else if (cb1) {
+ cb1->SetValue(connection->GetUser());
+ }
+ }
+ }
+
+
+}
void dlgProperty::PrepareTablespace(ctlComboBoxFix *cb, const wxChar *current)
{
@@ -421,9 +455,9 @@
}
else
{
- cb->Append(wxEmptyString);
- FillCombobox(wxT("SELECT spcname FROM pg_tablespace WHERE spcname <> 'global' ORDER BY spcname"), cb);
- cb->SetSelection(0);
+ FillCombobox(wxT("SELECT spcname FROM pg_tablespace WHERE spcname NOT IN ('global', 'pg_global') ORDER BY spcname"), cb);
+ if(database)
+ cb->SetValue(database->GetServer()->GetDefaultTablespace());
}
}
else
@@ -1133,6 +1167,33 @@
}
+void dlgSecurityProperty::AddRoles(ctlComboBox *comboBox)
+{
+ if (connection)
+ {
+ pgSet *set=connection->ExecuteSet(wxT("SELECT rolname, rolcanlogin from pg_roles ORDER BY rolname"));
+
+ if (set)
+ {
+ while (!set->Eof())
+ {
+ if (securityPage && securityPage->cbGroups && (!set->GetBool(1) || settings->GetShowUsersForPrivileges()))
+ securityPage->cbGroups->Append(set->GetVal(0));
+ if (comboBox && (set->GetBool(1) || settings->GetShowGroupsForOwnings()))
+ comboBox->Append(set->GetVal(0));
+ set->MoveNext();
+ }
+ delete set;
+ if (database && comboBox) {
+ comboBox->SetValue(database->GetServer()->GetUsername());
+ } else if (comboBox) {
+ comboBox->SetValue(connection->GetUser());
+ }
+ }
+ }
+
+}
+
void dlgSecurityProperty::OnAddPriv(wxCommandEvent &ev)
{
securityChanged=true;
diff -Nru pgadmin3/src/dlg/dlgSchema.cpp pgadmin3_1.4.svn20060522/src/dlg/dlgSchema.cpp
--- pgadmin3/src/dlg/dlgSchema.cpp 2006-01-06 17:33:27.000000000 +0000
+++ pgadmin3_1.4.svn20060522/src/dlg/dlgSchema.cpp 2006-05-24 14:52:34.000000000 +0000
@@ -44,11 +44,19 @@
int dlgSchema::Go(bool modal)
{
- if (!schema)
- cbOwner->Append(wxT(""));
+ if (connection->BackendMinimumVersion(8, 1))
+ {
+ AddRoles(cbOwner);
+ }
+ else
+ {
+ if (!schema)
+ cbOwner->Append(wxT(""));
+
+ AddGroups();
+ AddUsers(cbOwner);
+ }
- AddGroups();
- AddUsers(cbOwner);
if (schema)
{
// edit mode
diff -Nru pgadmin3/src/dlg/dlgSequence.cpp pgadmin3_1.4.svn20060522/src/dlg/dlgSequence.cpp
--- pgadmin3/src/dlg/dlgSequence.cpp 2006-01-06 17:33:27.000000000 +0000
+++ pgadmin3_1.4.svn20060522/src/dlg/dlgSequence.cpp 2006-05-24 14:52:37.000000000 +0000
@@ -64,10 +64,19 @@
int dlgSequence::Go(bool modal)
{
- if (!sequence)
- cbOwner->Append(wxEmptyString);
- AddGroups();
- AddUsers(cbOwner);
+
+ if (connection->BackendMinimumVersion(8, 1))
+ {
+ AddRoles(cbOwner);
+ }
+ else
+ {
+ if (!sequence)
+ cbOwner->Append(wxT(""));
+ AddGroups();
+ AddUsers(cbOwner);
+ }
+
if (sequence)
{
diff -Nru pgadmin3/src/dlg/dlgTable.cpp pgadmin3_1.4.svn20060522/src/dlg/dlgTable.cpp
--- pgadmin3/src/dlg/dlgTable.cpp 2006-01-31 12:28:45.000000000 +0000
+++ pgadmin3_1.4.svn20060522/src/dlg/dlgTable.cpp 2006-05-24 14:52:40.000000000 +0000
@@ -130,10 +130,18 @@
int dlgTable::Go(bool modal)
{
- if (!table)
- cbOwner->Append(wxT(""));
- AddGroups();
- AddUsers(cbOwner);
+ if (connection->BackendMinimumVersion(8, 1))
+ {
+ AddRoles(cbOwner);
+ }
+ else
+ {
+ if (!table)
+ cbOwner->Append(wxT(""));
+ AddGroups();
+ AddUsers(cbOwner);
+ }
+
PrepareTablespace(cbTablespace);
hasPK=false;
diff -Nru pgadmin3/src/dlg/dlgTablespace.cpp pgadmin3_1.4.svn20060522/src/dlg/dlgTablespace.cpp
--- pgadmin3/src/dlg/dlgTablespace.cpp 2006-01-06 17:33:27.000000000 +0000
+++ pgadmin3_1.4.svn20060522/src/dlg/dlgTablespace.cpp 2006-05-24 14:52:43.000000000 +0000
@@ -54,10 +54,18 @@
int dlgTablespace::Go(bool modal)
{
- if (!tablespace)
- cbOwner->Append(wxEmptyString);
- AddGroups();
- AddUsers(cbOwner);
+ if (connection->BackendMinimumVersion(8, 1))
+ {
+ AddRoles(cbOwner);
+ }
+ else
+ {
+ if (!tablespace)
+ cbOwner->Append(wxT(""));
+ AddGroups();
+ AddUsers(cbOwner);
+ }
+
txtComment->Disable();
if (tablespace)
diff -Nru pgadmin3/src/dlg/dlgView.cpp pgadmin3_1.4.svn20060522/src/dlg/dlgView.cpp
--- pgadmin3/src/dlg/dlgView.cpp 2006-01-06 17:33:27.000000000 +0000
+++ pgadmin3_1.4.svn20060522/src/dlg/dlgView.cpp 2006-05-24 14:31:44.000000000 +0000
@@ -56,9 +56,16 @@
int dlgView::Go(bool modal)
{
- AddGroups();
- AddUsers();
+ if (connection->BackendMinimumVersion(8, 1))
+ {
+ AddRoles();
+ }
+ else
+ {
+ AddGroups();
+ AddUsers();
+ }
if (view)
{
// edit mode
diff -Nru pgadmin3/src/frm/frmOptions.cpp pgadmin3_1.4.svn20060522/src/frm/frmOptions.cpp
--- pgadmin3/src/frm/frmOptions.cpp 2006-01-06 17:33:27.000000000 +0000
+++ pgadmin3_1.4.svn20060522/src/frm/frmOptions.cpp 2006-05-29 09:46:26.000000000 +0000
@@ -46,6 +46,7 @@
#define chkAskSaveConfirm CTRL_CHECKBOX("chkAskSaveConfirm")
#define chkAskDelete CTRL_CHECKBOX("chkAskDelete")
#define chkShowUsersForPrivileges CTRL_CHECKBOX("chkShowUsersForPrivileges")
+#define chkShowGroupsForOwnings CTRL_CHECKBOX("chkShowGroupsForOwnings")
#define txtAutoRowCount CTRL_TEXT("txtAutoRowCount")
#define chkStickySql CTRL_CHECKBOX("chkStickySql")
#define chkDoubleClickProperties CTRL_CHECKBOX("chkDoubleClickProperties")
@@ -99,6 +100,7 @@
chkAskSaveConfirm->SetValue(!settings->GetAskSaveConfirmation());
chkAskDelete->SetValue(settings->GetConfirmDelete());
chkShowUsersForPrivileges->SetValue(settings->GetShowUsersForPrivileges());
+ chkShowGroupsForOwnings->SetValue(settings->GetShowGroupsForOwnings());
txtAutoRowCount->SetValue(NumToStr(settings->GetAutoRowCountThreshold()));
chkStickySql->SetValue(settings->GetStickySql());
chkDoubleClickProperties->SetValue(settings->GetDoubleClickProperties());
@@ -213,6 +215,7 @@
settings->SetAskSaveConfirmation(!chkAskSaveConfirm->GetValue());
settings->SetConfirmDelete(chkAskDelete->GetValue());
settings->SetShowUsersForPrivileges(chkShowUsersForPrivileges->GetValue());
+ settings->SetShowGroupsForOwnings(chkShowGroupsForOwnings->GetValue());
settings->SetAutoRowCountThreshold(StrToLong(txtAutoRowCount->GetValue()));
settings->SetStickySql(chkStickySql->GetValue());
settings->SetDoubleClickProperties(chkDoubleClickProperties->GetValue());
diff -Nru pgadmin3/src/include/dlgProperty.h pgadmin3_1.4.svn20060522/src/include/dlgProperty.h
--- pgadmin3/src/include/dlgProperty.h 2006-01-06 17:33:27.000000000 +0000
+++ pgadmin3_1.4.svn20060522/src/include/dlgProperty.h 2006-05-24 15:11:48.000000000 +0000
@@ -83,6 +83,7 @@
protected:
void AddUsers(ctlComboBoxFix *cb1, ctlComboBoxFix *cb2=0);
+ void AddRoles(ctlComboBoxFix *cb1, ctlComboBoxFix *cb2=0);
void FillCombobox(const wxString &query, ctlComboBoxFix *cb1, ctlComboBoxFix *cb2=0);
void PrepareTablespace(ctlComboBoxFix *cb, const wxChar *current=0);
@@ -163,6 +164,7 @@
~dlgSecurityProperty();
void AddGroups(ctlComboBox *comboBox=0);
void AddUsers(ctlComboBox *comboBox=0);
+ void AddRoles(ctlComboBox *comboBox=0);
wxString GetGrant(const wxString &allPattern, const wxString &grantObject);
void EnableOK(bool enable);
diff -Nru pgadmin3/src/include/pgServer.h pgadmin3_1.4.svn20060522/src/include/pgServer.h
--- pgadmin3/src/include/pgServer.h 2006-05-17 15:35:59.000000000 +0000
+++ pgadmin3_1.4.svn20060522/src/include/pgServer.h 2006-05-23 13:24:25.000000000 +0000
@@ -76,6 +76,8 @@
void iSetSuperUser(const bool b) { superUser=b; }
bool GetCreateRole() const { return createRole; }
void iSetCreateRole(const bool b) { createRole=b; }
+ wxString GetDefaultTablespace() const { return defaultTablespace; }
+ void iSetdefaultTablespace(const wxString& newVal) { defaultTablespace = newVal; }
pgConn *CreateConn(wxString dbName=wxEmptyString, OID oid=0);
@@ -122,7 +124,7 @@
pgConn *conn;
bool connected, passwordValid, autovacuumRunning;
- wxString database, username, password, ver, error;
+ wxString database, username, password, ver, error, defaultTablespace;
wxString lastDatabase, lastSchema, description, serviceId;
wxDateTime upSince;
int port, ssl;
diff -Nru pgadmin3/src/include/sysSettings.h pgadmin3_1.4.svn20060522/src/include/sysSettings.h
--- pgadmin3/src/include/sysSettings.h 2006-01-06 17:33:27.000000000 +0000
+++ pgadmin3_1.4.svn20060522/src/include/sysSettings.h 2006-05-29 09:46:23.000000000 +0000
@@ -75,6 +75,9 @@
bool GetShowUsersForPrivileges() const { return showUsersForPrivileges; }
void SetShowUsersForPrivileges(const bool b) { showUsersForPrivileges=b; }
+ bool GetShowGroupsForOwnings() const { return showGroupsForOwnings; }
+ void SetShowGroupsForOwnings(const bool b) { showGroupsForOwnings=b; }
+
// Show System Objects
bool GetShowSystemObjects() const { return showSystemObjects; }
void SetShowSystemObjects(const bool newval);
@@ -174,6 +177,7 @@
wxString sqlHelpSite, proxy;
wxString canonicalLanguage;
bool showUsersForPrivileges;
+ bool showGroupsForOwnings;
bool askSaveConfirmation;
bool confirmDelete, suppressGuruHints;
long maxRows, maxColSize, autoRowCountThreshold;
diff -Nru pgadmin3/src/schema/pgServer.cpp pgadmin3_1.4.svn20060522/src/schema/pgServer.cpp
--- pgadmin3/src/schema/pgServer.cpp 2006-05-17 15:35:59.000000000 +0000
+++ pgadmin3_1.4.svn20060522/src/schema/pgServer.cpp 2006-05-23 13:52:30.000000000 +0000
@@ -651,6 +651,17 @@
delete set;
}
}
+ if (conn->BackendMinimumVersion(7, 5)) {
+ set=ExecuteSet(wxT("SHOW default_tablespace;"));
+ if (set && set->GetVal(wxT("default_tablespace")) != wxT("unset"))
+ {
+ iSetdefaultTablespace(set->GetVal(wxT("default_tablespace")));
+ delete set;
+ } else {
+ iSetdefaultTablespace(wxT("pg_default"));
+ }
+ }
+
else
iSetCreateRole(false);
diff -Nru pgadmin3/src/ui/frmOptions.xrc pgadmin3_1.4.svn20060522/src/ui/frmOptions.xrc
--- pgadmin3/src/ui/frmOptions.xrc 2005-11-05 21:35:18.000000000 +0000
+++ pgadmin3_1.4.svn20060522/src/ui/frmOptions.xrc 2006-05-29 12:06:16.000000000 +0000
@@ -146,13 +146,23 @@
226,12d
+
@@ -160,7 +170,7 @@
- 5,85d
+ 5,97d
226,12d
@@ -168,7 +178,7 @@
- 5,97d
+ 5,119d
226,12d
diff -Nru pgadmin3/src/utils/sysSettings.cpp pgadmin3_1.4.svn20060522/src/utils/sysSettings.cpp
--- pgadmin3/src/utils/sysSettings.cpp 2006-01-06 17:33:27.000000000 +0000
+++ pgadmin3_1.4.svn20060522/src/utils/sysSettings.cpp 2006-05-29 15:37:04.000000000 +0000
@@ -117,6 +117,7 @@
askSaveConfirmation=StrToBool(Read(wxT("AskSaveConfirmation"), wxT("Yes")));
confirmDelete=StrToBool(Read(wxT("ConfirmDelete"), wxT("Yes")));
showUsersForPrivileges=StrToBool(Read(wxT("ShowUsersForPrivileges"), wxT("No")));
+ showGroupsForOwnings=StrToBool(Read(wxT("ShowGroupsForOwnings"), wxT("No")));
autoRowCountThreshold=Read(wxT("AutoRowCount"), 2000);
Read(wxT("StickySql"), &stickySql, false);
Read(wxT("DoubleClickProperties"), &doubleClickProperties, true);
@@ -197,6 +198,7 @@
Write(wxT("AskSaveConfirmation"), BoolToStr(askSaveConfirmation));
Write(wxT("ConfirmDelete"), BoolToStr(confirmDelete));
Write(wxT("ShowUsersForPrivileges"), BoolToStr(showUsersForPrivileges));
+ Write(wxT("ShowGroupsForOwnings"), BoolToStr(showGroupsForOwnings));
Write(wxT("SqlHelpSite"), sqlHelpSite);
Write(wxT("Proxy"), proxy);
Write(wxT("AutoRowCount"), autoRowCountThreshold);