Log Message:
-----------
some cleanups

Modified Files:
--------------
    pgadmin3:
        CHANGELOG.txt (r1.99 -> r1.100)
        TODO.txt (r1.91 -> r1.92)
    pgadmin3/src/ui:
        ctlSQLBox.cpp (r1.22 -> r1.23)
        dlgEditGridOptions.cpp (r1.14 -> r1.15)
        frmMain.cpp (r1.86 -> r1.87)
        frmQuery.cpp (r1.67 -> r1.68)
    pgadmin3/src/include:
        frmMain.h (r1.40 -> r1.41)
        misc.h (r1.36 -> r1.37)
        pgServer.h (r1.28 -> r1.29)
        pgSet.h (r1.27 -> r1.28)
    pgadmin3/src/utils:
        misc.cpp (r1.47 -> r1.48)
    pgadmin3/src:
        pgAdmin3.dsp (r1.97 -> r1.98)
    pgadmin3/src/schema:
        pgObject.cpp (r1.61 -> r1.62)
        pgServer.cpp (r1.39 -> r1.40)
    pgadmin3/src/db:
        pgSet.cpp (r1.42 -> r1.43)

Index: TODO.txt
===================================================================
RCS file: /projects/pgadmin3/TODO.txt,v
retrieving revision 1.91
retrieving revision 1.92
diff -LTODO.txt -LTODO.txt -u -w -r1.91 -r1.92
--- TODO.txt
+++ TODO.txt
@@ -9,7 +9,6 @@
 
        <li>Enhancements
        <ul>
-               <li>warn when deleting superuser privilege
                <li>Display server log
                <li>Keyboard navigation (wx issue)
                <li>function property: show line number
Index: CHANGELOG.txt
===================================================================
RCS file: /projects/pgadmin3/CHANGELOG.txt,v
retrieving revision 1.99
retrieving revision 1.100
diff -LCHANGELOG.txt -LCHANGELOG.txt -u -w -r1.99 -r1.100
--- CHANGELOG.txt
+++ CHANGELOG.txt
@@ -16,6 +16,7 @@
 </ul>
 <br>
 <ul>
+    <li>2004-05-26 AP        warn when deleting superuser privilege
     <li>2004-05-10 DP        Generate function SQL correctly when the return type 
needs a schema specification
     <li>2004-05-04 DP        Prevent duplication of functional indexes
     <li>2004-03-30 AP   ***  no initial language selection (using system default)
Index: ctlSQLBox.cpp
===================================================================
RCS file: /projects/pgadmin3/src/ui/ctlSQLBox.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -Lsrc/ui/ctlSQLBox.cpp -Lsrc/ui/ctlSQLBox.cpp -u -w -r1.22 -r1.23
--- src/ui/ctlSQLBox.cpp
+++ src/ui/ctlSQLBox.cpp
@@ -346,6 +346,8 @@
     StyleSetFont(10, fntSQLBox);
     StyleSetFont(11, fntSQLBox);
     
+    SetMarginWidth(1, 0);
+    
 
     // Setup the different highlight colurs
     StyleSetForeground(0,  wxColour(0x80, 0x80, 0x80));
Index: dlgEditGridOptions.cpp
===================================================================
RCS file: /projects/pgadmin3/src/ui/dlgEditGridOptions.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -Lsrc/ui/dlgEditGridOptions.cpp -Lsrc/ui/dlgEditGridOptions.cpp -u -w -r1.14 
-r1.15
--- src/ui/dlgEditGridOptions.cpp
+++ src/ui/dlgEditGridOptions.cpp
@@ -268,10 +268,11 @@
 
 bool dlgEditGridOptions::Validate()
 {
-    StartMsg(_("Validating filter string"));
+    extern frmMain *winMain;
+    winMain->StartMsg(_("Validating filter string"));
     filter->MarkerDeleteAll(0);
     if (!filter->GetText().Trim().Length()) {
-        EndMsg();
+        winMain->EndMsg();
         return true;
     }
 
@@ -288,7 +289,7 @@
         res == PGRES_COMMAND_OK)
     {
         // No errors, all OK!
-        EndMsg();
+        winMain->EndMsg();
         return true;
     }
 
