Обсуждение: Propsed pgagent patch: pgAgent reports failure upon success - For Review

Поиск
Список
Период
Сортировка

Propsed pgagent patch: pgAgent reports failure upon success - For Review

От
"Martin French"
Дата:
<p><tt><font size="2">Hi, </font></tt><br /><br /><tt><font size="2">I have attempted a patch for an issue where
pgAgentincorrectly reports failure on a plain SQL job. Please see below.</font></tt><br /><br /><tt><font
size="2">Feedback/commentswelcome.</font></tt><br /><br /><tt><font size="2">Thanks</font></tt><br /><br /><tt><font
size="2">MartinFrench.</font></tt><br /><br /><br /><tt><font size="2">diff --git a/connection.cpp b/connection.cpp<br
/>index5e10078..6103c00 100644<br />--- a/connection.cpp<br />+++ b/connection.cpp<br />@@ -336,6 +336,7 @@
DBresult::DBresult(DBconn*conn, const wxString &query)<br /> if (result)<br /> {<br /> int rc =
PQresultStatus(result);<br/>+ conn->SetLastResult(rc);<br /> if (rc == PGRES_TUPLES_OK)<br /> maxRows =
PQntuples(result);<br/> else if (rc != PGRES_COMMAND_OK)<br />diff --git a/include/connection.h
b/include/connection.h<br/>index 04087db..3cd1c0d 100644<br />--- a/include/connection.h<br />+++
b/include/connection.h<br/>@@ -51,7 +51,33 @@ public:<br /> {<br /> return conn != 0;<br /> }<br />-<br />+        bool
LastCommandOk()<br/>+        {<br />+                return IsCommandOk((ExecStatusType)lastResult);<br />+        }<br
/>+       bool IsCommandOk(ExecStatusType ret)<br />+        {<br />+                switch (ret)<br />+              
 {<br/>+                        case PGRES_COMMAND_OK:<br />+                        case PGRES_TUPLES_OK:<br />+      
                case PGRES_COPY_OUT:<br />+                        case PGRES_COPY_IN:<br />+                      
 casePGRES_COPY_BOTH:<br />+                                return true;<br />+                        default:<br />+
                              return false;<br />+                };<br />+        }<br />+        void
SetLastResult(intres)<br />+        {<br />+                lastResult = res;<br />+        }<br />+        int
GetLastResult()<br/>+        {<br />+                return lastResult;<br />+        }<br />+ <br /> DBresult
*Execute(constwxString &query);<br /> wxString ExecuteScalar(const wxString &query);<br /> int
ExecuteVoid(constwxString &query);<br />@@ -70,7 +96,7 @@ protected:<br /> PGconn *conn;<br /> DBconn *next,
*prev;<br/> bool inUse;<br />-<br />+ int lastResult;<br /> friend class DBresult;<br /><br /> };<br />diff --git
a/job.cppb/job.cpp<br />index 9a5bb08..ba270be 100644<br />--- a/job.cpp<br />+++ b/job.cpp<br />@@ -80,6 +80,7 @@
Job::~Job()<br/> int Job::Execute()<br /> {<br /> int rc = 0;<br />+ bool succeeded = false;<br /> DBresult *steps =
threadConn->Execute(<br/>                       wxT("SELECT * ")<br />                       wxT("  FROM
pgagent.pga_jobstep")<br />@@ -138,13 +139,14 @@ int Job::Execute()<br /> {<br />
LogMessage(wxString::Format(_("ExecutingSQL step %s (part of job %s)"), stepid.c_str(), jobid.c_str()), LOG_DEBUG);<br
/>rc = stepConn->ExecuteVoid(steps->GetString(wxT("jstcode")));<br />+ succeeded =
stepConn->LastCommandOk();<br/> output = stepConn->GetLastError();<br /> stepConn->Return();<br /> }<br />
else<br/> {<br /> output = _("Couldn't get a connection to the database!");<br />- rc = -1;<br />+ succeeded =
false;<br/> }<br /><br /><br />@@ -292,6 +294,9 @@ int Job::Execute()<br /> rc = WEXITSTATUS(rc);<br /> else<br /> rc =
-1;<br/>+ // set success status for batch runs, be pessimistic bt default<br />+ if (rc == 0)<br />+ succeeded =
true;<br/> #endif<br /><br /> // Delete the file/directory. If we fail, don't overwrite the script output in the log,
justthrow warnings.<br />@@ -319,7 +324,7 @@ int Job::Execute()<br /> }<br /><br /> wxString stepstatus;<br />- if (rc
==0)<br />+ if (succeeded)<br /> stepstatus = wxT("s");<br /> else<br /> stepstatus =
steps->GetString(wxT("jstonerror"));<br/></font></tt><font
face="sans-serif">=============================================Romax Technology Limited Rutherford House Nottingham
Science& Technology Park Nottingham, NG7 2PZ England Telephone numbers: +44 (0)115 951 88 00 (main) For other
officelocations see: http://www.romaxtech.com/Contact ================================= =============== E-mail:
info@romaxtech.comWebsite: www.romaxtech.com ================================= ================ Confidentiality
StatementThis transmission is for the addressee only and contains information that is confidential and privileged.
Unlessyou are the named addressee, or authorised to receive it on behalf of the addressee you may not copy or use it,
ordisclose it to anyone else. If you have received this transmission in error please delete from your system and
contactthe sender. Thank you for your cooperation. =================================================</font> 

Re: Propsed pgagent patch: pgAgent reports failure upon success - For Review

От
Dave Page
Дата:
Hi

Can you resend the patch as an attachment please? It's getting
corrupted inline in email.

Thanks.

On Mon, Jul 16, 2012 at 2:46 PM, Martin French
<Martin.French@romaxtech.com> wrote:
> Hi,
>
> I have attempted a patch for an issue where pgAgent incorrectly reports
> failure on a plain SQL job. Please see below.
>
> Feedback/comments welcome.
>
> Thanks
>
> Martin French.
>
>
> diff --git a/connection.cpp b/connection.cpp
> index 5e10078..6103c00 100644
> --- a/connection.cpp
> +++ b/connection.cpp
> @@ -336,6 +336,7 @@ DBresult::DBresult(DBconn *conn, const wxString &query)
> if (result)
> {
> int rc = PQresultStatus(result);
> + conn->SetLastResult(rc);
> if (rc == PGRES_TUPLES_OK)
> maxRows = PQntuples(result);
> else if (rc != PGRES_COMMAND_OK)
> diff --git a/include/connection.h b/include/connection.h
> index 04087db..3cd1c0d 100644
> --- a/include/connection.h
> +++ b/include/connection.h
> @@ -51,7 +51,33 @@ public:
> {
> return conn != 0;
> }
> -
> +        bool LastCommandOk()
> +        {
> +                return IsCommandOk((ExecStatusType)lastResult);
> +        }
> +        bool IsCommandOk(ExecStatusType ret)
> +        {
> +                switch (ret)
> +                {
> +                        case PGRES_COMMAND_OK:
> +                        case PGRES_TUPLES_OK:
> +                        case PGRES_COPY_OUT:
> +                        case PGRES_COPY_IN:
> +                        case PGRES_COPY_BOTH:
> +                                return true;
> +                        default:
> +                                return false;
> +                };
> +        }
> +        void SetLastResult(int res)
> +        {
> +                lastResult = res;
> +        }
> +        int GetLastResult()
> +        {
> +                return lastResult;
> +        }
> +
> DBresult *Execute(const wxString &query);
> wxString ExecuteScalar(const wxString &query);
> int ExecuteVoid(const wxString &query);
> @@ -70,7 +96,7 @@ protected:
> PGconn *conn;
> DBconn *next, *prev;
> bool inUse;
> -
> + int lastResult;
> friend class DBresult;
>
> };
> diff --git a/job.cpp b/job.cpp
> index 9a5bb08..ba270be 100644
> --- a/job.cpp
> +++ b/job.cpp
> @@ -80,6 +80,7 @@ Job::~Job()
> int Job::Execute()
> {
> int rc = 0;
> + bool succeeded = false;
> DBresult *steps = threadConn->Execute(
>                       wxT("SELECT * ")
>                       wxT("  FROM pgagent.pga_jobstep ")
> @@ -138,13 +139,14 @@ int Job::Execute()
> {
> LogMessage(wxString::Format(_("Executing SQL step %s (part of job %s)"),
> stepid.c_str(), jobid.c_str()), LOG_DEBUG);
> rc = stepConn->ExecuteVoid(steps->GetString(wxT("jstcode")));
> + succeeded = stepConn->LastCommandOk();
> output = stepConn->GetLastError();
> stepConn->Return();
> }
> else
> {
> output = _("Couldn't get a connection to the database!");
> - rc = -1;
> + succeeded = false;
> }
>
>
> @@ -292,6 +294,9 @@ int Job::Execute()
> rc = WEXITSTATUS(rc);
> else
> rc = -1;
> + // set success status for batch runs, be pessimistic bt default
> + if (rc == 0)
> + succeeded = true;
> #endif
>
> // Delete the file/directory. If we fail, don't overwrite the script output
> in the log, just throw warnings.
> @@ -319,7 +324,7 @@ int Job::Execute()
> }
>
> wxString stepstatus;
> - if (rc == 0)
> + if (succeeded)
> stepstatus = wxT("s");
> else
> stepstatus = steps->GetString(wxT("jstonerror"));
> ============================================= Romax Technology Limited
> Rutherford House Nottingham Science & Technology Park Nottingham, NG7 2PZ
> England Telephone numbers: +44 (0)115 951 88 00 (main) For other office
> locations see: http://www.romaxtech.com/Contact
> ================================= =============== E-mail: info@romaxtech.com
> Website: www.romaxtech.com =================================
> ================ Confidentiality Statement This transmission is for the
> addressee only and contains information that is confidential and privileged.
> Unless you are the named addressee, or authorised to receive it on behalf of
> the addressee you may not copy or use it, or disclose it to anyone else. If
> you have received this transmission in error please delete from your system
> and contact the sender. Thank you for your cooperation.
> =================================================



--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: Propsed pgagent patch: pgAgent reports failure upon success - For Review

От
"Martin French"
Дата:
<p><i>(See attached file: pgAgent.patch)</i><br /><br /><font face="sans-serif" size="2">Hi</font><br /><br /><tt><font
size="2">pgadmin-hackers-owner@postgresql.orgwrote on 16/07/2012 15:52:45:<br /><br />> From: Dave Page
<dpage@pgadmin.org></font></tt><br/><tt><font size="2">> To: Martin French
<Martin.French@romaxtech.com>,</font></tt><br /><tt><font size="2">> Cc:
pgadmin-hackers@postgresql.org</font></tt><br/><tt><font size="2">> Date: 16/07/2012 18:55</font></tt><br
/><tt><fontsize="2">> Subject: Re: [pgadmin-hackers] Propsed pgagent patch: pgAgent <br />> reports failure upon
success- For Review</font></tt><br /><tt><font size="2">> Sent by:
pgadmin-hackers-owner@postgresql.org</font></tt><br/><tt><font size="2">> <br />> Hi<br />> <br />> Can you
resendthe patch as an attachment please? It's getting<br />> corrupted inline in email.<br />> <br />>
Thanks.<br/>> <br />> On Mon, Jul 16, 2012 at 2:46 PM, Martin French<br />>
<Martin.French@romaxtech.com>wrote:<br />> > Hi,<br />> ><br />> > I have attempted a patch for
anissue where pgAgent incorrectly reports<br />> > failure on a plain SQL job. Please see below.<br />>
><br/>> > Feedback/comments welcome.<br />> ><br />> > Thanks<br />> ><br />> > Martin
French.<br/>> ><br />> ></font></tt><tt><font size="2"><br />> <br />> <br />> <br />> -- <br
/>>Dave Page<br />> Blog: <a href="http://pgsnake.blogspot.com">http://pgsnake.blogspot.com</a><br />>
Twitter:@pgsnake<br />> <br />> EnterpriseDB UK: <a
href="http://www.enterprisedb.com">http://www.enterprisedb.com</a><br/>> The Enterprise PostgreSQL Company<br />>
<br/>> -- <br />> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)<br />> To make
changesto your subscription:<br />> <a
href="http://www.postgresql.org/mailpref/pgadmin-hackers">http://www.postgresql.org/mailpref/pgadmin-hackers</a><br
/>><br /></font></tt><br /><tt><font size="2">Patch attached. Apologies for that. :)</font></tt><br /><br
/><tt><fontsize="2">Cheers</font></tt><br /><br /><tt><font size="2">Martin French</font></tt><font
face="sans-serif">=============================================Romax Technology Limited Rutherford House Nottingham
Science& Technology Park Nottingham, NG7 2PZ England Telephone numbers: +44 (0)115 951 88 00 (main) For other
officelocations see: http://www.romaxtech.com/Contact ================================= =============== E-mail:
info@romaxtech.comWebsite: www.romaxtech.com ================================= ================ Confidentiality
StatementThis transmission is for the addressee only and contains information that is confidential and privileged.
Unlessyou are the named addressee, or authorised to receive it on behalf of the addressee you may not copy or use it,
ordisclose it to anyone else. If you have received this transmission in error please delete from your system and
contactthe sender. Thank you for your cooperation. =================================================</font> 

