Author: dpage
Date: 2005-05-23 21:09:30 +0100 (Mon, 23 May 2005)
New Revision: 4241

Modified:
   trunk/pgadmin3/src/agent/pgaJob.cpp
   trunk/pgadmin3/src/agent/pgaStep.cpp
Log:
Summary job status.

Modified: trunk/pgadmin3/src/agent/pgaJob.cpp
===================================================================
--- trunk/pgadmin3/src/agent/pgaJob.cpp 2005-05-23 19:57:51 UTC (rev 4240)
+++ trunk/pgadmin3/src/agent/pgaJob.cpp 2005-05-23 20:09:30 UTC (rev 4241)
@@ -121,7 +121,9 @@
     pgaJob *job=0;
 
     pgSet *jobs= collection->GetDatabase()->ExecuteSet(
-       wxT("SELECT *, ''::text AS joblastresult FROM pgagent.pga_job j\n")
+       wxT("SELECT *, ")
+          wxT("(SELECT jlgstatus FROM pgagent.pga_joblog jl WHERE jl.jlgjobid 
= j.jobid ORDER BY jlgid DESC LIMIT 1) AS joblastresult ")
+          wxT("FROM pgagent.pga_job j\n")
        wxT("  JOIN pgagent.pga_jobclass cl ON cl.jclid=jobjclid\n")
        wxT("  LEFT OUTER JOIN pgagent.pga_jobagent ag ON 
ag.jagpid=jobagentid\n")
        + restriction +
@@ -131,6 +133,19 @@
     {
         while (!jobs->Eof())
         {
+                       wxString status;
+                       if (jobs->GetVal(wxT("joblastresult")) == wxT("r"))
+                status = _("Running");
+                   else if (jobs->GetVal(wxT("joblastresult")) == wxT("s"))
+                status = _("Successful");
+                       else if (jobs->GetVal(wxT("joblastresult")) == wxT("f"))
+                status = _("Failed");
+                       else if (jobs->GetVal(wxT("joblastresult")) == wxT("d"))
+                status = _("Aborted");
+               else if (jobs->GetVal(wxT("joblastresult")) == wxT("i"))
+                status = _("No steps");
+                       else
+                status = _("Unknown");
 
             job = new pgaJob(jobs->GetVal(wxT("jobname")));
             job->iSetRecId(jobs->GetLong(wxT("jobid")));
@@ -144,7 +159,7 @@
             job->iSetChanged(jobs->GetDateTime(wxT("jobchanged")));
             job->iSetNextrun(jobs->GetDateTime(wxT("jobnextrun")));
             job->iSetLastrun(jobs->GetDateTime(wxT("joblastrun")));
-            job->iSetLastresult(jobs->GetVal(wxT("joblastresult")));
+            job->iSetLastresult(status);
                        job->iSetCurrentAgent(jobs->GetVal(wxT("jagstation")));
 
             if (browser)

Modified: trunk/pgadmin3/src/agent/pgaStep.cpp
===================================================================
--- trunk/pgadmin3/src/agent/pgaStep.cpp        2005-05-23 19:57:51 UTC (rev 
4240)
+++ trunk/pgadmin3/src/agent/pgaStep.cpp        2005-05-23 20:09:30 UTC (rev 
4241)
@@ -191,6 +191,8 @@
                     status = _("Failed");
                                else if (stats->GetVal(1) == wxT("i"))
                     status = _("Ignored");
+                               else if (stats->GetVal(1) == wxT("i"))
+                    status = _("Aborted");
                                else
                     status = _("Unknown");
 


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to