changeset 9271:d467712aee77 HEAD

pgsql: We didn't read all the SQL packets replies from the server.
author Timo Sirainen <tss@iki.fi>
date Tue, 12 May 2009 19:34:54 -0400
parents f9ebd72a73e8
children f5b6974cbee7
files src/lib-sql/driver-pgsql.c
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-sql/driver-pgsql.c	Tue May 12 19:34:06 2009 -0400
+++ b/src/lib-sql/driver-pgsql.c	Tue May 12 19:34:54 2009 -0400
@@ -696,7 +696,16 @@
 
 	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)