Re: Propsed pgagent patch: pgAgent reports failure upon success - For Review

От
Dave Page
Дата:
Hi

This still seems to be malformed - I'm getting:

raptor:pgagent dpage$ patch -p1 < ~/Downloads/pgagent.patch
(Stripping trailing CRs from patch.)
patching file connection.cpp
patch: **** malformed patch at line 6: if (result)

Looking at the patch itself, it looks like the indentation is missing
from the first hunk for connection.cpp:

diff --git a/connection.cpp b/connection.cpp
index 5e10078..6103c00 100644
--- a/connection.cpp
+++ b/connection.cpp
@@ -336,6 +336,7 @@ DBresult::DBresult(DBconn *conn, const wxString &query)
if (result)
{
int rc = PQresultStatus(result);
+ conn->SetLastResult(rc);
if (rc == PGRES_TUPLES_OK)
maxRows = PQntuples(result);
else if (rc != PGRES_COMMAND_OK)

If I look at the source file, it's more like this (he says, hoping
Gmail doesn't mangle it):

        if (result)
        {
                int rc = PQresultStatus(result);
                if (rc == PGRES_TUPLES_OK)
                        maxRows = PQntuples(result);
                else if (rc != PGRES_COMMAND_OK)

How are you generating the patch? Has your unmodified version been
inadvertently modified?

On Tue, Jul 17, 2012 at 7:22 AM, Martin French
<Martin.French@romaxtech.com> wrote:
> (See attached file: pgAgent.patch)
>
> Hi
>
> pgadmin-hackers-owner@postgresql.org wrote on 16/07/2012 15:52:45:
>
>> From: Dave Page <dpage@pgadmin.org>
>> To: Martin French <Martin.French@romaxtech.com>,
>> Cc: pgadmin-hackers@postgresql.org
>> Date: 16/07/2012 18:55
>> Subject: Re: [pgadmin-hackers] Propsed pgagent patch: pgAgent
>> reports failure upon success - For Review
>> Sent by: pgadmin-hackers-owner@postgresql.org
>
>
>>
>> Hi
>>
>> Can you resend the patch as an attachment please? It's getting
>> corrupted inline in email.
>>
>> Thanks.
>>
>> On Mon, Jul 16, 2012 at 2:46 PM, Martin French
>> <Martin.French@romaxtech.com> wrote:
>> > Hi,
>> >
>> > I have attempted a patch for an issue where pgAgent incorrectly reports
>> > failure on a plain SQL job. Please see below.
>> >
>> > Feedback/comments welcome.
>> >
>> > Thanks
>> >
>> > Martin French.
>> >
>> >
>
>>
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>> --
>> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgadmin-hackers
>>
>
> Patch attached. Apologies for that. :)
>
> Cheers
>
> Martin French============================================= Romax Technology
> Limited Rutherford House Nottingham Science & Technology Park Nottingham,
> NG7 2PZ England Telephone numbers: +44 (0)115 951 88 00 (main) For other
> office locations see: http://www.romaxtech.com/Contact
> ================================= =============== E-mail: info@romaxtech.com
> Website: www.romaxtech.com =================================
> ================ Confidentiality Statement This transmission is for the
> addressee only and contains information that is confidential and privileged.
> Unless you are the named addressee, or authorised to receive it on behalf of
> the addressee you may not copy or use it, or disclose it to anyone else. If
> you have received this transmission in error please delete from your system
> and contact the sender. Thank you for your cooperation.
> =================================================



--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: Propsed pgagent patch: pgAgent reports failure upon success - For Review

От
"Martin French"
Дата:
<p><font face="sans-serif" size="2">Hi Dave.</font><br /><br /><tt><font size="2">Dave Page <dpage@pgadmin.org>
wroteon 17/07/2012 10:45:28:<br /><br />> From: Dave Page <dpage@pgadmin.org></font></tt><br /><tt><font
size="2">>To: Martin French <Martin.French@romaxtech.com>, </font></tt><br /><tt><font size="2">> Cc:
pgadmin-hackers@postgresql.org,pgadmin-hackers-owner@postgresql.org</font></tt><br /><tt><font size="2">> Date:
17/07/201210:45</font></tt><br /><tt><font size="2">> Subject: Re: [pgadmin-hackers] Propsed pgagent patch: pgAgent
<br/>> reports failure upon success - For Review</font></tt><br /><tt><font size="2">> <br />> Hi<br />>
<br/>> This still seems to be malformed - I'm getting:<br />> <br />> raptor:pgagent dpage$ patch -p1 <
~/Downloads/pgagent.patch<br/>> (Stripping trailing CRs from patch.)<br />> patching file connection.cpp<br
/>>patch: **** malformed patch at line 6: if (result)<br />> <br />> Looking at the patch itself, it looks
likethe indentation is missing<br />> from the first hunk for connection.cpp:<br />> <br />> diff --git
a/connection.cppb/connection.cpp<br />> index 5e10078..6103c00 100644<br />> --- a/connection.cpp<br />> +++
b/connection.cpp<br/>> @@ -336,6 +336,7 @@ DBresult::DBresult(DBconn *conn, const wxString &query)<br />> if
(result)<br/>> {<br />> int rc = PQresultStatus(result);<br />> + conn->SetLastResult(rc);<br />> if (rc
==PGRES_TUPLES_OK)<br />> maxRows = PQntuples(result);<br />> else if (rc != PGRES_COMMAND_OK)<br />> <br
/>>If I look at the source file, it's more like this (he says, hoping<br />> Gmail doesn't mangle it):<br />>
<br/>>         if (result)<br />>         {<br />>                 int rc = PQresultStatus(result);<br />>
               if (rc == PGRES_TUPLES_OK)<br />>                         maxRows = PQntuples(result);<br />>    
           else if (rc != PGRES_COMMAND_OK)<br />> <br />> How are you generating the patch? Has your unmodified
versionbeen<br />> inadvertently modified?<br />> <br />> On Tue, Jul 17, 2012 at 7:22 AM, Martin French<br
/>><Martin.French@romaxtech.com> wrote:<br />> > (See attached file: pgAgent.patch)<br />> ><br
/>>> Hi<br />> ><br />> > pgadmin-hackers-owner@postgresql.org wrote on 16/07/2012 15:52:45:<br
/>>><br />> >> From: Dave Page <dpage@pgadmin.org><br />> >> To: Martin French
<Martin.French@romaxtech.com>,<br/>> >> Cc: pgadmin-hackers@postgresql.org<br />> >> Date:
16/07/201218:55<br />> >> Subject: Re: [pgadmin-hackers] Propsed pgagent patch: pgAgent<br />> >>
reportsfailure upon success - For Review<br />> >> Sent by: pgadmin-hackers-owner@postgresql.org<br />>
><br/>> ><br />> >><br />> >> Hi<br />> >><br />> >> Can you resend the
patchas an attachment please? It's getting<br />> >> corrupted inline in email.<br />> >><br />>
>>Thanks.<br />> >><br />> >> On Mon, Jul 16, 2012 at 2:46 PM, Martin French<br />> >>
<Martin.French@romaxtech.com>wrote:<br />> >> > Hi,<br />> >> ><br />> >> > I
haveattempted a patch for an issue where pgAgent incorrectly reports<br />> >> > failure on a plain SQL
job.Please see below.<br />> >> ><br />> >> > Feedback/comments welcome.<br />> >>
><br/>> >> > Thanks<br />> >> ><br />> >> > Martin French.<br />> >>
><br/>> >> ><br />> ><br />> >><br />> >><br />> >><br />> >>
--<br/>> >> Dave Page<br />> >> Blog: <a
href="http://pgsnake.blogspot.com">http://pgsnake.blogspot.com</a><br/>> >> Twitter: @pgsnake<br />>
>><br/>> >> EnterpriseDB UK: <a href="http://www.enterprisedb.com">http://www.enterprisedb.com</a><br
/>>>> The Enterprise PostgreSQL Company<br />> >><br />> >> --<br />> >> Sent via
pgadmin-hackersmailing list (pgadmin-hackers@postgresql.org)<br />> >> To make changes to your
subscription:<br/>> >> <a
href="http://www.postgresql.org/mailpref/pgadmin-hackers">http://www.postgresql.org/mailpref/pgadmin-hackers</a><br
/>>>><br />> ><br />> > Patch attached. Apologies for that. :)<br />> ><br />> >
Cheers<br/>> ><br />> > Martin French<br />> <br />> <br />> <br />> -- <br />> Dave Page<br
/>>Blog: <a href="http://pgsnake.blogspot.com">http://pgsnake.blogspot.com</a><br />> Twitter: @pgsnake<br />>
<br/>> EnterpriseDB UK: <a href="http://www.enterprisedb.com">http://www.enterprisedb.com</a><br />> The
EnterprisePostgreSQL Company<br />> <br /></font></tt><br /><tt><font size="2">The patch was generated with git
diff.I've just picked up the file off the box with WinSCP directly and emailed it...</font></tt><br /><br /><tt><font
size="2">I'veFTP'd to my local machine this time...</font></tt><br /><br /><tt><font size="2">cheers</font></tt><br
/><br/><i>(See attached file: pgagent.patch)</i><br /><font
face="sans-serif">=============================================Romax Technology Limited Rutherford House Nottingham
Science& Technology Park Nottingham, NG7 2PZ England Telephone numbers: +44 (0)115 951 88 00 (main) For other
officelocations see: http://www.romaxtech.com/Contact ================================= =============== E-mail:
info@romaxtech.comWebsite: www.romaxtech.com ================================= ================ Confidentiality
StatementThis transmission is for the addressee only and contains information that is confidential and privileged.
Unlessyou are the named addressee, or authorised to receive it on behalf of the addressee you may not copy or use it,
ordisclose it to anyone else. If you have received this transmission in error please delete from your system and
contactthe sender. Thank you for your cooperation. =================================================</font> 

Re: Propsed pgagent patch: pgAgent reports failure upon success - For Review

От
Dave Page
Дата:
Great, that got it :-).

