SVN Commit by andreas: r4455 - in trunk/pgadmin3/src: dlg frm include

From: svn(at)pgadmin(dot)org
To: pgadmin-hackers(at)postgresql(dot)org
Subject: SVN Commit by andreas: r4455 - in trunk/pgadmin3/src: dlg frm include
Date: 2005-09-18 21:23:34
Message-ID: 200509182123.j8ILNY0K000661@developer.pgadmin.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Author: andreas
Date: 2005-09-18 22:23:34 +0100 (Sun, 18 Sep 2005)
New Revision: 4455

Modified:
trunk/pgadmin3/src/dlg/dlgSelectConnection.cpp
trunk/pgadmin3/src/frm/frmQuery.cpp
trunk/pgadmin3/src/include/dlgSelectConnection.h
Log:
The very last fixes

Modified: trunk/pgadmin3/src/dlg/dlgSelectConnection.cpp
===================================================================
--- trunk/pgadmin3/src/dlg/dlgSelectConnection.cpp 2005-09-18 20:52:46 UTC (rev 4454)
+++ trunk/pgadmin3/src/dlg/dlgSelectConnection.cpp 2005-09-18 21:23:34 UTC (rev 4455)
@@ -78,21 +78,36 @@
}
if (remoteServer->GetConnected())
{
- pgSet *set=remoteServer->ExecuteSet(
+ pgSetIterator set(remoteServer->GetConnection(),
wxT("SELECT DISTINCT datname\n")
wxT(" FROM pg_database db\n")
wxT(" WHERE datallowconn ORDER BY datname"));
- if (set)
+
+ while(set.RowsLeft())
{
- while (!set->Eof())
+ wxString dbName=set.GetVal(wxT("datname"));
+
+ bool alreadyConnected=false;
+
+ if (cbConnection)
{
- cbDatabase->Append(set->GetVal(wxT("datname")));
- set->MoveNext();
+ int i;
+
+ for (i=0 ; i < cbConnection->GetCount()-1 ; i++)
+ {
+ pgConn *conn=(pgConn*)cbConnection->GetClientData(i);
+ if (conn->GetHost() == remoteServer->GetName() && conn->GetDbname() == dbName)
+ {
+ alreadyConnected=true;
+ break;
+ }
+ }
}
- delete set;
-
+ if (!alreadyConnected)
+ cbDatabase->Append(dbName);
+ }
+ if (cbDatabase->GetCount())
cbDatabase->SetSelection(0);
- }
}

}
@@ -124,8 +139,9 @@
}


-int dlgSelectConnection::Go(pgConn *conn)
+int dlgSelectConnection::Go(pgConn *conn, wxComboBox *cb)
{
+ cbConnection=cb;
treeObjectIterator servers(mainForm->GetBrowser(), mainForm->GetServerCollection());
pgServer *s;

Modified: trunk/pgadmin3/src/frm/frmQuery.cpp
===================================================================
--- trunk/pgadmin3/src/frm/frmQuery.cpp 2005-09-18 20:52:46 UTC (rev 4454)
+++ trunk/pgadmin3/src/frm/frmQuery.cpp 2005-09-18 21:23:34 UTC (rev 4455)
@@ -390,7 +390,7 @@
{
// new Connection
dlgSelectConnection dlg(this, mainForm);
- int rc=dlg.Go(conn);
+ int rc=dlg.Go(conn, cbConnection);
if (rc == wxID_OK)
{
conn = dlg.GetServer()->CreateConn(dlg.GetDatabase());

Modified: trunk/pgadmin3/src/include/dlgSelectConnection.h
===================================================================
--- trunk/pgadmin3/src/include/dlgSelectConnection.h 2005-09-18 20:52:46 UTC (rev 4454)
+++ trunk/pgadmin3/src/include/dlgSelectConnection.h 2005-09-18 21:23:34 UTC (rev 4455)
@@ -25,7 +25,7 @@
pgServer *GetServer() { return remoteServer; }
wxString GetDatabase();

- int Go(pgConn *conn);
+ int Go(pgConn *conn, wxComboBox *cb);

private:
void OnChangeServer(wxCommandEvent& ev);
@@ -34,6 +34,7 @@
void OnCancel(wxCommandEvent& ev);

pgServer *remoteServer;
+ wxComboBox *cbConnection;

DECLARE_EVENT_TABLE()
};

Browse pgadmin-hackers by date

  From Date Subject
Next Message Dave Page 2005-09-19 07:24:34 Re: Slony in pgAdmin
Previous Message Tomasz Rybak 2005-09-18 20:57:50 Slony in pgAdmin