SVN Commit by dpage: r4194 - in trunk/pgadmin3/xtra/pgagent: . include - Mailing list pgadmin-hackers

From svn@pgadmin.org
Subject SVN Commit by dpage: r4194 - in trunk/pgadmin3/xtra/pgagent: . include
Date
Msg-id 200505171547.j4HFlT2p012399@developer.pgadmin.org
Whole thread Raw
List pgadmin-hackers
Author: dpage
Date: 2005-05-17 16:47:29 +0100 (Tue, 17 May 2005)
New Revision: 4194

Modified:
   trunk/pgadmin3/xtra/pgagent/include/job.h
   trunk/pgadmin3/xtra/pgagent/job.cpp
   trunk/pgadmin3/xtra/pgagent/pgAgent.cpp
   trunk/pgadmin3/xtra/pgagent/pgagent.sql
Log:
Rename the log tables.

Modified: trunk/pgadmin3/xtra/pgagent/include/job.h
===================================================================
--- trunk/pgadmin3/xtra/pgagent/include/job.h    2005-05-17 15:27:06 UTC (rev 4193)
+++ trunk/pgadmin3/xtra/pgagent/include/job.h    2005-05-17 15:47:29 UTC (rev 4194)
@@ -24,7 +24,7 @@

 protected:
     DBconn *serviceConn;
-    string jobid, prtid;
+    string jobid, logid;
     string status;
 };


Modified: trunk/pgadmin3/xtra/pgagent/job.cpp
===================================================================
--- trunk/pgadmin3/xtra/pgagent/job.cpp    2005-05-17 15:27:06 UTC (rev 4193)
+++ trunk/pgadmin3/xtra/pgagent/job.cpp    2005-05-17 15:47:29 UTC (rev 4194)
@@ -26,14 +26,14 @@
     if (rc == 1)
     {
         DBresult *id=serviceConn->Execute(
-            "SELECT nextval('pgagent.pga_jobprotocol_jprid_seq') AS id");
+            "SELECT nextval('pgagent.pga_joblog_jlgid_seq') AS id");
         if (id)
         {
-            prtid=id->GetString("id");
+            logid=id->GetString("id");

             DBresult *res=serviceConn->Execute(
-                "INSERT INTO pgagent.pga_jobprotocol(jprid, jprjobid, jprstatus) "
-                "VALUES (" + prtid + ", " + jobid + ", 'r')");
+                "INSERT INTO pgagent.pga_joblog(jlgid, jlgjobid, jlgstatus) "
+                "VALUES (" + logid + ", " + jobid + ", 'r')");
             if (res)
             {
                 status="r";
@@ -50,9 +50,9 @@
     if (status != "")
     {
         serviceConn->ExecuteVoid(
-            "UPDATE pgagent.pga_jobprotocol "
-            "   SET jprstatus='" + status + "', jprduration=now() - jprstart "
-            " WHERE jprid=" + prtid + ";\n"
+            "UPDATE pgagent.pga_joblog "
+            "   SET jlgstatus='" + status + "', jlgduration=now() - jlgstart "
+            " WHERE jlgid=" + logid + ";\n"

             "UPDATE pgagent.pga_job "
             "   SET jobagentid=NULL, jobnextrun=NULL "
@@ -84,12 +84,12 @@
         string jpsid, jpecode;

         DBresult *id=serviceConn->Execute(
-            "SELECT nextval('pgagent.pga_jobprotocolstep_jpeid_seq') AS id");
+            "SELECT nextval('pgagent.pga_jobsteplog_jslid_seq') AS id");
         if (id)
         {
             jpsid=id->GetString("id");
             DBresult *res=serviceConn->Execute(
-                "INSERT INTO pgagent.pga_jobprotocolstep(jpeid, jpejprid, jpedbname, jpecode) "
+                "INSERT INTO pgagent.pga_jobsteplog(jslid, jsljlgid, jsldbname, jslcode) "
                 "SELECT " + jpsid + ", " + prtid + ", '" + steps->GetString("jstdbname") + "', jstcode "
                 "  FROM pgagent.pga_jobstep WHERE jstid=" + steps->GetString("jstid"));

@@ -143,10 +143,10 @@
             stepstatus = steps->GetString("jstonerror");

         rc=serviceConn->ExecuteVoid(
-            "UPDATE pgagent.pga_jobprotocolstep "
-            "   SET jpeduration = now() - jpestarted, "
-            "       jperesult = " + NumToStr(rc) + ", jpestatus = '" + stepstatus + "' "
-            " WHERE jpeid=" + jpsid);
+            "UPDATE pgagent.pga_jobsteplog "
+            "   SET jlgduration = now() - jlgstarted, "
+            "       jlgresult = " + NumToStr(rc) + ", jlgstatus = '" + stepstatus + "' "
+            " WHERE jlgid=" + jpsid);
         if (rc != 1 || stepstatus == "f")
         {
             status = 'f';

Modified: trunk/pgadmin3/xtra/pgagent/pgAgent.cpp
===================================================================
--- trunk/pgadmin3/xtra/pgagent/pgAgent.cpp    2005-05-17 15:27:06 UTC (rev 4193)
+++ trunk/pgadmin3/xtra/pgagent/pgAgent.cpp    2005-05-17 15:47:29 UTC (rev 4194)
@@ -49,11 +49,11 @@
         // There are orphaned agent entries
         // mark the jobs as aborted
         rc=serviceConn->ExecuteVoid(
-            "UPDATE pgagent.pga_jobprotocol SET jprstatus='d' "
+            "UPDATE pgagent.pga_joblog SET jlgstatus='d' "
             "  FROM pga_tmp_zombies Z "
             "  JOIN pgagent.pga_job J ON jobagentid=jagpid "
-            "  JOIN pgagent.pga_jobprotocol PR ON jprjobid=J.jobid "
-            " WHERE PR.jprstatus='r';\n"
+            "  JOIN pgagent.pga_joblog LG ON jlgjobid=J.jobid "
+            " WHERE PR.jlgstatus='r';\n"

             "UPDATE pgagent.pga_job SET jobagentid=NULL, jobnextrun=NULL "
             "  FROM pga_tmp_zombies Z "

Modified: trunk/pgadmin3/xtra/pgagent/pgagent.sql
===================================================================
--- trunk/pgadmin3/xtra/pgagent/pgagent.sql    2005-05-17 15:27:06 UTC (rev 4193)
+++ trunk/pgadmin3/xtra/pgagent/pgagent.sql    2005-05-17 15:47:29 UTC (rev 4194)
@@ -111,33 +111,33 @@



-CREATE TABLE pgagent.pga_jobprotocol (
-jprid                serial               NOT NULL PRIMARY KEY,
-jprjobid             int4                 NOT NULL REFERENCES pgagent.pga_job (jobid) ON DELETE CASCADE ON UPDATE
RESTRICT,
-jprstatus            char                 NOT NULL CHECK (jprstatus IN ('r', 's', 'f', 'i', 'd')) DEFAULT 'r', --
running,success, failed, internal failure, died 
-jprstart             timestamptz          NOT NULL DEFAULT current_timestamp,
-jprduration          interval             NULL
+CREATE TABLE pgagent.pga_joblog (
+jlgid                serial               NOT NULL PRIMARY KEY,
+jlgjobid             int4                 NOT NULL REFERENCES pgagent.pga_job (jobid) ON DELETE CASCADE ON UPDATE
RESTRICT,
+jlgstatus            char                 NOT NULL CHECK (jlgstatus IN ('r', 's', 'f', 'i', 'd')) DEFAULT 'r', --
running,success, failed, internal failure, died 
+jlgstart             timestamptz          NOT NULL DEFAULT current_timestamp,
+jlgduration          interval             NULL
 ) WITHOUT OIDS;
-CREATE INDEX pga_jobprotocol_jobid ON pgagent.pga_jobprotocol(jprjobid);
-COMMENT ON TABLE pgagent.pga_jobprotocol IS 'Protocol of a job that was run.';
-COMMENT ON COLUMN pgagent.pga_jobprotocol.jprstatus IS 'Status of job: r=running, s=successfully finished, f=failed';
+CREATE INDEX pga_joblog_jobid ON pgagent.pga_joblog(jlgjobid);
+COMMENT ON TABLE pgagent.pga_joblog IS 'Job run logs.';
+COMMENT ON COLUMN pgagent.pga_joblog.jlgstatus IS 'Status of job: r=running, s=successfully finished, f=failed';



-CREATE TABLE pgagent.pga_jobprotocolstep (
-jpeid                serial               NOT NULL PRIMARY KEY,
-jpejprid             int4                 NOT NULL REFERENCES pgagent.pga_jobprotocol (jprid) ON DELETE CASCADE ON
UPDATERESTRICT, 
-jpedbname            name                 NOT NULL,
-jpecode              text                 NOT NULL,
-jpestatus            char                 NOT NULL CHECK (jpestatus IN ('r', 's', 'i', 'f')) DEFAULT 'r', -- running,
success,ignored, failed 
-jperesult            int2                 NULL,
-jpestarted           timestamptz          NOT NULL DEFAULT current_timestamp,
-jpeduration          interval             NULL
+CREATE TABLE pgagent.pga_jobsteplog (
+jslid                serial               NOT NULL PRIMARY KEY,
+jsljlgid             int4                 NOT NULL REFERENCES pgagent.pga_joblog (jlgid) ON DELETE CASCADE ON UPDATE
RESTRICT,
+jsldbname            name                 NOT NULL,
+jslcode              text                 NOT NULL,
+jslstatus            char                 NOT NULL CHECK (jslstatus IN ('r', 's', 'i', 'f')) DEFAULT 'r', -- running,
success,ignored, failed 
+jslresult            int2                 NULL,
+jslstarted           timestamptz          NOT NULL DEFAULT current_timestamp,
+jslduration          interval             NULL
 ) WITHOUT OIDS;
-CREATE INDEX pga_jobprotocolstep_jprid ON pgagent.pga_jobprotocolstep(jpejprid);
-COMMENT ON TABLE pgagent.pga_jobprotocolstep IS 'Protocol of a single step in a job that was run.';
-COMMENT ON COLUMN pgagent.pga_jobprotocolstep.jpestatus IS 'Status of job step: r=running, s=successfully finished,
f=failedstopping job, i=ignored failure'; 
-COMMENT ON COLUMN pgagent.pga_jobprotocolstep.jperesult IS 'Return code of job step';
+CREATE INDEX pga_jobsteplog_jslid ON pgagent.pga_jobsteplog(jsljlgid);
+COMMENT ON TABLE pgagent.pga_jobsteplog IS 'Job step run logs.';
+COMMENT ON COLUMN pgagent.pga_jobsteplog.jslstatus IS 'Status of job step: r=running, s=successfully finished,
f=failedstopping job, i=ignored failure'; 
+COMMENT ON COLUMN pgagent.pga_jobsteplog.jslresult IS 'Return code of job step';





pgadmin-hackers by date:

Previous
From: svn@pgadmin.org
Date:
Subject: SVN Commit by dpage: r4193 - in trunk/pgadmin3/xtra/pgagent: . include
Next
From: svn@pgadmin.org
Date:
Subject: SVN Commit by dpage: r4195 - trunk/pgadmin3/xtra/pgagent