]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
pgsql: We didn't read all the SQL packets replies from the server.
authorTimo Sirainen <tss@iki.fi>
Tue, 12 May 2009 23:34:54 +0000 (19:34 -0400)
committerTimo Sirainen <tss@iki.fi>
Tue, 12 May 2009 23:34:54 +0000 (19:34 -0400)
--HG--
branch : HEAD

src/lib-sql/driver-pgsql.c

index b00f988c9b1eb7316a50341b0ede9bf5bb2c98d4..3ffa6748813d177940b0aa6619eb4a1d7057ba0a 100644 (file)
@@ -696,7 +696,16 @@ static int driver_pgsql_result_next_row(struct sql_result *_result)
 
        if (result->rows != 0) {
                /* second time we're here */
-               return ++result->rownum < result->rows;
+               if (++result->rownum < result->rows)
+                       return 1;
+
+               /* end of this packet. see if there's more. FIXME: this may
+                  block, but the current API doesn't provide a non-blocking
+                  way to do this.. */
+               PQclear(result->pgres);
+               result->pgres = PQgetResult(db->pg);
+               if (result->pgres == NULL)
+                       return 0;
        }
 
        if (result->pgres == NULL)