@@ -323,6 +324,6 @@
 
     // Cleanup
     PQclear(qryRes);
-    EndMsg();
+    winMain->EndMsg();
     return false;
 }
Index: frmQuery.cpp
===================================================================
RCS file: /projects/pgadmin3/src/ui/frmQuery.cpp,v
retrieving revision 1.67
retrieving revision 1.68
diff -Lsrc/ui/frmQuery.cpp -Lsrc/ui/frmQuery.cpp -u -w -r1.67 -r1.68
--- src/ui/frmQuery.cpp
+++ src/ui/frmQuery.cpp
@@ -201,6 +201,7 @@
     horizontal->SetMinimumPaneSize(50);
 
     sqlQuery = new ctlSQLBox(horizontal, CTL_SQLQUERY, wxDefaultPosition, 
wxDefaultSize, wxTE_MULTILINE | wxSIMPLE_BORDER | wxTE_RICH2);
+    sqlQuery->SetMarginWidth(1, 16);
 
     output = new wxNotebook(horizontal, -1, wxDefaultPosition, wxDefaultSize, 
wxNB_BOTTOM);
     sqlResult = new ctlSQLResult(output, conn, CTL_SQLRESULT, wxDefaultPosition, 
wxDefaultSize);
@@ -672,7 +673,8 @@
     }
 
     wxFileDialog dlg(this, _("Open query file"), lastDir, wxT(""), 
-        _("Query files (*.sql)|*.sql|UTF-8 query files (*.usql)|*.usql|All files 
(*.*)|*.*"), wxOPEN|wxHIDE_READONLY);
+        _("Query files (*.sql)|*.sql|UTF-8 query files (*.usql)|*.usql|All files 
(*.*)|*.*"), wxOPEN);
+//        _("Query files (*.sql)|*.sql|UTF-8 query files (*.usql)|*.usql|All files 
(*.*)|*.*"), wxOPEN|wxHIDE_READONLY);
     if (dlg.ShowModal() == wxID_OK)
     {
         lastFilename=dlg.GetFilename();
Index: frmMain.cpp
===================================================================
RCS file: /projects/pgadmin3/src/ui/frmMain.cpp,v
retrieving revision 1.86
retrieving revision 1.87
diff -Lsrc/ui/frmMain.cpp -Lsrc/ui/frmMain.cpp -u -w -r1.86 -r1.87
--- src/ui/frmMain.cpp
+++ src/ui/frmMain.cpp
@@ -105,6 +105,8 @@
 frmMain::frmMain(const wxString& title, const wxPoint& pos, const wxSize& size)
 : wxFrame((wxFrame *)NULL, -1, title, pos, size)
 {
+    msgLevel=0;
+
     wxWindowBase::SetFont(settings->GetSystemFont());
 
     {
@@ -799,3 +801,38 @@
     treeContextMenu->Enable(MNU_RELOAD, false);
 }
 
+
+
+
+void frmMain::StartMsg(const wxString& msg)
+{
+   if (msgLevel++)
+        return;
+
+    timermsg.Printf(wxT("%s..."), msg.c_str());
+    wxBeginBusyCursor();
+    stopwatch.Start(0);
+    wxLogStatus(timermsg);
+    statusBar->SetStatusText(timermsg, 1);
+    statusBar->SetStatusText(wxT(""), 2);
+}
+
+
+void frmMain::EndMsg()
+{
+    msgLevel--;
+
+    if (!msgLevel)
+    {
+        // Get the execution time & display it
+        float timeval = stopwatch.Time();
+        wxString time;
+        time.Printf(_("%.2f secs"), (timeval/1000));
+        statusBar->SetStatusText(time, 2);
+
+        // Display the 'Done' message
+        statusBar->SetStatusText(timermsg + _(" Done."), 1);
+        wxLogStatus(wxT("%s (%s)"), timermsg.c_str(), time.c_str());
+        wxEndBusyCursor();
+    }
+}
Index: misc.h
===================================================================
RCS file: /projects/pgadmin3/src/include/misc.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -Lsrc/include/misc.h -Lsrc/include/misc.h -u -w -r1.36 -r1.37
--- src/include/misc.h
+++ src/include/misc.h
@@ -40,10 +40,6 @@
 #define wxCookieType long
 #endif
 
-// Global Stuff
-void StartMsg(const wxString& msg);
-void EndMsg();
-
 class sysSettings;
 extern sysSettings *settings;
 
Index: frmMain.h
===================================================================
RCS file: /projects/pgadmin3/src/include/frmMain.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -Lsrc/include/frmMain.h -Lsrc/include/frmMain.h -u -w -r1.40 -r1.41
--- src/include/frmMain.h
+++ src/include/frmMain.h
@@ -40,7 +40,9 @@
     frmMain(const wxString& title, const wxPoint& pos, const wxSize& size);
     ~frmMain();
     void OnTipOfTheDay(wxCommandEvent& event);
-    wxStatusBar *statusBar;
+
+    void StartMsg(const wxString& msg);
+    void EndMsg();
 
     void SetButtons(bool refresh, bool create, bool drop, bool properties, bool sql, 
bool viewData, bool maintenance);
     void SetDatabase(pgDatabase *newDatabase) { m_database = newDatabase; }
@@ -72,6 +74,11 @@
        wxImageList *images;
     wxSplitterWindow *horizontal, *vertical;
 
+    wxStatusBar *statusBar;
+    wxStopWatch stopwatch;
+    wxString timermsg;
+    long msgLevel;
+
     void OnKeyDown(wxKeyEvent& event);
     void OnAbout(wxCommandEvent& event);
     void OnContents(wxCommandEvent& event);
Index: pgServer.h
===================================================================
RCS file: /projects/pgadmin3/src/include/pgServer.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -Lsrc/include/pgServer.h -Lsrc/include/pgServer.h -u -w -r1.28 -r1.29
--- src/include/pgServer.h
+++ src/include/pgServer.h
@@ -29,7 +29,7 @@
     ~pgServer();
     int GetType() const { return PG_SERVER; }
     wxString GetTypeName() const { return wxT("Server"); }
-    int Connect(wxFrame *form, bool lockFields = FALSE);
+    int Connect(frmMain *form, bool lockFields = FALSE);
     bool Disconnect();
 
     wxString GetIdentifier() const;
Index: pgSet.h
===================================================================
RCS file: /projects/pgadmin3/src/include/pgSet.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -Lsrc/include/pgSet.h -Lsrc/include/pgSet.h -u -w -r1.27 -r1.28
--- src/include/pgSet.h
+++ src/include/pgSet.h
@@ -39,7 +39,7 @@
 class pgSet
 {
 public:
-    pgSet(PGresult *newRes, PGconn *newConn, wxMBConv &cnv, bool needColQt);
+    pgSet(PGresult *newRes, pgConn *newConn, wxMBConv &cnv, bool needColQt);
     ~pgSet();
     long NumRows() const { return nRows; }
     long NumCols() const { return PQnfields(res); }
@@ -82,7 +82,7 @@
 
 
 private:
-    PGconn *conn;
+    pgConn *conn;
     PGresult *res;
     long pos, nRows;
     wxString ExecuteScalar(const wxString& sql) const;
Index: misc.cpp
===================================================================
RCS file: /projects/pgadmin3/src/utils/misc.cpp,v
retrieving revision 1.47
retrieving revision 1.48
diff -Lsrc/utils/misc.cpp -Lsrc/utils/misc.cpp -u -w -r1.47 -r1.48
--- src/utils/misc.cpp
+++ src/utils/misc.cpp
@@ -58,47 +58,6 @@
 
 
 
-// Global Vars - yuch!
-wxStopWatch stopwatch;
-wxString timermsg;
-long msgLevel=0;
-
-void StartMsg(const wxString& msg)
-{
-    extern frmMain *winMain;
-
-    if (msgLevel++)
-        return;
-
-    timermsg.Printf(wxT("%s..."), msg.c_str());
-    wxBeginBusyCursor();
-    stopwatch.Start(0);
-    wxLogStatus(timermsg);
-    winMain->statusBar->SetStatusText(timermsg, 1);
-    winMain->statusBar->SetStatusText(wxT(""), 2);
-}
-
-void EndMsg()
-{
-    extern frmMain *winMain;
-
-    msgLevel--;
-
-    if (!msgLevel)
-    {
-        // Get the execution time & display it
-        float timeval = stopwatch.Time();
-        wxString time;
-        time.Printf(_("%.2f secs"), (timeval/1000));
-        winMain->statusBar->SetStatusText(time, 2);
-
-        // Display the 'Done' message
-        winMain->statusBar->SetStatusText(timermsg + _(" Done."), 1);
-        wxLogStatus(wxT("%s (%s)"), timermsg.c_str(), time.c_str());
-        wxEndBusyCursor();
-    }
-}
-
 // Conversions
 
 
Index: pgAdmin3.dsp
===================================================================
RCS file: /projects/pgadmin3/src/pgAdmin3.dsp,v
retrieving revision 1.97
retrieving revision 1.98
diff -Lsrc/pgAdmin3.dsp -Lsrc/pgAdmin3.dsp -u -w -r1.97 -r1.98
--- src/pgAdmin3.dsp
+++ src/pgAdmin3.dsp
@@ -169,7 +169,7 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib 
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib 
comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxmswud.lib pngd.lib zlibd.lib jpegd.lib 
tiffd.lib stcd.lib libpq.lib wxxrcd.lib regexd.lib /nologo /subsystem:windows /map 
/debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" 
/nodefaultlib:"msvcrt.lib" /pdbtype:sept /libpath:"c:/wxWindows_2.5/lib" 
/libpath:"c:/wxWindows_2.5/contrib/lib" /libpath:"c:/postgresql/lib"
-# ADD LINK32 ssleay32.lib libeay32.lib wxmswud.lib regexud.lib pngd.lib zlibd.lib 
jpegd.lib tiffd.lib stcd.lib wxxrcd.lib kernel32.lib user32.lib gdi32.lib winspool.lib 
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib 
odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib libpq.lib expatd.lib 
/nologo /subsystem:windows /map /debug /machine:I386 /nodefaultlib:"libcd.lib" 
/nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrt.lib" /pdbtype:sept 
/libpath:"c:/wxWindows_2.5/lib" /libpath:"c:/wxWindows_2.5/contrib/lib" 
/libpath:"c:/postgresql/lib"
+# ADD LINK32 ssleay32.lib libeay32.lib wxmswud.lib regexud.lib pngd.lib zlibd.lib 
jpegd.lib tiffd.lib stcd.lib wxxrcd.lib kernel32.lib user32.lib gdi32.lib winspool.lib 
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib 
odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib libpqd.lib expatd.lib 
/nologo /subsystem:windows /map /debug /machine:I386 /nodefaultlib:"libcd.lib" 
/nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrt.lib" /pdbtype:sept 
/libpath:"c:/wxWindows_2.5/lib" /libpath:"c:/wxWindows_2.5/contrib/lib" 
/libpath:"c:/postgresql/lib"
 
 !ELSEIF  "$(CFG)" == "pgAdmin3 - Win32 Unicode SSL Release"
 
Index: pgObject.cpp
===================================================================
RCS file: /projects/pgadmin3/src/schema/pgObject.cpp,v
retrieving revision 1.61
retrieving revision 1.62
diff -Lsrc/schema/pgObject.cpp -Lsrc/schema/pgObject.cpp -u -w -r1.61 -r1.62
--- src/schema/pgObject.cpp
+++ src/schema/pgObject.cpp
@@ -377,9 +377,9 @@
     }
 
     wxLogInfo(wxT("Displaying properties for ") + GetTypeName() + wxT(" 
")+GetIdentifier());
-    StartMsg(wxString::Format(_("Retrieving %s details"), 
wxGetTranslation(GetTypeName())));
+    form->StartMsg(wxString::Format(_("Retrieving %s details"), 
wxGetTranslation(GetTypeName())));
     ShowTreeDetail(browser, form, properties, sqlPane);
-    EndMsg();
+    form->EndMsg();
 }
 
 
Index: pgServer.cpp
===================================================================
RCS file: /projects/pgadmin3/src/schema/pgServer.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -Lsrc/schema/pgServer.cpp -Lsrc/schema/pgServer.cpp -u -w -r1.39 -r1.40
--- src/schema/pgServer.cpp
+++ src/schema/pgServer.cpp
@@ -15,6 +15,7 @@
 // App headers
 #include "pgAdmin3.h"
 #include "misc.h"
+#include "frmMain.h"
 #include "frmConnect.h"
 #include "pgServer.h"
 #include "pgObject.h"
@@ -74,7 +75,7 @@
 }
 
 
-int pgServer::Connect(wxFrame *form, bool lockFields) 
+int pgServer::Connect(frmMain *form, bool lockFields) 
 {
     wxLogInfo(wxT("Attempting to create a connection object..."));
 
@@ -117,12 +118,12 @@
                 iSetPassword(winConnect.GetPassword());
         }
         if (password.IsNull())
-            StartMsg(_("Connecting to database without password"));
+            form->StartMsg(_("Connecting to database without password"));
         else
-            StartMsg(_("Connecting to database"));
+            form->StartMsg(_("Connecting to database"));
         if (conn) delete conn;
         conn = new pgConn(GetName(), database, username, password, port, ssl);   
-        EndMsg();
+        form->EndMsg();
         if (!conn)
         {
             wxLogError(__("Couldn't create a connection object!"));
Index: pgSet.cpp
===================================================================
RCS file: /projects/pgadmin3/src/db/pgSet.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -Lsrc/db/pgSet.cpp -Lsrc/db/pgSet.cpp -u -w -r1.42 -r1.43
--- src/db/pgSet.cpp
+++ src/db/pgSet.cpp
@@ -23,7 +23,7 @@
 #include "sysLogger.h"
 #include "pgDefs.h"
 
-pgSet::pgSet(PGresult *newRes, PGconn *newConn, wxMBConv &cnv, bool needColQt)
+pgSet::pgSet(PGresult *newRes, pgConn *newConn, wxMBConv &cnv, bool needColQt)
 : conv(cnv)
 {
     needColQuoting = needColQt;
@@ -254,24 +254,9 @@
 
 wxString pgSet::ExecuteScalar(const wxString& sql) const
 {
-    // Execute the query and get the status.
-    PGresult *qryRes;
-
-    wxLogSql(wxT("Set sub-query: %s"), sql.c_str());
-
-    qryRes = PQexec(conn, sql.mb_str(conv));
-    if (PQresultStatus(qryRes) != PGRES_TUPLES_OK) {
-        return wxEmptyString;
+    return conn->ExecuteScalar(sql);
     }
 
-    // Retrieve the query result and return it.
-    wxString result=wxString(PQgetvalue(qryRes, 0, 0), conv);
-    wxLogInfo(wxT("Query result: %s"), result.c_str());
-
-    // Cleanup & exit
-    PQclear(qryRes);
-    return result;
-}
 
 
 static void pgNoticeProcessor(void *arg, const char *message)
@@ -400,7 +385,7 @@
 
     if (rc == PGRES_TUPLES_OK)
     {
-        dataSet = new pgSet(result, conn->conn, *conn->conv, conn->needColQuoting);
+        dataSet = new pgSet(result, conn, *conn->conv, conn->needColQuoting);
         dataSet->MoveFirst();
         dataSet->GetVal(0);
     }
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Reply via email to