Re: Nearing final release? - Mailing list pgsql-hackers

From Abhijit Menon-Sen
Subject Re: Nearing final release?
Date
Msg-id 20041018123301.GA11686@penne.toroid.org
Whole thread Raw
In response to Re: Nearing final release?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Final libpq patch?
Re: Nearing final release?
List pgsql-hackers
At 2004-10-16 18:41:05 -0400, tgl@sss.pgh.pa.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;        /*
wasour 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,
 


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Open Items
Next
From: Andrew Dunstan
Date:
Subject: tsearch2 windows make failure