Re: Nearing final release?

From: Abhijit Menon-Sen <ams(at)oryx(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Nearing final release?
Date: 2004-10-18 12:33:01
Message-ID: 20041018123301.GA11686@penne.toroid.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

At 2004-10-16 18:41:05 -0400, tgl(at)sss(dot)pgh(dot)pa(dot)us wrote:
>
> I think the cleanest solution is probably to add a state flag indicating
> whether ParseComplete should generate a PGresult or not.

Like the appended (incremental) patch?

(I didn't think this would work, because I thought libpq would allow you
to send multiple queries before trying to read results. But you said it
didn't support that, so...)

-- ams

--- libpq-int.h.1~ 2004-10-18 17:42:13.175759981 +0530
+++ libpq-int.h 2004-10-18 17:43:40.105986570 +0530
@@ -269,6 +269,8 @@
* nonblock sending semantics */
bool ext_query; /* was our last query sent with extended
* query protocol? */
+ bool sent_prepare; /* was our last Parse message sent with
+ * PQprepare? */
char copy_is_binary; /* 1 = copy binary, 0 = copy text */
int copy_already_done; /* # bytes already returned in
* COPY OUT */

--- fe-exec.c.2~ 2004-10-18 17:47:55.540189274 +0530
+++ fe-exec.c 2004-10-18 17:48:30.119038902 +0530
@@ -686,6 +686,7 @@
goto sendFailed;

conn->ext_query = true;
+ conn->sent_prepare = true;
if (pqFlush(conn) < 0)
goto sendFailed;
conn->asyncStatus = PGASYNC_BUSY;

--- fe-protocol3.c.2~ 2004-10-18 17:44:06.616198123 +0530
+++ fe-protocol3.c 2004-10-18 17:46:34.431656569 +0530
@@ -220,10 +220,13 @@
conn->asyncStatus = PGASYNC_READY;
break;
case '1': /* Parse Complete */
- if (conn->result == NULL)
- conn->result = PQmakeEmptyPGresult(conn,
- PGRES_COMMAND_OK);
- conn->asyncStatus = PGASYNC_READY;
+ if (conn->sent_prepare) {
+ if (!conn->result)
+ conn->result = PQmakeEmptyPGresult(conn,
+ PGRES_COMMAND_OK);
+ conn->asyncStatus = PGASYNC_READY;
+ conn->sent_prepare = false;
+ }
break;
case '2': /* Bind Complete */
case '3': /* Close Complete */

--- libpq-fe.h.2~ 2004-10-18 17:55:40.632064120 +0530
+++ libpq-fe.h 2004-10-18 17:56:26.501634328 +0530
@@ -312,9 +312,9 @@
int resultFormat);

/* Interface for multiple-result or asynchronous queries */
-extern PGresult *PQsendPrepare(PGconn *conn, const char *stmtName,
- const char *query, int nParams,
- const Oid *paramTypes);
+extern int PQsendPrepare(PGconn *conn, const char *stmtName,
+ const char *query, int nParams,
+ const Oid *paramTypes);
extern int PQsendQuery(PGconn *conn, const char *query);
extern int PQsendQueryParams(PGconn *conn,
const char *command,

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2004-10-18 12:46:08 tsearch2 windows make failure
Previous Message Bruce Momjian 2004-10-18 12:04:11 Re: Open Items

Browse pgsql-patches by date

  From Date Subject
Next Message Dave Page 2004-10-18 13:43:27 Fix VC++/Borland libpq build - pqsignal
Previous Message Bruce Momjian 2004-10-18 11:43:31 Re: additional GCC warning flags