Thanks Martin - patch applied and push to the main repo. It'll be
included in the next release.

On Tue, Jul 17, 2012 at 10:52 AM, Martin French
<Martin.French@romaxtech.com> wrote:
> Hi Dave.
>
> Dave Page <dpage@pgadmin.org> wrote on 17/07/2012 10:45:28:
>
>> From: Dave Page <dpage@pgadmin.org>
>
>
>> To: Martin French <Martin.French@romaxtech.com>,
>> Cc: pgadmin-hackers@postgresql.org, pgadmin-hackers-owner@postgresql.org
>> Date: 17/07/2012 10:45
>
>> Subject: Re: [pgadmin-hackers] Propsed pgagent patch: pgAgent
>> reports failure upon success - For Review
>>
>> Hi
>>
>> This still seems to be malformed - I'm getting:
>>
>> raptor:pgagent dpage$ patch -p1 < ~/Downloads/pgagent.patch
>> (Stripping trailing CRs from patch.)
>> patching file connection.cpp
>> patch: **** malformed patch at line 6: if (result)
>>
>> Looking at the patch itself, it looks like the indentation is missing
>> from the first hunk for connection.cpp:
>>
>> diff --git a/connection.cpp b/connection.cpp
>> index 5e10078..6103c00 100644
>> --- a/connection.cpp
>> +++ b/connection.cpp
>> @@ -336,6 +336,7 @@ DBresult::DBresult(DBconn *conn, const wxString
>> &query)
>> if (result)
>> {
>> int rc = PQresultStatus(result);
>> + conn->SetLastResult(rc);
>> if (rc == PGRES_TUPLES_OK)
>> maxRows = PQntuples(result);
>> else if (rc != PGRES_COMMAND_OK)
>>
>> If I look at the source file, it's more like this (he says, hoping
>> Gmail doesn't mangle it):
>>
>>         if (result)
>>         {
>>                 int rc = PQresultStatus(result);
>>                 if (rc == PGRES_TUPLES_OK)
>>                         maxRows = PQntuples(result);
>>                 else if (rc != PGRES_COMMAND_OK)
>>
>> How are you generating the patch? Has your unmodified version been
>> inadvertently modified?
>>
>> On Tue, Jul 17, 2012 at 7:22 AM, Martin French
>> <Martin.French@romaxtech.com> wrote:
>> > (See attached file: pgAgent.patch)
>> >
>> > Hi
>> >
>> > pgadmin-hackers-owner@postgresql.org wrote on 16/07/2012 15:52:45:
>> >
>> >> From: Dave Page <dpage@pgadmin.org>
>> >> To: Martin French <Martin.French@romaxtech.com>,
>> >> Cc: pgadmin-hackers@postgresql.org
>> >> Date: 16/07/2012 18:55
>> >> Subject: Re: [pgadmin-hackers] Propsed pgagent patch: pgAgent
>> >> reports failure upon success - For Review
>> >> Sent by: pgadmin-hackers-owner@postgresql.org
>> >
>> >
>> >>
>> >> Hi
>> >>
>> >> Can you resend the patch as an attachment please? It's getting
>> >> corrupted inline in email.
>> >>
>> >> Thanks.
>> >>
>> >> On Mon, Jul 16, 2012 at 2:46 PM, Martin French
>> >> <Martin.French@romaxtech.com> wrote:
>> >> > Hi,
>> >> >
>> >> > I have attempted a patch for an issue where pgAgent incorrectly
>> >> > reports
>> >> > failure on a plain SQL job. Please see below.
>> >> >
>> >> > Feedback/comments welcome.
>> >> >
>> >> > Thanks
>> >> >
>> >> > Martin French.
>> >> >
>> >> >
>> >
>> >>
>> >>
>> >>
>> >> --
>> >> Dave Page
>> >> Blog: http://pgsnake.blogspot.com
>> >> Twitter: @pgsnake
>> >>
>> >> EnterpriseDB UK: http://www.enterprisedb.com
>> >> The Enterprise PostgreSQL Company
>> >>
>> >> --
>> >> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
>> >> To make changes to your subscription:
>> >> http://www.postgresql.org/mailpref/pgadmin-hackers
>> >>
>> >
>> > Patch attached. Apologies for that. :)
>> >
>> > Cheers
>> >
>> > Martin French
>>
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>
> The patch was generated with git diff. I've just picked up the file off the
> box with WinSCP directly and emailed it...
>
> I've FTP'd to my local machine this time...
>
> cheers
>
> (See attached file: pgagent.patch)
>
> ============================================= Romax Technology Limited
> Rutherford House Nottingham Science & Technology Park Nottingham, NG7 2PZ
> England Telephone numbers: +44 (0)115 951 88 00 (main) For other office
> locations see: http://www.romaxtech.com/Contact
> ================================= =============== E-mail: info@romaxtech.com
> Website: www.romaxtech.com =================================
> ================ Confidentiality Statement This transmission is for the
> addressee only and contains information that is confidential and privileged.
> Unless you are the named addressee, or authorised to receive it on behalf of
> the addressee you may not copy or use it, or disclose it to anyone else. If
> you have received this transmission in error please delete from your system
> and contact the sender. Thank you for your cooperation.
> =================================================



--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: Propsed pgagent patch: pgAgent reports failure upon success - For Review

От
"Martin French"
Дата:
<p><font face="sans-serif" size="2">Hi</font><br /><br /><tt><font size="2">Dave Page <dpage@pgadmin.org> wrote
on17/07/2012 12:04:40:<br /><br />> From: Dave Page <dpage@pgadmin.org></font></tt><br /><tt><font
size="2">>To: Martin French <Martin.French@romaxtech.com>, </font></tt><br /><tt><font size="2">> Cc:
pgadmin-hackers@postgresql.org,pgadmin-hackers-owner@postgresql.org</font></tt><br /><tt><font size="2">> Date:
17/07/201212:04</font></tt><br /><tt><font size="2">> Subject: Re: [pgadmin-hackers] Propsed pgagent patch: pgAgent
<br/>> reports failure upon success - For Review</font></tt><br /><tt><font size="2">> <br />> Great, that got
it:-).<br />> <br />> Thanks Martin - patch applied and push to the main repo. It'll be<br />> included in the
nextrelease.<br />> <br />> On Tue, Jul 17, 2012 at 10:52 AM, Martin French<br />>
<Martin.French@romaxtech.com>wrote:<br />> > Hi Dave.<br />> ><br />> > Dave Page
<dpage@pgadmin.org>wrote on 17/07/2012 10:45:28:<br />> ><br />> >> From: Dave Page
<dpage@pgadmin.org><br/>> ><br />> ><br />> >> To: Martin French
<Martin.French@romaxtech.com>,<br/>> >> Cc: pgadmin-hackers@postgresql.org,
pgadmin-hackers-owner@postgresql.org<br/>> >> Date: 17/07/2012 10:45<br />> ><br />> >>
Subject:Re: [pgadmin-hackers] Propsed pgagent patch: pgAgent<br />> >> reports failure upon success - For
Review<br/>> >><br />> >> Hi<br />> >><br />> >> This still seems to be malformed -
I'mgetting:<br />> >><br />> >> raptor:pgagent dpage$ patch -p1 < ~/Downloads/pgagent.patch<br
/>>>> (Stripping trailing CRs from patch.)<br />> >> patching file connection.cpp<br />> >>
patch:**** malformed patch at line 6: if (result)<br />> >><br />> >> Looking at the patch itself, it
lookslike the indentation is missing<br />> >> from the first hunk for connection.cpp:<br />> >><br
/>>>> diff --git a/connection.cpp b/connection.cpp<br />> >> index 5e10078..6103c00 100644<br />>
>>--- a/connection.cpp<br />> >> +++ b/connection.cpp<br />> >> @@ -336,6 +336,7 @@
DBresult::DBresult(DBconn*conn, const wxString<br />> >> &query)<br />> >> if (result)<br />>
>>{<br />> >> int rc = PQresultStatus(result);<br />> >> + conn->SetLastResult(rc);<br
/>>>> if (rc == PGRES_TUPLES_OK)<br />> >> maxRows = PQntuples(result);<br />> >> else if
(rc!= PGRES_COMMAND_OK)<br />> >><br />> >> If I look at the source file, it's more like this (he
says,hoping<br />> >> Gmail doesn't mangle it):<br />> >><br />> >>         if (result)<br
/>>>>         {<br />> >>                 int rc = PQresultStatus(result);<br />> >>        
       if (rc == PGRES_TUPLES_OK)<br />> >>                         maxRows = PQntuples(result);<br />>
>>                else if (rc != PGRES_COMMAND_OK)<br />> >><br />> >> How are you generating
thepatch? Has your unmodified version been<br />> >> inadvertently modified?<br />> >><br />>
>>On Tue, Jul 17, 2012 at 7:22 AM, Martin French<br />> >> <Martin.French@romaxtech.com> wrote:<br
/>>>> > (See attached file: pgAgent.patch)<br />> >> ><br />> >> > Hi<br />>
>>><br />> >> > pgadmin-hackers-owner@postgresql.org wrote on 16/07/2012 15:52:45:<br />>
>>><br />> >> >> From: Dave Page <dpage@pgadmin.org><br />> >> >> To:
MartinFrench <Martin.French@romaxtech.com>,<br />> >> >> Cc: pgadmin-hackers@postgresql.org<br
/>>>> >> Date: 16/07/2012 18:55<br />> >> >> Subject: Re: [pgadmin-hackers] Propsed
pgagentpatch: pgAgent<br />> >> >> reports failure upon success - For Review<br />> >> >>
Sentby: pgadmin-hackers-owner@postgresql.org<br />> >> ><br />> >> ><br />> >>
>><br/>> >> >> Hi<br />> >> >><br />> >> >> Can you resend the patch
asan attachment please? It's getting<br />> >> >> corrupted inline in email.<br />> >>
>><br/>> >> >> Thanks.<br />> >> >><br />> >> >> On Mon, Jul 16,
2012at 2:46 PM, Martin French<br />> >> >> <Martin.French@romaxtech.com> wrote:<br />> >>
>>> Hi,<br />> >> >> ><br />> >> >> > I have attempted a patch for an
issuewhere pgAgent incorrectly<br />> >> >> > reports<br />> >> >> > failure on a
plainSQL job. Please see below.<br />> >> >> ><br />> >> >> > Feedback/comments
welcome.<br/>> >> >> ><br />> >> >> > Thanks<br />> >> >> ><br
/>>>> >> > Martin French.<br />> >> >> ><br />> >> >> ><br />>
>>><br />> >> >><br />> >> >><br />> >> ><br />> >> >
Patchattached. Apologies for that. :)<br />> >> ><br />> >> > Cheers<br />> >> ><br
/>>>> > Martin French<br />> >><br />> >><br />> >><br />> >><br />>
><br/>> > The patch was generated with git diff. I've just picked up the file off the<br />> > box with
WinSCPdirectly and emailed it...<br />> ><br />> > I've FTP'd to my local machine this time...<br />>
><br/>> > cheers<br />> ><br />> > (See attached file: pgagent.patch)<br />> <br />> <br
/>GreatStuff. Thanks for the assistance Dave. </font></tt><br /><br /><tt><font size="2">Cheers</font></tt><font
face="sans-serif">=============================================Romax Technology Limited Rutherford House Nottingham
Science& Technology Park Nottingham, NG7 2PZ England Telephone numbers: +44 (0)115 951 88 00 (main) For other
officelocations see: http://www.romaxtech.com/Contact ================================= =============== E-mail:
info@romaxtech.comWebsite: www.romaxtech.com ================================= ================ Confidentiality
StatementThis transmission is for the addressee only and contains information that is confidential and privileged.
Unlessyou are the named addressee, or authorised to receive it on behalf of the addressee you may not copy or use it,
ordisclose it to anyone else. If you have received this transmission in error please delete from your system and
contactthe sender. Thank you for your cooperation. =================================================</font>