SVN Commit by dpage: r4236 - in trunk/pgadmin3/xtra/pgagent: . include - Mailing list pgadmin-hackers
From | svn@pgadmin.org |
---|---|
Subject | SVN Commit by dpage: r4236 - in trunk/pgadmin3/xtra/pgagent: . include |
Date | |
Msg-id | 200505231540.j4NFee7Y027244@developer.pgadmin.org Whole thread Raw |
List | pgadmin-hackers |
Author: dpage Date: 2005-05-23 16:40:39 +0100 (Mon, 23 May 2005) New Revision: 4236 Modified: trunk/pgadmin3/xtra/pgagent/connection.cpp trunk/pgadmin3/xtra/pgagent/include/misc.h trunk/pgadmin3/xtra/pgagent/job.cpp trunk/pgadmin3/xtra/pgagent/misc.cpp trunk/pgadmin3/xtra/pgagent/pgagent.sql Log: Store connections last error message with the job step log. Modified: trunk/pgadmin3/xtra/pgagent/connection.cpp =================================================================== --- trunk/pgadmin3/xtra/pgagent/connection.cpp 2005-05-23 15:15:04 UTC (rev 4235) +++ trunk/pgadmin3/xtra/pgagent/connection.cpp 2005-05-23 15:40:39 UTC (rev 4236) @@ -139,6 +139,8 @@ { wxMutexLocker lock(s_PoolLock); + this->lastError.Empty(); + LogMessage(_("Returning connection to database ") + this->dbname, LOG_DEBUG); inUse = false; } Modified: trunk/pgadmin3/xtra/pgagent/include/misc.h =================================================================== --- trunk/pgadmin3/xtra/pgagent/include/misc.h 2005-05-23 15:15:04 UTC (rev 4235) +++ trunk/pgadmin3/xtra/pgagent/include/misc.h 2005-05-23 15:40:39 UTC (rev 4236) @@ -18,6 +18,7 @@ void setOptions(int argc, char **argv); wxString getArg(int &argc, char** &argv); wxString NumToStr(const long l); +wxString qtString(const wxString& value); #endif // MISC_H Modified: trunk/pgadmin3/xtra/pgagent/job.cpp =================================================================== --- trunk/pgadmin3/xtra/pgagent/job.cpp 2005-05-23 15:15:04 UTC (rev 4235) +++ trunk/pgadmin3/xtra/pgagent/job.cpp 2005-05-23 15:40:39 UTC (rev 4236) @@ -86,7 +86,7 @@ while (steps->HasData()) { DBconn *stepConn; - wxString jslid, stepid, jpecode; + wxString jslid, stepid, jpecode, output; stepid = steps->GetString(wxT("jstid")); @@ -125,6 +125,7 @@ { LogMessage(_("Executing step ") + stepid + _(" (part of job ") + jobid + wxT(")"), LOG_DEBUG); rc=stepConn->ExecuteVoid(steps->GetString(wxT("jstcode"))); + output = stepConn->GetLastError(); stepConn->Return(); } else @@ -153,7 +154,8 @@ rc=threadConn->ExecuteVoid( wxT("UPDATE pgagent.pga_jobsteplog ") wxT(" SET jslduration = now() - jslstart, ") - wxT(" jslresult = ") + NumToStr(rc) + wxT(", jslstatus = '") + stepstatus + wxT("' ") + wxT(" jslresult = ") + NumToStr(rc) + wxT(", jslstatus = '") + stepstatus + wxT("', ") + wxT(" jsloutput = ") + qtString(output) + wxT(" ") wxT(" WHERE jslid=") + jslid); if (rc != 1 || stepstatus == wxT("f")) { Modified: trunk/pgadmin3/xtra/pgagent/misc.cpp =================================================================== --- trunk/pgadmin3/xtra/pgagent/misc.cpp 2005-05-23 15:15:04 UTC (rev 4235) +++ trunk/pgadmin3/xtra/pgagent/misc.cpp 2005-05-23 15:40:39 UTC (rev 4236) @@ -118,3 +118,16 @@ buf.Printf(wxT("%ld"), l); return buf; } + + +wxString qtString(const wxString& value) +{ + wxString result = value; + + result.Replace(wxT("\\"), wxT("\\\\")); + result.Replace(wxT("'"), wxT("\\'")); + result.Append(wxT("'")); + result.Prepend(wxT("'")); + + return result; +} \ No newline at end of file Modified: trunk/pgadmin3/xtra/pgagent/pgagent.sql =================================================================== --- trunk/pgadmin3/xtra/pgagent/pgagent.sql 2005-05-23 15:15:04 UTC (rev 4235) +++ trunk/pgadmin3/xtra/pgagent/pgagent.sql 2005-05-23 15:40:39 UTC (rev 4236) @@ -131,7 +131,8 @@ jslstatus char NOT NULL CHECK (jslstatus IN ('r', 's', 'i', 'f')) DEFAULT 'r', -- running, success,ignored, failed jslresult int2 NULL, jslstart timestamptz NOT NULL DEFAULT current_timestamp, -jslduration interval NULL +jslduration interval NULL, +jsloutput text ) WITHOUT OIDS; CREATE INDEX pga_jobsteplog_jslid ON pgagent.pga_jobsteplog(jsljlgid); COMMENT ON TABLE pgagent.pga_jobsteplog IS 'Job step run logs.';
pgadmin-hackers by date: