[Patch] change the return value of PQsendFlushRequest

Started by zhangjie2@fujitsu.comover 4 years ago1 messages
#1zhangjie2@fujitsu.com
zhangjie2@fujitsu.com
1 attachment(s)

Hi all

The return value of function PQsendFlushRequest is 1 or 0.
-------------------------------------------------------------------
<para>
Sends a request for the server to flush its output buffer.
<synopsis>
int PQsendFlushRequest(PGconn *conn);
</synopsis>
</para>

<para>
Returns 1 for success. Returns 0 on any failure.
</para>
---------------------------------------------------------------------
But in the following code, false is returned.
I think it would be better to change to 0.

int PQsendFlushRequest(PGconn *conn)
{
......
if (conn->asyncStatus != PGASYNC_IDLE &&
conn->pipelineStatus == PQ_PIPELINE_OFF)
{
appendPQExpBufferStr(&conn->errorMessage,
libpq_gettext("another command is already in progress\n"));
return false; ※
}
......
}

Best Regards!
Zhangjie

Attachments:

PQsendFlushRequest.patchapplication/octet-stream; name=PQsendFlushRequest.patchDownload
diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c
index b13ddab..db0b093 100644
--- a/src/interfaces/libpq/fe-exec.c
+++ b/src/interfaces/libpq/fe-exec.c
@@ -3115,7 +3115,7 @@ PQsendFlushRequest(PGconn *conn)
 	{
 		appendPQExpBufferStr(&conn->errorMessage,
 							 libpq_gettext("another command is already in progress\n"));
-		return false;
+		return 0;
 	}
 
 	if (pqPutMsgStart('H', conn) < 0 ||